diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index 29da84a..52d39d8 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -22,13 +22,13 @@ setting.barstyle.description = change bar sprite in unit tap. setting.infoUiScale.name = Info UI Scaling setting.infoUiScale.description = set scale for info ui on left-side. setting.coreItemCheckRate.name = Resource Tap: update rate -setting.coreItemCheckRate.description = set how often the core resources are checked. The slower rate, the fewer lag occur. +setting.coreItemCheckRate.description = set how often the core resources are checked.\nThe slower rate, the fewer lag occur. setting.wavemax.name = Wave Tap: Wave Amount to Display setting.wavemax.description = set waves limit for wave list tap. setting.infoui.name = Display Info UI -setting.infoui.description = enable left-side tap ui to display. when inactive, all associated updates will be stopped. +setting.infoui.description = enable left-side tap ui to display.\nwhen inactive, all associated updates will be stopped. setting.pastwave.name = Wave Tap: Display Previous Wave -setting.pastwave.description = display previous wave on wave list tap. Current wave is highlighted with red color. +setting.pastwave.description = display previous wave on wave list tap.\nCurrent wave is highlighted with red color. setting.emptywave.name = Wave Tap: Display Empty Wave setting.emptywave.description = display empty wave on wave list tap. @@ -39,7 +39,7 @@ setting.rangeNearby.description = Enable automatic range display.\nIf you approa setting.allTeamRange.name = Display Player Team Range setting.allTeamRange.description = display alliance's range. setting.allTargetRange.name = Display All Target Range -setting.allTargetRange.description = display all range. The range of targets that cannot be aimed at themselves is shown as gray. +setting.allTargetRange.description = display all range.\nThe range of targets that cannot be aimed at themselves is shown as gray. setting.coreRange.name = Display Core Range setting.coreRange.description = display enemy core build-limit range. setting.unitRange.name = Display Unit Range @@ -57,7 +57,7 @@ setting.softRangeOpacity.name = Soft Range Opacity setting.softRangeOpacity.description = set opacity of soft range. setting.unitlinelimit.name = UnitLines limit -setting.unitlinelimit.description = many unit path lines cause significant device lag. It must be adjusted to the device environment. +setting.unitlinelimit.description = many unit path lines cause significant device lag.\nIt must be adjusted to the device environment. setting.gaycursor.name = Enable Mouse Trail Effect setting.gaycursor.description = create a rainbow effect on the mouse cursor. setting.unithealthui.name = Display Unit Bar diff --git a/src/UnitInfo/SVars.java b/src/UnitInfo/SVars.java index 0a7f590..34a0424 100644 --- a/src/UnitInfo/SVars.java +++ b/src/UnitInfo/SVars.java @@ -16,13 +16,11 @@ import static arc.Core.settings; import static mindustry.Vars.*; public class SVars { - public static Fi modRoot = modDirectory.child("UnitInfo"); - public static SettingS settingAdder = new SettingS(); public static HudUi hud = new HudUi(); public static float modUiScale = settings.getInt("infoUiScale") / 100f == 0 ? 1 : settings.getInt("infoUiScale") / 100f; public static boolean pathLine = false, unitLine = false, logicLine = false; public static TextureRegion clear = atlas.find("clear"); public static TextureRegion error = atlas.find("error"); - public static boolean debug = false; + public static boolean jsonGen = false; } diff --git a/src/UnitInfo/core/ContentJSON.java b/src/UnitInfo/core/ContentJSON.java index 0f0de97..ef47dd6 100644 --- a/src/UnitInfo/core/ContentJSON.java +++ b/src/UnitInfo/core/ContentJSON.java @@ -1,6 +1,7 @@ package UnitInfo.core; import arc.Core; +import arc.files.Fi; import arc.struct.Seq; import arc.util.Log; import mindustry.*; @@ -10,7 +11,8 @@ import org.hjson.*; import java.lang.reflect.Field; -import static UnitInfo.SVars.modRoot; +import static mindustry.Vars.modDirectory; + public class ContentJSON { public static void save() { for(Seq content : Vars.content.getContentMap()) { @@ -39,7 +41,7 @@ public class ContentJSON { data.add(name, obj); }); try { - modRoot.child(content.peek().getContentType().toString() + ".json").writeString(data.toString(Stringify.FORMATTED)); + modDirectory.child("UnitInfo").child(content.peek().getContentType().toString() + ".json").writeString(data.toString(Stringify.FORMATTED)); } catch (Throwable t){ } diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index 422de6c..071911a 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -233,7 +233,7 @@ public class HudUi { Table waveTable = (Table) scene.find("waves"); Table table = (Table)waveTable.getChildren().first(); //HudFragment#198, name: x - Table statusTable = (Table)waveTable.getChildren().get(1); // TODO: Use scene.find("statustable") when https://github.com/Anuken/Mindustry/pull/5904 is merged + Table statusTable = Version.number >= 131 ? (Table)scene.find("statustable") : (Table)waveTable.getChildren().get(1); waveTable.removeChild(statusTable); table.row(); table.stack(waveInfoTable, statusTable.top(), pathlineTable).fillX().colspan(table.getColumns()); @@ -703,6 +703,7 @@ public class HudUi { int row = 0; for(SpawnGroup group : groupsTmp.keys()){ + int spawners = state.rules.waveTeam.cores().size + (group.type.flying ? spawner.countFlyerSpawns() : spawner.countGroundSpawns()); int amount = groupsTmp.get(group); tx.table(tt -> { Image image = new Image(group.type.uiIcon).setScaling(Scaling.fit); @@ -716,8 +717,11 @@ public class HudUi { new Table(ttt -> { ttt.bottom().left(); Label label = new Label(() -> amount + ""); - label.setFontScale(Scl.scl(modUiScale) * 0.85f); + label.setFontScale(Scl.scl(modUiScale) * 0.9f); + Label multi = new Label(() -> "[gray]x" + spawners); + multi.setFontScale(Scl.scl(modUiScale) * 0.8f); ttt.add(label); + ttt.add(multi).padTop(8f); ttt.pack(); }), @@ -752,7 +756,7 @@ public class HudUi { tt.addListener(new Tooltip(t -> t.background(Tex.button).table(to -> { to.left(); to.table(Tex.underline2, tot -> tot.add("[stat]" + group.type.localizedName + "[]")).row(); - to.add(bundle.format("shar-stat-waveAmount", amount)).row(); + to.add(bundle.format("shar-stat-waveAmount", amount + " [lightgray]x" + spawners + "[]")).row(); to.add(bundle.format("shar-stat-waveShield", group.getShield(j))).row(); if(group.effect != null) { if(group.effect == StatusEffects.none) return; @@ -810,7 +814,7 @@ public class HudUi { public void addWaveTable(){ if(uiIndex != 1) return; waveTable = new Table(table -> { - table.defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight()); + table.defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight() * Scl.scl(modUiScale)); table.add(new Table(Tex.button, t -> { ScrollPane pane = t.pane(new ScrollPane.ScrollPaneStyle(){{ vScroll = Tex.clear; @@ -862,7 +866,7 @@ public class HudUi { public void addItemTable(){ if(uiIndex != 2) return; itemTable = new Table(table -> { - table.left().defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight()); + table.left().defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight() * Scl.scl(modUiScale)); table.table(Tex.button, t -> { ScrollPane pane = t.pane(new ScrollPane.ScrollPaneStyle(){{ vScroll = Tex.clear; diff --git a/src/UnitInfo/core/Main.java b/src/UnitInfo/core/Main.java index 9ccc165..d1966f8 100644 --- a/src/UnitInfo/core/Main.java +++ b/src/UnitInfo/core/Main.java @@ -21,14 +21,14 @@ public class Main extends Mod { Events.on(ClientLoadEvent.class, e -> { hud = new HudUi(); - settingAdder.init(); + new SettingS().init(); hud.addWaveTable(); hud.addUnitTable(); hud.addTable(); hud.addWaveInfoTable(); hud.setEvents(); OverDrawer.setEvent(); - if(debug) ContentJSON.save(); + if(jsonGen) ContentJSON.save(); }); Events.on(WorldLoadEvent.class, e -> { diff --git a/src/UnitInfo/core/SettingS.java b/src/UnitInfo/core/SettingS.java index 81c7d98..77d2138 100644 --- a/src/UnitInfo/core/SettingS.java +++ b/src/UnitInfo/core/SettingS.java @@ -71,7 +71,7 @@ public class SettingS { public void add(Table table) { final String[] str = {""}; Table table1 = new Table(t -> { - final float[] value = new float[1]; + final float[] value = {def}; t.add(new Label(title + ": ")).left().padRight(5) .update(a -> a.setColor(condition.get() ? Color.white : Color.gray)); @@ -95,7 +95,7 @@ public class SettingS { BaseDialog dialog = new BaseDialog("UnitInfo Setting"); dialog.addCloseButton(); sharset = new SettingsMenuDialog.SettingsTable(); - dialog.cont.center().add(sharset); + dialog.cont.center().add(new Table(t -> t.pane(sharset).grow().row())); ui.settings.shown(() -> { Table settingUi = (Table)((Group)((Group)(ui.settings.getChildren().get(1))).getChildren().get(0)).getChildren().get(0); //This looks so stupid lol - lmfao settingUi.row(); @@ -108,7 +108,7 @@ public class SettingS { addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? "default bar" : s + "th bar", tapSeq); addGraphicSlideSetting("infoUiScale", 75, 50, 100, 5, s -> s + "%", tapSeq); addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec", tapSeq); - addGraphicTypeSetting("wavemax", 0, 100,200, true, () -> true, s -> s + "waves", tapSeq); + addGraphicTypeSetting("wavemax", 0, 200,100, true, () -> true, s -> s + "waves", tapSeq); addGraphicCheckSetting("infoui", true, tapSeq); addGraphicCheckSetting("pastwave", false, tapSeq); addGraphicCheckSetting("emptywave", true, tapSeq); @@ -145,7 +145,7 @@ public class SettingS { settingSeq.add(drawSeq, etcSeq); sharset.table(t -> { - Seq