From 92c674ef5ca2346441d84765e7587ec68a5c3a8b Mon Sep 17 00:00:00 2001 From: RushieWashie <57391931+JiroCab@users.noreply.github.com> Date: Thu, 21 Aug 2025 22:15:38 +0800 Subject: [PATCH] Bigger is better right? - Added Font Size that ranges from 0.01x to 3x options for domination, Team Items, Unit Counters - improved the wording of some the settings - reworked the order of counter category - added a button stop tracking for the one person who uses this mod on mobile - improved zoom's sliders making lessen user error leading to breaking zoom - added a battery bar in domination (of the best network) --- assets/bundles/bundle.properties | 47 +++++++---- mod.hjson | 4 +- src/casterui/CuiMain.java | 2 +- src/casterui/CuiVars.java | 24 ++++-- src/casterui/io/ui/CuiFragment.java | 78 ++++++++++++----- .../io/ui/dialog/CuiSettingsDialog.java | 84 ++++++++++++++----- 6 files changed, 173 insertions(+), 66 deletions(-) diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index e8738f1..a021199 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -43,21 +43,24 @@ setting.cui-ShowUnitTable.name =[accent]Show Units table setting.cui-separateTeamsUnit.name =Separate per team's Units setting.cui-teamtotalunitcount.name =Show total unit counts setting.cui-unitFlagCoreUnitHides.name =Hide Units spawned by a core -setting.cui-unitFlagCoreUnitHides.description =Any unit with `spawnedByCore` Flag set\nTurn off to just use the blacklist +setting.cui-unitFlagCoreUnitHides.description =Hide units with `spawnedByCore` Flag set\nTurn off to just use the blacklist setting.cui-teamtotalunitcount =Show total count -setting.cui-unitsPlayerTableStyle.name =Amount style: +setting.cui-unitsPlayerTableStyle.name =Unit counter\namount style: setting.cui-buttonSize.name =Button Sizes setting.cui-buttonSize.description =Default: 40 setting.cui-unitsPlayerTableSize.name =Counter Table max icons/row setting.cui-unitsPlayerTableSize.description =Default: 6 setting.cui-playerunitstablecontols.name =Show Counter controls setting.cui-playerunitstablecontols.description =Add/remove On screen controls to hide/show core units etc & summarize mini player list \nDoes not affect hotkeys! +setting.cui-playerunitstablecstoptracking.name = Stop Tracking button +setting.cui-playerunitstablecstoptracking.description =[accent]Meant for the two people who use this on mobile[] setting.cui-PlayerUnitsTableSide.name =Counter Side: setting.cui-PlayerUnitsTableSide.description =Default: Bottom Left\nApplies next map change / Ui rebuilt setting.cui-playerunitstablestyle.name =Counter Table Style setting.cui-playerunitstablestyle.description =Default: ButtonTrans\nApplies next map change / Ui rebuilt setting.cui-playerunitstables-x.name =Counter X offset setting.cui-playerunitstables-y.name =Counter Y offset +setting.cui-unitsPlayerTableFont.name =Counter Font Size: setting.cui-units-category.name =Units options setting.cui-showUnitBar.name =Show unit Health and Shield bars ([accent]wip[]) @@ -97,9 +100,9 @@ setting.cui-hotkeys-category.name =HotKey options setting.cui-input-category.name =Input options setting.cui-maxZoom.name =Zoom IN Limit -setting.cui-maxZoom.description =Default: 6x +setting.cui-maxZoom.description =Default: 6x[accent] \nLower = Further\nHigher = Closer setting.cui-minZoom.name =Zoom OUT Limit -setting.cui-minZoom.description =Default: 1.5x +setting.cui-minZoom.description =Default: 1.5x[accent]\nLower = Further\nHigher = Closer setting.cui-minimalCursor.name =Custom Cursor setting.cui-minimalCursor.description =Replace the mouse cursor to a minal version\nRestart Required! setting.cui-respectCommandMode.name =Hotkeys works in command mode @@ -107,8 +110,9 @@ setting.cui-respectTyping.name =Hotkeys works while typing in chat setting.cui-respectLockInputs.name =Hotkeys while inputs are locked setting.cui-respectDialog.name =Hotkeys while a Dialog is open setting.cui-respectLockInputs.description =Aka world logic cutscenes -setting.cui-hideWithMenus.name =Hide CUI Hud/menu with hud/menu fragment -setting.cui-auto-toggle-menu.name =Hide Game's hud on Start +setting.cui-hideWithMenus.name =[accent]Sync CUI Elements with Hud's visibility +setting.cui-hideWithMenus.description =Hide Cui's Ui when vaniila Ui is hidden +setting.cui-auto-toggle-menu.name =[accent]Hide Game's hud on Start setting.cui-blocks-category.name =Blocks options setting.cui-showPowerBar.name =Show Power bar ([scarlet]not working[]) @@ -134,16 +138,17 @@ setting.cui-blockinfoSide.description =Default: Left\nApplies next map change / setting.cui-blockinfo-x.name =Block Info X Offset: setting.cui-blockinfo-y.name =Block Info Y Offset: setting.cui-blockinfo-colour.name =Block info Team colour background -setting.cui-domination-toggle.name =[accent]Show Block Counter -setting.cui-domination-vertical.name =Vertical Block Counter +setting.cui-domination-toggle.name =[accent]Domination[] (block counts) +setting.cui-domination-vertical.name =Vertical Domination setting.cui-domination-TeamIcons.name =Show Team Icons setting.cui-domination-TeamIcons.description =Applies next map change / Ui rebuilt setting.cui-domination-side.name =Domination Side -setting.cui-domination-x.name =Block Count X offset -setting.cui-domination-y.name =Block Count Y offset -setting.cui-domination-trans.name =Block Count Transparency +setting.cui-domination-font-size.name =Domination font Size +setting.cui-domination-x.name =Domination X offset +setting.cui-domination-y.name =Domination Y offset +setting.cui-domination-trans.name =Domination Transparency -setting.cui-domination-category.name =Config Block Counts +setting.cui-domination-category.name =Config Domination setting.cui-domination-raw.name =Total \ue811 Raw Blocks setting.cui-domination-raw.description =This will count all blocks including hidden & non buildable blocks setting.cui-domination-percent.name =Show \ue827 Percent @@ -159,7 +164,9 @@ setting.cui-domination-crafting.name =Total \ue830 Crafting blocks setting.cui-domination-units.name =Total \ue86d Units blocks setting.cui-domination-effect.name =Total \ue853 effect blocks setting.cui-domination-logic.name =Total \ue80e logic blocks -setting.cui-domination-graph.name =Display Team's Best Power Grid +setting.cui-domination-graph.name = Teams's \uf781Best Power Grid +setting.cui-domination-battery.name = Teams's \uf87b Battery % +setting.cui-domination-battery.description =Only shows the battery in the best power grid! setting.cui-advance-category.name =Advance options setting.cui-unitsPlayerTableUpdateRate.name =Update rate of Hud elements @@ -178,9 +185,12 @@ setting.cui-TeamItemsShortenItems.description =Item numbers are shown full/raw n setting.cui-TeamItemsAlpha.name =Team Items Transparency setting.cui-TeamItemsAlpha.description =Default: 80% setting.cui-TeamItemsSide.name =Team Items Side: +setting.cui-TeamItems-icon-size.name =Team Items icon size +setting.cui-TeamItems-font-size.name =Team Items font size setting.cui-TeamItemsSide.description =Default: Right\nApplies next map change / Ui rebuilt setting.cui-TeamItems-x.name =Team Items X Offset: setting.cui-TeamItems-y.name =Team Items Y Offset: +setting.cui-TeamItemsIconStyle.name =Team item\nIcon Style cui-rebuild =Rebuild Ui cui-rebuild-info =Apply ui changes without changing maps @@ -195,6 +205,7 @@ cui-teamblacklister =Filter Teams settings.cui-preset =Presets settings.cui-preset.disclaimer =This will [scarlet]override all settings[] +settings.cui-preset.lol =Todo: bully rushie to add a export/imports here lol settings.cui-reset =Reset [scarlet]ALL[] to Defaults @@ -294,8 +305,9 @@ cui-factoryProgress4 =Top Bar cui-factoryProgress5 =Bottom Bar cui-factoryProgress6 =% -cui-unitsplayer-style0 =BESIDE Icon -cui-unitsplayer-style1 =INSIDE Icon +cui-unitsplayer-style0 =After Icon \n(\ue86d 0) +cui-unitsplayer-style1 =Inside Icon \n(\ue86d) +cui-unitsplayer-style2 =Before Icon \n(0 \ue86d) cui-unitshealtbar-style1 =centered bar cui-unitshealtbar-style2 =right bar @@ -324,4 +336,7 @@ cui-cmd-limits3 =ALL units cui-filter0 =Domination cui-filter1 =Units cui-filter2 =Core Items -cui-filter3 =Cycle players \ No newline at end of file +cui-filter3 =Cycle players + +cui-zoom-unbalance-in= Lower than Zoom Out! +cui-zoom-unbalance-out= Higher than Zoom in! \ No newline at end of file diff --git a/mod.hjson b/mod.hjson index ad9767a..9cd5335 100644 --- a/mod.hjson +++ b/mod.hjson @@ -2,8 +2,8 @@ name: "caster-ui-java" displayName: "Caster User interface" description: "Aming to make the client a bit better for casting! with ease of use, simplicity and elegance in mind \n \n Java rewrite of 'JiroCab/Caster-Ui' which was based off 'Ferlern/extended-UI' \nconflicts with 'Ferlern/extended-UI' \n\nPLEASE DON'T THIS FOR AN ADVANTAGE IN PVP THANKS" author: "RushieWashie, WMF Industries" -subtitle: "v5.1 (v7) Helping you cast games~" -version: 5.1 +subtitle: "v5.2 (v7) Helping you cast games~" +version: 5.2 minGameVersion: 140.4 hidden: true diff --git a/src/casterui/CuiMain.java b/src/casterui/CuiMain.java index fd282b2..866cfab 100644 --- a/src/casterui/CuiMain.java +++ b/src/casterui/CuiMain.java @@ -13,7 +13,7 @@ public CuiMain() { Events.on(EventType.ClientLoadEvent.class, you -> CuiVars.init()); Events.on(EventType.WorldLoadEvent.class, you -> CuiVars.postInt()); Events.run(EventType.Trigger.update, CuiVars::update); - Events.on(EventType.BlockDestroyEvent.class, block -> CuiVars.renderer.coreDestroyAlert(block)); + Events.on(EventType.BlockDestroyEvent.class, block -> CuiVars.cuiRenderer.coreDestroyAlert(block)); } catch (Exception e){ Log.err("CUI UI: can't load " + "\n: " + e + e.getCause()); } diff --git a/src/casterui/CuiVars.java b/src/casterui/CuiVars.java index 39a99ac..a8937ed 100644 --- a/src/casterui/CuiVars.java +++ b/src/casterui/CuiVars.java @@ -24,7 +24,7 @@ import static casterui.io.CuiBinding.toggle_cui_kill_switch; public class CuiVars { - public static CuiWorldRenderer renderer = new CuiWorldRenderer(); + public static CuiWorldRenderer cuiRenderer = new CuiWorldRenderer(); public static CuiFragment fragment = new CuiFragment(); public static CuiInputs inputs = new CuiInputs(); public static CuiTeamMangerDialog teamManger = new CuiTeamMangerDialog(); @@ -41,12 +41,13 @@ public class CuiVars { public static Vec2[] savedCameras = new Vec2[11]; public static DecimalFormat decFor = new DecimalFormat("#.##"), decForMini = new DecimalFormat("#.#"); - public static boolean[] dominationSettings = new boolean[15]; + public static boolean[] dominationSettings = new boolean[16]; public static boolean - showBlockInfo = false, showCountersUnits = false, showCountersPlayers = false, showCountersButton = false, + showBlockInfo = false, showCountersUnits = false, showCountersPlayers = false, showCountersButton = false, showStopTrackingButton = false, countersSeparateTeams = false, countersCoreUnits = false, countersCoreFlagged = false, countersTotals = false, dominationVertical = false, dominationColoured = false, dominationIcons = false, showTeamItems = false, showDomination = false; + public static float dominationFontSize = 0, teamItemsFontSize = 0, teamItemsIconSize = 0; public static boolean[] hiddenTeamsDomination = new boolean[Team.all.length], hiddenTeamsUnits = new boolean[Team.all.length], hiddenTeamsItems = new boolean[Team.all.length], hiddenCycleTeam = new boolean[Team.all.length]; public static boolean[][] hiddenTeamList = {hiddenTeamsDomination, hiddenTeamsUnits, hiddenTeamsItems, hiddenCycleTeam}; public static Table updateCheckTable = new Table(); @@ -54,7 +55,7 @@ public class CuiVars { public static void init(){ updateChecker.run(); CuiSettingsDialog.buildCategory(); - renderer.worldRenderer(); + cuiRenderer.worldRenderer(); rebindDialog.load(); if(Core.settings.getBool("cui-minimalCursor")) overrideCursors(); animateCats = Core.settings.getBool("cui-animateSettings"); @@ -65,7 +66,7 @@ public static void init(){ public static void postInt(){ fragment.clearTables(); - renderer.circleQueue.clear(); + cuiRenderer.circleQueue.clear(); updateSettings(true); CuiVars.heldUnit = null; @@ -144,6 +145,7 @@ public static void updateSettings(boolean full){ dominationSettings[12] = settings.getBool("cui-domination-percent"); dominationSettings[13] = settings.getBool("cui-domination-raw"); dominationSettings[14] = settings.getBool("cui-domination-graph"); + dominationSettings[15] = settings.getBool("cui-domination-battery"); if(!full) return; @@ -159,6 +161,18 @@ public static void updateSettings(boolean full){ countersSeparateTeams = settings.getBool("cui-separateTeamsUnit"); countersCoreUnits = settings.getBool("cui-unitsTableCoreUnits"); countersTotals = settings.getBool("cui-teamtotalunitcount"); + showStopTrackingButton = settings.getBool("cui-playerunitstablecstoptracking"); + + dominationFontSize = settings.getInt("cui-domination-font-size") /20f; + teamItemsFontSize = settings.getInt("cui-TeamItems-font-size") /20f; + teamItemsIconSize = settings.getInt("cui-TeamItems-icon-size") /20f; + + if(dominationFontSize <= 0) dominationFontSize = 0.01f; + if(teamItemsFontSize <= 0) teamItemsFontSize = 0.01f; + if(teamItemsIconSize <= 0) teamItemsIconSize = 0.01f; + float x= settings.getInt("cui-maxZoom"), n = settings.getInt("cui-minZoom") ; + if(x != 12) Vars.renderer.maxZoom = x == 0 ? 0.01f : x * 0.5f; + if(n != 12) Vars.renderer.minZoom = n == 0 ? 0.01f : n * 0.5f; } public static void updateHiddenTeams(){ diff --git a/src/casterui/io/ui/CuiFragment.java b/src/casterui/io/ui/CuiFragment.java index d4d535b..bc52cb5 100644 --- a/src/casterui/io/ui/CuiFragment.java +++ b/src/casterui/io/ui/CuiFragment.java @@ -11,6 +11,7 @@ import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; +import casterui.*; import casterui.io.ui.dialog.*; import mindustry.*; import mindustry.core.*; @@ -60,7 +61,7 @@ public class CuiFragment { Seq alignSides = Seq.with(Align.bottom, Align.bottomLeft, Align.bottomRight, Align.top, Align.topLeft, Align.topRight, Align.center, Align.left, Align.right); public int[][] blockCats = new int[Team.all.length][Category.all.length + 4]; public int worldBlocks; - public String[] dominationIconList = {Iconc.host + "", Iconc.turret + "", Iconc.production + "", Iconc.distribution + "", Iconc.liquid + "", Iconc.power + "", Iconc.defense + "", Iconc.crafting + "", Iconc.units + "", Iconc.effect + "", Iconc.logic + "", Iconc.home + "",Iconc.map + "", Iconc.list + "", Iconc.statusElectrified + ""}; + public String[] dominationIconList = {Iconc.host + "", Iconc.turret + "", Iconc.production + "", Iconc.distribution + "", Iconc.liquid + "", Iconc.power + "", Iconc.defense + "", Iconc.crafting + "", Iconc.units + "", Iconc.effect + "", Iconc.logic + "", Iconc.home + "",Iconc.map + "", Iconc.list + "", Iconc.statusElectrified + "", Iconc.blockBattery + ""}; public void BuildTables(Group parent){ @@ -123,6 +124,7 @@ public void StutteredUpdateTables() { if (showCountersUnits) controlTable.button(Icon.admin, Styles.defaulti, () -> settings.put("cui-unitsTableCoreUnits", !settings.getBool("cui-unitsTableCoreUnits"))).pad(1).width(buttonSize).height(buttonSize).tooltip("@units-table.button.core-units.tooltip"); if (showCountersPlayers) controlTable.button(Icon.host, Styles.defaulti, () -> settings.put("cui-playerTableSummarizePlayers", !settings.getBool("cui-playerTableSummarizePlayers"))).pad(1).width(buttonSize).height(buttonSize).tooltip("@units-table.button.compact-player-list.tooltip"); } + if(showStopTrackingButton)controlTable.button(Icon.cancel, Styles.defaulti, () -> inputs.stopTracking()).pad(1).width(buttonSize).height(buttonSize); //endregion @@ -133,6 +135,10 @@ public void StutteredUpdateTables() { //prevent doubling of rows boolean[] newRow = {false}; + int style = settings.getInt("cui-unitsPlayerTableStyle"), tabSize = settings.getInt("cui-unitsPlayerTableSize"); + float fontSize = settings.getInt("cui-unitsPlayerTableFont") /20f; + if(fontSize <= 0 ) fontSize = 0.01f; + for (int id = 0 ; id < Team.all.length ; id++){ if(hiddenTeamsUnits[id]) continue; @@ -152,13 +158,12 @@ public void StutteredUpdateTables() { teamUnits.merge(u.type.id, 1, Integer::sum); } - int style = settings.getInt("cui-unitsPlayerTableStyle"), tabSize = settings.getInt("cui-unitsPlayerTableSize"); if(countersTotals){ int total = 0; for (Entry entry : teamUnits.entrySet()) total += entry.getValue(); if(total > 0){ - makeIcon(style, total, team, Icon.units.getRegion(), "@wavemode.counts", true); + makeIcon(style, total, team, Icon.units.getRegion(), "@wavemode.counts", true, fontSize); icons[0]++; newRow[0] = false; } @@ -169,7 +174,7 @@ public void StutteredUpdateTables() { Integer i = entry.getValue(); UnitType unit = Vars.content.unit(u); - makeIcon(style, i, unit, team); + makeIcon(style, i, unit, team, fontSize); if (icons[0] >= tabSize) { unitTable.row(); @@ -307,6 +312,7 @@ public void UpdateTables(){ if(mouseBuilding.block instanceof Battery || mouseBuilding.block instanceof PowerNode || mouseBuilding.block instanceof BeamNode) { blockTable.label(() -> "[stat]" +formatAmount(graphs.getBatteryStored(), 0) + "/" + formatAmount(graphs.getTotalBatteryCapacity(), 0)); } + blockTable.row(); } if (mouseBuilding.items != null && mouseBuilding.items.total() > 0) blockTable.add(blockItemTable).row(); if (mouseBuilding.liquids != null) blockTable.add(blockLiquidTable).row(); @@ -336,6 +342,7 @@ public void UpdateTables(){ } if(settings.getBool("cui-BlockInfoLastPlayer") && mouseBuilding.lastAccessed != null){ + blockTable.table(a-> a.label(() -> mouseBuilding.lastAccessed).pad(1f)).row(); } @@ -363,7 +370,7 @@ public void buildTeamItemTable() { teamItemsTable.clear(); if (settings.getBool("cui-ShowTeamItems")) { - int teamItemsMax = settings.getInt("cui-TeamItemsRow"); + int teamItemsMax = settings.getInt("cui-TeamItemsRow"), iconPlace = settings.getInt("cui-TeamItemsIconStyle"); for (TeamData team : Vars.state.teams.active) { if (team.core() == null) continue; @@ -371,19 +378,27 @@ public void buildTeamItemTable() { Table sub = colouredTable(team.team.color, team.team.color.a * (settings.getInt("cui-TeamItemsAlpha") * 0.1f)); int[] itemTypes = {0}; team.core().items.each((item, amount) -> { - sub.image(item.uiIcon).size(iconSizes).left(); - sub.label(() -> (!settings.getBool("cui-TeamItemsShortenItems") ? amount : UI.formatAmount(amount)) + " "); + if (iconPlace == 1) { + sub.stack( + new Image(item.uiIcon), + new Label((!settings.getBool("cui-TeamItemsShortenItems") ? amount : UI.formatAmount(amount)) + " ") + ).fontScale(teamItemsFontSize).size(iconSizes * teamItemsIconSize).center(); + }else { + if(iconPlace == 0)sub.label(() -> (!settings.getBool("cui-TeamItemsShortenItems") ? amount : UI.formatAmount(amount)) + " ").fontScale(teamItemsFontSize); + sub.image(item.uiIcon).size(iconSizes * teamItemsIconSize).left(); + if(iconPlace == 2) sub.label(() -> (!settings.getBool("cui-TeamItemsShortenItems") ? amount : UI.formatAmount(amount)) + " ").fontScale(teamItemsFontSize); + } + if (itemTypes[0] >= teamItemsMax) { itemTypes[0] = 0; sub.row(); } else itemTypes[0]++; }); - teamItemsTable.add(sub).growX().row(); + teamItemsTable.add(sub).growX().padLeft(3f).padRight(3f).row(); } } } - public void buildDominationTable(){ dominationTable.clear(); updateSettings(false); // array only setting update on each rebuild @@ -409,7 +424,7 @@ public void buildDominationTable(){ if(rawTxt.getMinWidth() > size[0]) size[0] = rawTxt.getMaxWidth(); equlize.add(rawTxt); - iconTab.add(rawTxt); + iconTab.add(rawTxt).fontScale(dominationFontSize); } dominationTable.add(iconTab).grow(); if(dominationVertical)dominationTable.row(); @@ -433,7 +448,7 @@ public void buildDominationTable(){ Table tab = dominationColoured ? colouredTable(Team.get(t).color, trans * 0.1f) : new Table(); tab.defaults().pad(5f).grow().minWidth(size[0]).minHeight(size[1]).align(Align.center).scaling(Scaling.fill); - float[] tsize ={35, 20}; + float[] tsize ={35 *dominationFontSize , 20 * dominationFontSize}; if(dominationIcons){ Label team = new Label(Team.get(t).emoji.equals("") ? "[#" + Team.get(t).color + "]#"+ Team.get(t).id + "[]" : "[white]" +Team.get(t).emoji ); team.setStyle(Styles.outlineLabel); @@ -441,8 +456,10 @@ public void buildDominationTable(){ tab.add(team); teamsizes.add(team); - if(team.getMinHeight() > tsize[1]) tsize[1] = team.getMinHeight(); - if(team.getMinWidth() > tsize[0]) tsize[0] = team.getMinWidth(); + team.setFontScale(dominationFontSize); + if(team.getPrefHeight() > tsize[1]) tsize[1] = team.getPrefHeight(); + if(team.getMaxWidth() > tsize[0]) tsize[0] = team.getMaxWidth(); + } tab.defaults().minHeight(tsize[1]).minWidth(tsize[0]); @@ -464,7 +481,21 @@ public void buildDominationTable(){ () -> new Color().set(Pal.power).lerp(Team.get(finalT).color, 0.5f), () -> graph.getSatisfaction() ); - }; + } + tab.add(pBar); + }else if(i == 15){ + @Nullable PowerGraph graph = pgo.get(t); + Bar pBar; + if(graph == null) { + pBar = new BarHelper(() -> "n", () -> Pal.power, () -> 0); + }else { + int finalT = t; + pBar = new BarHelper( + () -> formatAmount(graph.getLastPowerStored(), -1), + () -> new Color().set(Pal.power).lerp(Team.get(finalT).color, 0.6f), + () -> graph.getLastPowerStored() / graph.getLastCapacity() + ); + } tab.add(pBar); }else{ String cnt = blockCats[t][i] + ""; @@ -479,6 +510,7 @@ public void buildDominationTable(){ if(rawTxt.getMinHeight() > size[1]) size[1] = rawTxt.getMinHeight(); if(rawTxt.getMinWidth() > size[0]) size[0] = rawTxt.getMaxWidth(); + rawTxt.setFontScale(CuiVars.dominationFontSize); equlize.add(rawTxt); tab.add(rawTxt); } @@ -491,8 +523,11 @@ public void buildDominationTable(){ Arrays.fill(blockCats[t], 0); } - for (Label l : equlize) l.setSize(size[0], size[1]); - for (Label t : teamsizes) if (dominationVertical) t.setWidth(size[0]); + for (Label l : equlize){ + l.setSize(size[0], size[1]); + } + for (Label t : teamsizes) if (dominationVertical) t.setWidth(size[0] + 3f); + worldBlocks = 0; } @@ -513,17 +548,17 @@ public void clearTables(){ } - public void makeIcon(int style, int i, UnitType unit, Team team){ - makeIcon(style, i, team, unit.uiIcon, unit.name, false); + public void makeIcon(int style, int i, UnitType unit, Team team, float fontSize){ + makeIcon(style, i, team, unit.uiIcon, unit.name, false, fontSize); } - public void makeIcon(int style, int i, Team team, TextureRegion icon, String name, boolean color){ + public void makeIcon(int style, int i, Team team, TextureRegion icon, String name, boolean color, float fontSize){ var img = new Image(new TextureRegion(icon)); float fsize = color ? unitsIconSize * 0.85f: unitsIconSize; if(color)img.setColor(team.color); if(style == 1){ //TODO: anything above 1k is hard to see - Table countTable = new Table(t -> t.center().add(new Label(() -> "[#" + team.color.toString() + "]" + i + "[white]")).style(Styles.outlineLabel).scaling(Scaling.bounded).color(new Color(1, 1, 1, 0.85f))); + Table countTable = new Table(t -> t.center().add(new Label(() -> "[#" + team.color.toString() + "]" + i + "[white]")).style(Styles.outlineLabel).scaling(Scaling.bounded).color(new Color(1, 1, 1, 0.85f)).fontScale(fontSize)); img.setSize(iconSizes); countTable.setColor(new Color(1, 1, 1, 0.85f)); unitTable.stack( @@ -532,8 +567,9 @@ public void makeIcon(int style, int i, Team team, TextureRegion icon, String nam countTable ).tooltip(name).size(fsize).scaling(Scaling.bounded).get(); }else { + if(style == 0)unitTable.add(new Label(() -> "[#" + team.color.toString() + "]" + i + "[white]")).style(Styles.outlineLabel).fontScale(fontSize); unitTable.add(img).tooltip(name).size(fsize).scaling(Scaling.bounded).get(); - unitTable.add(new Label(() -> "[#" + team.color.toString() + "]" + i + "[white]")).style(Styles.outlineLabel).get(); + if(style == 2)unitTable.add(new Label(() -> "[#" + team.color.toString() + "]" + i + "[white]")).style(Styles.outlineLabel).fontScale(fontSize); } } diff --git a/src/casterui/io/ui/dialog/CuiSettingsDialog.java b/src/casterui/io/ui/dialog/CuiSettingsDialog.java index e2a57be..16c83fa 100644 --- a/src/casterui/io/ui/dialog/CuiSettingsDialog.java +++ b/src/casterui/io/ui/dialog/CuiSettingsDialog.java @@ -2,11 +2,14 @@ import arc.*; import arc.graphics.*; +import arc.graphics.g2d.*; import arc.scene.style.*; import arc.scene.ui.*; import arc.struct.*; import arc.util.*; import casterui.*; +import mindustry.*; +import mindustry.content.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; @@ -25,8 +28,8 @@ public class CuiSettingsDialog { public static Seq allCuiOptions = new Seq<>(); public static ObjectSethiddenUnits = new ObjectSet<>(), coreUnitsTypes = new ObjectSet<>(); public static float commonHeight = 60f; - private static final int cursorStyles = 8, offsetMinMax = 200; - static DecimalFormat decFor = new DecimalFormat("#.##"); + private static final int cursorStyles = 8, offsetMinMax = 200, fontScaleMax = 60; + static DecimalFormat decFor = new DecimalFormat("#.##"), decForS = new DecimalFormat("#.#"); //Foo's complaint categories public static class CollapserSetting extends SettingsMenuDialog.SettingsTable.Setting{ @@ -112,18 +115,29 @@ public void counterCategory(SettingsMenuDialog.SettingsTable table) { //Counter table subTable.checkPref("cui-ShowUnitTable", true); - subTable.checkPref("cui-ShowPlayerList", true); - subTable.checkPref("cui-hideNoUnitPlayers", true); - subTable.sliderPref("cui-unitsPlayerTableStyle", 0, 0, 1, s -> bundle.get("cui-unitsplayer-style" + s)); - subTable.sliderPref("cui-unitsIconSize", 32, 1, 100, String::valueOf); + + subTable.pref(new CollapserSetting("cui-offset-div", 6)); + subTable.checkPref("cui-unitFlagCoreUnitHides", true); subTable.checkPref("cui-separateTeamsUnit", true); subTable.checkPref("cui-teamtotalunitcount", true); + subTable.sliderPref("cui-unitsPlayerTableStyle", 0, 0, 2, s -> bundle.get("cui-unitsplayer-style" + s)); subTable.sliderPref("cui-unitsPlayerTableSize", 6, 1, 20, String::valueOf); - subTable.checkPref("cui-playerunitstablecontols", false); + + subTable.pref(new CollapserSetting("cui-offset-div", 6)); + + subTable.checkPref("cui-ShowPlayerList", true); + subTable.checkPref("cui-hideNoUnitPlayers", true); + + subTable.pref(new CollapserSetting("cui-offset-div", 6)); + + subTable.checkPref("cui-playerunitstablecontols", true); + subTable.checkPref("cui-playerunitstablecstoptracking", mobile); subTable.sliderPref("cui-buttonSize", 40, 1, 100, String::valueOf); subTable.pref(new CollapserSetting("cui-offset-div", 6)); + subTable.sliderPref("cui-unitsIconSize", 32, 1, 100, String::valueOf); + subTable.sliderPref("cui-unitsPlayerTableFont", 20, 0, fontScaleMax, s-> "x" + decForS.format(s == 0 ? 0.01f : s/20f) + "x"); subTable.sliderPref("cui-PlayerUnitsTableSide", 1, 0, 8, s -> bundle.get("cui-side"+s)); subTable.sliderPref("cui-playerunitstablestyle", 0, 0 , 9, s -> bundle.get("cui-blockinfostyle-s" + s )); subTable.sliderPref("cui-playerunitstables-x", 0, -offsetMinMax , offsetMinMax, String::valueOf); @@ -226,22 +240,25 @@ public void teamsCategory(SettingsMenuDialog.SettingsTable table){ subTable.checkPref("cui-TeamItemsShortenItems", true); subTable.sliderPref("cui-TeamItemsAlpha", 8, 0, 10, s -> s > 0 ? s != 10 ? s + "0%" : "100%" : "@off"); subTable.sliderPref("cui-TeamItemsRow", 6, 0, 10, s -> s +1 + ""); + subTable.sliderPref("cui-TeamItemsIconStyle", 0, 0, 2, s -> bundle.get("cui-unitsplayer-style" + s)); subTable.pref(new CollapserSetting("cui-offset-div", 6)); subTable.sliderPref("cui-TeamItemsSide", 8, 0, 8, s -> bundle.get("cui-side"+s)); subTable.sliderPref("cui-TeamItems-x", 0, -offsetMinMax , offsetMinMax, String::valueOf ); subTable.sliderPref("cui-TeamItems-y", 0, -offsetMinMax , offsetMinMax, String::valueOf); -// subTable.checkPref("cui-TeamItems-x-abs", false); -// subTable.checkPref("cui-TeamItems-y-abs", false); + subTable.sliderPref("cui-TeamItems-icon-size", 20, 0, fontScaleMax, s-> "x" + decForS.format(s == 0 ? 0.01f : s/20f)); + subTable.sliderPref("cui-TeamItems-font-size", 20, 0, fontScaleMax, s-> "x" + decForS.format(s == 0 ? 0.01f : s/20f)); subTable.pref(new CollapserSetting("cui-cat-div-counter", 6)); - subTable.checkPref("cui-domination-toggle", false); + subTable.checkPref("cui-domination-toggle", true); subTable.checkPref("cui-domination-vertical", false); subTable.checkPref("cui-domination-TeamIcons", true); - subTable.sliderPref("cui-domination-trans", 8, 0, 10, s -> s > 0 ? s != 10 ? s + "0%" : "100%" : "@off"); subTable.pref(new CollapserSetting("cui-domination-more", 9)); + subTable.pref(new CollapserSetting("cui-cat-div-counter", 6)); + subTable.sliderPref("cui-domination-trans", 8, 0, 10, s -> s > 0 ? s != 10 ? s + "0%" : "100%" : "@off"); subTable.sliderPref("cui-domination-side", 0, 0, 8, s -> bundle.get("cui-side"+s)); + subTable.sliderPref("cui-domination-font-size", 20, 0, fontScaleMax, s-> "x" + decForS.format(s == 0 ? 0.01f : s/20f)); subTable.sliderPref("cui-domination-x", 0, -offsetMinMax , offsetMinMax, String::valueOf); subTable.sliderPref("cui-domination-y", 0, -offsetMinMax , offsetMinMax, String::valueOf); @@ -260,25 +277,40 @@ public void inputCategory(SettingsMenuDialog.SettingsTable table){ table.collapser( t -> { SettingsMenuDialog.SettingsTable subTable = new SettingsMenuDialog.SettingsTable(); + subTable.checkPref("cui-hideWithMenus", false); subTable.checkPref("cui-respectCommandMode", true); subTable.checkPref("cui-respectTyping", false); subTable.checkPref("cui-respectLockInputs", true); subTable.checkPref("cui-respectDialog", true); - subTable.checkPref("cui-hideWithMenus", true); subTable.checkPref("cui-auto-toggle-menu", true); subTable.pref(new CollapserSetting("cui-category-div", 6)); subTable.sliderPref("cui-maxZoom", 12, 0, 125, s -> { - if(s == 12) return "@off"; + if(s == 12){ + if(renderer.maxZoom != 6) renderer.maxZoom = 6f; + return "@off"; + } float f = s * 0.5f; if(s == 0) f = 0.01f; + if(f <= renderer.minZoom){ + renderer.maxZoom = renderer.minZoom; + return "[darkgray]" + decFor.format(f) + "x \n[scarlet]" + bundle.get("cui-zoom-unbalance-in"); + } renderer.maxZoom = f; return decFor.format(f) + "x"; }); //Nearly every ui mod changes this lmao subTable.sliderPref("cui-minZoom", 3, 1, 125, s -> { - if(s == 3) return "@off"; + if(s == 3){ + if(renderer.maxZoom != 1.5f)renderer.minZoom = 1.5f; + return "@off"; + } float f = s * 0.5f; + if(f >= renderer.maxZoom){ + renderer.minZoom = renderer.maxZoom; + return "[darkgray]" + decFor.format(f) + "x \n[scarlet]" + bundle.get("cui-zoom-unbalance-out"); + } + renderer.minZoom = f; return decFor.format(f) + "x"; }); @@ -299,6 +331,7 @@ public void advanceCategory(SettingsMenuDialog.SettingsTable table){ table.button("@setting.cui-advance-category.name", Icon.settings, Styles.togglet, () -> advanceHudShown[0] = !advanceHudShown[0]).marginLeft(14f).growX().height(commonHeight).checked(a -> advanceHudShown[0]).padTop(5f).row(); table.collapser( t -> { SettingsMenuDialog.SettingsTable subTable = new SettingsMenuDialog.SettingsTable(); + subTable.pref(new CollapserSetting("cui-offset-div", 6)); subTable.sliderPref("cui-unitsPlayerTableUpdateRate", 10, 1, 100, String::valueOf); subTable.sliderPref("cui-TeamItemsUpdateRate", 2, 1, 3, s -> s == 1 ? "Fast" : s == 2 ? "Normal" : "Slow"); subTable.checkPref("cui-animateSettings", true); @@ -323,11 +356,15 @@ public void dominationSubCategory(SettingsMenuDialog.SettingsTable table){ table.button("@setting.cui-domination-category.name", Icon.export, Styles.togglet, () -> dominactionShown[0] = !dominactionShown[0]).marginLeft(14f).width(400f).height(commonHeight).checked(a -> dominactionShown[0]).padTop(5f).scaling(Scaling.bounded).row(); table.collapser( t -> { SettingsMenuDialog.SettingsTable subTable = new SettingsMenuDialog.SettingsTable(); - subTable.checkPref("cui-domination-totals", false); + subTable.checkPref("cui-domination-totals", true); subTable.checkPref("cui-domination-raw", false); - subTable.checkPref("cui-domination-core", false); - subTable.checkPref("cui-domination-percent", false); + subTable.checkPref("cui-domination-core", true); + subTable.checkPref("cui-domination-percent", true); + + subTable.pref(new CollapserSetting("cui-offset-div", 6)); + subTable.checkPref("cui-domination-graph", false); + subTable.checkPref("cui-domination-battery", false); subTable.pref(new CollapserSetting("cui-offset-div", 6)); @@ -357,7 +394,7 @@ public void cyclePlayerSubCategory(SettingsMenuDialog.SettingsTable table){ TeamBlackListerDialog teamBlackListerDialog = new TeamBlackListerDialog(); teamBlackListerDialog.show(3); }).marginLeft(14f).width(400f).scaling(Scaling.bounded).row(); - }; + } } @@ -392,7 +429,13 @@ private static void showPreset() { bd.hide(); Log.info("Caster-ui present 1 loaded!"); }); - }); + }).row(); + + Label lol = new Label(Core.bundle.get("settings.cui-preset.lol")); + lol.setAlignment(Align.center); + lol.setWrap(true); + bd.cont.add(lol).row(); + bd.show(); } @@ -544,6 +587,5 @@ public static void setDefaults(ObjectSet set, boolean showCoreUnits){ } } } - - + }