diff --git a/core/assets/bundles/bundle-mdtx.properties b/core/assets/bundles/bundle-mdtx.properties index e76f60a8ac24..026e424c12f9 100644 --- a/core/assets/bundles/bundle-mdtx.properties +++ b/core/assets/bundles/bundle-mdtx.properties @@ -1,3 +1,25 @@ +#UI +join.addressCopyHint = 复制服务器地址:[accent]{0} +join.addressCopySuccessfully = 复制地址成功:[accent]{0} +join.addServerHint = 添加服务器: [accent]{0} +join.addServerSuccessfully = 添加服务器成功: [accent]{0} + +mods.disable = 禁用Mod + +mods.recommend = [accent]MdtX[]推荐辅助模组列表 +mods.recommend.lastUpdated = 推荐列表更新时间:{0} +mods.recommend.info = 经过精选的辅助模组 +mods.recommend.mod.description = 经过精选的推荐模组 +mods.recommend.mod.name = 模组:{0} +mods.recommend.mod.author = 作者: {0} +mods.recommend.mod.minGameVersion = 最低支持游戏版本:{0} +mods.recommend.mod.lastUpdated = 上次更新时间:{0} +mods.recommend.mod.stars = Github收藏数:{0} + +alphaLoading = {jump}[gray]加载中... +alphaLoadFailed = {sick}[gray]加载失败... +#end UI + status.slow.name = 缓慢 status.shielded.name = 保护 status.corroded.name = 腐蚀 @@ -588,23 +610,4 @@ marker.attack.description = 标记攻击位置 marker.defense.description = 标记守护位置 marker.question.description = 问号 -settings.maxMsgRecorded.name = 最大聊天记录数 - -join.addressCopyHint = 复制服务器地址:[accent]{0} -join.addressCopySuccessfully = 复制地址成功:[accent]{0} -join.addServerHint = 添加服务器: [accent]{0} -join.addServerSuccessfully = 添加服务器成功: [accent]{0} - -mods.disable = 禁用Mod - -mods.recommend = [accent]MdtX[]推荐辅助模组列表 -mods.recommend.lastUpdated = 推荐列表更新时间:{0} -mods.recommend.info = 经过精选的辅助模组 -mods.recommend.mod.description = 经过精选的推荐模组 -mods.recommend.mod.name = 模组:{0} -mods.recommend.mod.author = 作者: {0} -mods.recommend.mod.minGameVersion = 最低支持游戏版本:{0} -mods.recommend.mod.lastUpdated = 上次更新时间:{0} -mods.recommend.mod.stars = Github收藏数:{0} - -alphaLoading = {jump}[gray]加载中... \ No newline at end of file +settings.maxMsgRecorded.name = 最大聊天记录数 \ No newline at end of file diff --git a/core/src/mindustryX/features/ui/ModsRecommendDialog.java b/core/src/mindustryX/features/ui/ModsRecommendDialog.java index 6d3562d1dad7..c84a74dea36d 100644 --- a/core/src/mindustryX/features/ui/ModsRecommendDialog.java +++ b/core/src/mindustryX/features/ui/ModsRecommendDialog.java @@ -33,6 +33,7 @@ public class ModsRecommendDialog extends BaseDialog{ private ObjectMap textureCache; private RecommendMeta meta; + private boolean fetchModList; public ModsRecommendDialog(){ super(""); @@ -54,26 +55,36 @@ private void rebuild(){ textureCache = Reflect.get(Vars.ui.mods, "textureCache"); } - if(meta != null){ - rebuildCont(); - return; + if(meta == null){ + String json = Core.files.internal("recommendMods.json").readString(); + + meta = JsonIO.json.fromJson(RecommendMeta.class, json); } - String json = Core.files.internal("recommendMods.json").readString(); + if(!fetchModList){ + ElementX.setLoading(cont); - meta = JsonIO.json.fromJson(RecommendMeta.class, json); + Reflect.invoke(Vars.ui.mods, "getModList", new Cons[]{listings -> { + Seq modListings = (Seq)listings; - ElementX.setLoading(cont); + // ??? + if(modListings == null){ + ElementX.setLoadFailed(cont); + return; + } - Reflect.invoke(Vars.ui.mods, "getModList", new Cons[]{listings -> { - Seq modListings = (Seq)listings; + for(RecommendModMeta modMeta : meta.modRecommend){ + modMeta.listing = modListings.find(modListing -> modMeta.repo.equals(modListing.repo)); + } - for(RecommendModMeta modMeta : meta.modRecommend){ - modMeta.listing = modListings.find(modListing -> modMeta.repo.equals(modListing.repo)); - } + fetchModList = true; + rebuildCont(); + }}, Cons.class); - rebuildCont(); - }}, Cons.class); + return; + } + + rebuildCont(); } private void rebuildCont(){ @@ -123,6 +134,10 @@ private void setupModCard(Table table, RecommendModMeta modMeta){ table.defaults().growX(); ModListing modListing = modMeta.listing; + if(modListing == null){ + Log.warn("Recommend Mod '@' not found in github.", modMeta.repo); + return; + } table.table(title -> { title.add(new Card(Pal.gray, StylesX.grayOuterDark, info -> { diff --git a/core/src/mindustryX/utils/ElementX.java b/core/src/mindustryX/utils/ElementX.java index 756b7c373ea3..1998a734e6b9 100644 --- a/core/src/mindustryX/utils/ElementX.java +++ b/core/src/mindustryX/utils/ElementX.java @@ -16,6 +16,11 @@ public static void setLoading(Table table){ table.add(new FLabel("@alphaLoading")).style(Styles.outlineLabel).expand().center(); } + public static void setLoadFailed(Table table){ + table.clearChildren(); + table.add(new FLabel("@alphaLoadFailed")).style(Styles.outlineLabel).expand().center(); + } + public static void cardShadow(Table table){ cardShadow(table, 8f, Pal.darkerGray); }