From 899baa222008bf290e83a925ae70ef6278b066c5 Mon Sep 17 00:00:00 2001 From: sharlottes Date: Sun, 10 Apr 2022 19:12:55 +0900 Subject: [PATCH] item record --- src/UnitInfo/core/HudUi.java | 18 +- src/UnitInfo/core/Main.java | 8 + src/UnitInfo/ui/HUDFragment.java | 9 +- src/UnitInfo/ui/Updatable.java | 2 +- src/UnitInfo/ui/windows/CoreDisplay.java | 226 ++++++++++++++---- .../ui/windows/CoresItemsDisplay.java | 199 --------------- src/UnitInfo/ui/windows/UnitDisplay.java | 2 +- src/UnitInfo/ui/windows/WaveDisplay.java | 4 +- src/UnitInfo/ui/windows/WindowTables.java | 7 +- 9 files changed, 201 insertions(+), 274 deletions(-) delete mode 100644 src/UnitInfo/ui/windows/CoresItemsDisplay.java diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index bf60410..1befa49 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -33,7 +33,6 @@ public class HudUi { public Table mainTable = new Table(); public Table baseTable = new Table(); public Table waveInfoTable = new Table(); - public CoreDisplay itemTable; public SchemDisplay schemTable; public Teamc shotTarget; @@ -45,8 +44,6 @@ public class HudUi { public float a; public int uiIndex = 3; - CoresItemsDisplay coreItems = new CoresItemsDisplay(); - @SuppressWarnings("unchecked") public T getTarget(){ if(locked && lockedTarget != null) { @@ -73,9 +70,7 @@ public class HudUi { float heat = 0; public void setEvents() { - Events.on(EventType.WorldLoadEvent.class, e -> itemTable.rebuild()); Events.run(EventType.Trigger.update, ()->{ - itemTable.setEvent(); OverDrawer.target = getTarget(); OverDrawer.locked = locked; if(settings.getBool("deadTarget") && locked && lockedTarget != null && !Groups.all.contains(e -> e == lockedTarget)) { @@ -96,7 +91,6 @@ public class HudUi { } mainTable.clearChildren(); addTable(); - coreItems.rebuild(); } if(settings.getBool("autoShooting")) { @@ -149,12 +143,6 @@ public class HudUi { unit.controlWeapons(player.shooting && !boosted); } }); - - Events.on(EventType.BlockDestroyEvent.class, e -> { - if(e.tile.block() instanceof CoreBlock) coreItems.resetUsed(); - }); - Events.on(EventType.CoreChangeEvent.class, e -> coreItems.resetUsed()); - Events.on(EventType.ResetEvent.class, e -> coreItems.resetUsed()); } public void setLeftUnitTable(Table table) { @@ -285,8 +273,7 @@ public class HudUi { label.setText(bundle.get(hud)); table.removeChild(baseTable); labelTable.setPosition(buttons.items[uiIndex].x, buttons.items[uiIndex].y); - itemTable = new CoreDisplay(); - baseTable = table.table(tt -> tt.stack(itemTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get(); + baseTable = table.table(tt -> tt.stack(labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get(); a = 1f; } @@ -319,8 +306,7 @@ public class HudUi { t.row(); } }); - itemTable = new CoreDisplay(); - baseTable = table.table(tt -> tt.stack(itemTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get(); + baseTable = table.table(tt -> tt.stack(labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get(); table.fillParent = true; table.visibility = () -> ui.hudfrag.shown && !ui.minimapfrag.shown(); diff --git a/src/UnitInfo/core/Main.java b/src/UnitInfo/core/Main.java index 7432de3..0c91c54 100644 --- a/src/UnitInfo/core/Main.java +++ b/src/UnitInfo/core/Main.java @@ -3,6 +3,9 @@ package UnitInfo.core; import UnitInfo.shaders.*; import UnitInfo.ui.HUDFragment; import UnitInfo.ui.MindowsTex; +import UnitInfo.ui.windows.CoreDisplay; +import UnitInfo.ui.windows.WindowTable; +import UnitInfo.ui.windows.WindowTables; import arc.*; import mindustry.*; import mindustry.game.EventType.*; @@ -37,6 +40,7 @@ public class Main extends Mod { Events.on(ClientLoadEvent.class, e -> { new SettingS().init(); MindowsTex.init(); + WindowTables.init(); new HUDFragment().build(Vars.ui.hudGroup); hud = new HudUi(); hud.addTable(); @@ -46,5 +50,9 @@ public class Main extends Mod { OverDrawer.setEvent(); if(jsonGen) ContentJSON.save(); }); + + Events.on(WorldLoadEvent.class, e -> { + ((CoreDisplay) WindowTables.coreTable).resetUsed(); + }); } } diff --git a/src/UnitInfo/ui/HUDFragment.java b/src/UnitInfo/ui/HUDFragment.java index 3dab190..e9418b7 100644 --- a/src/UnitInfo/ui/HUDFragment.java +++ b/src/UnitInfo/ui/HUDFragment.java @@ -3,8 +3,7 @@ package UnitInfo.ui; import arc.scene.*; import mindustry.ui.fragments.*; -import static UnitInfo.ui.windows.WindowTables.unitTable; -import static UnitInfo.ui.windows.WindowTables.waveTable; +import static UnitInfo.ui.windows.WindowTables.*; public class HUDFragment extends Fragment{ @Override @@ -17,16 +16,18 @@ public class HUDFragment extends Fragment{ t.center().right(); t.add(unitTable).size(250f).visible(false); t.add(waveTable).size(250f).visible(false); + t.add(coreTable).size(250f).visible(false); // sidebar t.add(new TaskbarTable( unitTable, - waveTable + waveTable, + coreTable )).visible(TaskbarTable.visibility); t.update(()->{ for (Element child : t.getChildren()) { - if(child instanceof Updatable u) u.setEvent(); + if(child instanceof Updatable u) u.update(); } }); }); diff --git a/src/UnitInfo/ui/Updatable.java b/src/UnitInfo/ui/Updatable.java index 42d17ba..c596931 100644 --- a/src/UnitInfo/ui/Updatable.java +++ b/src/UnitInfo/ui/Updatable.java @@ -1,5 +1,5 @@ package UnitInfo.ui; public interface Updatable { - void setEvent(); + void update(); } diff --git a/src/UnitInfo/ui/windows/CoreDisplay.java b/src/UnitInfo/ui/windows/CoreDisplay.java index 2ad31b5..bd05b43 100644 --- a/src/UnitInfo/ui/windows/CoreDisplay.java +++ b/src/UnitInfo/ui/windows/CoreDisplay.java @@ -1,70 +1,196 @@ package UnitInfo.ui.windows; -import UnitInfo.SVars; -import arc.scene.Element; +import UnitInfo.ui.OverScrollPane; +import UnitInfo.ui.SBar; +import UnitInfo.ui.Updatable; +import arc.Core; +import arc.graphics.Color; +import arc.math.Mathf; +import arc.math.geom.Vec2; +import arc.scene.event.HandCursorListener; import arc.scene.style.*; -import arc.scene.ui.ScrollPane; +import arc.scene.ui.*; import arc.scene.ui.layout.*; +import arc.struct.*; +import arc.struct.Seq; import arc.util.*; -import mindustry.gen.Tex; +import mindustry.Vars; +import mindustry.content.UnitTypes; +import mindustry.core.UI; +import mindustry.game.Team; +import mindustry.gen.*; +import mindustry.graphics.Pal; +import mindustry.input.DesktopInput; +import mindustry.type.*; import mindustry.ui.Styles; +import mindustry.world.blocks.storage.CoreBlock; -import static UnitInfo.SVars.modUiScale; -import static arc.Core.*; import static mindustry.Vars.*; -public class CoreDisplay extends Table { - static float itemScrollPos, heat; - static Table table = new Table(); +public class CoreDisplay extends WindowTable implements Updatable { + Vec2 scrollPos = new Vec2(0, 0); + ObjectMap> usedItems = new ObjectMap<>(); + ObjectMap> usedUnits = new ObjectMap<>(); + ObjectMap> prevItems = new ObjectMap<>(); + ObjectMap> updateItems = new ObjectMap<>(); + ObjectIntMap coreAmount = new ObjectIntMap<>(); + float heat; - public CoreDisplay() { - fillParent = true; - visibility = () -> 2 == SVars.hud.uiIndex; - - left().defaults().height(35f * 8f * Scl.scl(modUiScale)); - table(Tex.button, t -> { - ScrollPane pane = t.pane(Styles.nonePane, rebuild()).get(); - pane.update(() -> { - Element result = scene.hit(input.mouseX(), input.mouseY(), true); - if(pane.hasScroll() && (result == null || !result.isDescendantOf(pane))) - scene.setScrollFocus(null); - itemScrollPos = pane.getScrollY(); - }); - pane.setOverscroll(false, false); - pane.setScrollingDisabled(true, false); - pane.setScrollYForce(itemScrollPos); - - t.update(() -> { - NinePatchDrawable patch = (NinePatchDrawable)Tex.button; - t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f))); - }); - }).padRight(Scl.scl(modUiScale) * 39 * 8f); + public CoreDisplay() { + super("Core Display", Icon.list, t -> {}); + resetUsed(); } - public void setEvent() { - heat += Time.delta; + @Override + public void build() { + scrollPos = new Vec2(0, 0); - if(heat > 60f) { + top(); + topBar(); + + table(Styles.black8, t -> { + ScrollPane pane = new OverScrollPane(new Table(table -> { + for(Team team : Team.baseTeams) { + table.add(setTable(team).background(((NinePatchDrawable)Tex.underline2).tint(team.color))).row(); + } + }), Styles.nonePane, scrollPos).disableScroll(true, false); + t.add(pane); + }).top().right().grow().get().parent = null; + + resizeButton(); + } + + @Override + public void update() { + heat += Time.delta; + if(heat >= 60f) { heat = 0f; - rebuild(); + for(Team team : Team.baseTeams) { + if(team==Team.sharded) Log.info(prevItems.get(Team.sharded)); + updateItem(team); + Log.info(prevItems.get(Team.sharded)); + if(coreAmount.get(team) != team.cores().size){ + coreAmount.put(team, team.cores().size); + } + } } } - public Table rebuild() { - table.clear(); - table.table(t -> { - for(int i = 0; i < CoresItemsDisplay.tables.size; i++){ - if((state.rules.pvp && CoresItemsDisplay.teams[i] != player.team()) || CoresItemsDisplay.teams[i].cores().isEmpty()) continue; - int finalI = i; - t.table(tt -> { - tt.center().defaults().width(Scl.scl(modUiScale) * 44 * 8f); - CoresItemsDisplay.tables.get(finalI).setBackground(((NinePatchDrawable)Tex.underline2).tint(CoresItemsDisplay.teams[finalI].color)); - tt.add(CoresItemsDisplay.tables.get(finalI)).left(); - }).pad(4); - t.row(); - } - }); + public void resetUsed(){ + usedItems.clear(); + usedUnits.clear(); + updateItems.clear(); + prevItems.clear(); + coreAmount.clear(); + for(Team team : Team.baseTeams) { + usedItems.put(team, new ObjectSet<>()); + usedUnits.put(team, new ObjectSet<>()); + Seq stacks = new Seq<>(); + Vars.content.items().each(i -> stacks.add(new ItemStack(i, 0))); + updateItems.put(team, stacks); + prevItems.put(team, stacks); + coreAmount.put(team, team.cores().size); + } + } - return table; + public void updateItem(Team team){ + CoreBlock.CoreBuild core = team.core(); + Seq prev = prevItems.get(team); + if (core != null) { + Seq stack = updateItems.get(team); + if(stack.isEmpty()) Vars.content.items().each(i -> stack.add(new ItemStack(i, 0))); + for (Item item : Vars.content.items()) { + stack.get(item.id).set(item, core.items.get(item) - (prev != null ? prev.get(item.id).amount : 0)); + if (prev != null) prev.get(item.id).set(item, core.items.get(item)); + } + } + if (prev != null) prev.clear(); + Seq stacks = new Seq<>(); + if(core != null) Vars.content.items().each(i -> stacks.add(new ItemStack(i, core.items.get(i)))); + prevItems.put(team, stacks); + } + + public Table setTable(Team team){ + return new Table(table -> { + table.label(() -> "[#" + team.color.toString() + "]" + team.name + "[]").row(); + table.table().update(coretable -> { + coretable.clear(); + + final int[] i = {0}; + for(CoreBlock.CoreBuild core : team.cores()) { + coretable.table(tt -> { + tt.stack( + new Table(s -> { + s.center(); + Image image = new Image(core.block.uiIcon); + image.clicked(() -> { + if(control.input instanceof DesktopInput) + ((DesktopInput) control.input).panning = true; + Core.camera.position.set(core.x, core.y); + }); + if(!mobile) { + HandCursorListener listener1 = new HandCursorListener(); + image.addListener(listener1); + image.update(() -> { + image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)); + }); + } + + s.add(image).size(iconLarge).tooltip(tool -> { + tool.background(Tex.button).label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")"); + }); + }), + new Table(h -> { + h.bottom().defaults().height(9f).width(iconLarge * 1.5f).growX(); + h.add(new SBar(() -> "", () -> Pal.health, () -> core.health / core.block.health).rect().init()); + h.pack(); + }) + ).row(); + Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")"); + label.setFontScale(0.75f); + tt.add(label); + }).padTop(2).padLeft(4).padRight(4); + if(++i[0] % 4 == 0) coretable.row(); + } + }).row(); + + table.table().update(itemTable -> { + itemTable.clear(); + final int[] i = {0}; + CoreBlock.CoreBuild core = team.core(); + if(core != null) for(Item item : Vars.content.items().copy().filter(item-> core.items.has(item))){ + itemTable.stack( + new Table(ttt -> { + ttt.image(item.uiIcon).size(iconSmall).tooltip(tttt -> tttt.background(Styles.black6).add(item.localizedName).style(Styles.outlineLabel).margin(2f)); + ttt.add(UI.formatAmount(core.items.get(item))).minWidth(5 * 8f).left(); + }), + new Table(ttt -> { + ttt.bottom().right(); + int amount = updateItems.get(team).isEmpty()?0:Mathf.floor(updateItems.get(team).get(item.id).amount); + Label label = new Label((amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "/s[]"); + label.setFontScale(0.65f); + ttt.add(label).bottom().right().padTop(16f); + ttt.pack(); + })).padRight(3).left(); + if(++i[0] % 5 == 0) itemTable.row(); + } + }).row(); + + table.table().update(unitTable -> { + unitTable.clear(); + + final int[] i = {0}; + for(UnitType unit : Vars.content.units()){ + if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){ + unitTable.table(tt -> { + tt.center(); + tt.image(unit.uiIcon).size(iconSmall).padRight(3).tooltip(ttt -> ttt.background(Styles.black6).add(unit.localizedName).style(Styles.outlineLabel).margin(2f)); + tt.add(UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))).padRight(3).minWidth(5 * 8f).left(); + }); + if(++i[0] % 5 == 0) unitTable.row(); + } + } + }); + }); } } diff --git a/src/UnitInfo/ui/windows/CoresItemsDisplay.java b/src/UnitInfo/ui/windows/CoresItemsDisplay.java deleted file mode 100644 index a5652cd..0000000 --- a/src/UnitInfo/ui/windows/CoresItemsDisplay.java +++ /dev/null @@ -1,199 +0,0 @@ -package UnitInfo.ui.windows; - -import UnitInfo.ui.SBar; -import arc.Core; -import arc.graphics.Color; -import arc.math.Mathf; -import arc.scene.event.HandCursorListener; -import arc.scene.ui.*; -import arc.scene.ui.layout.*; -import arc.struct.*; -import arc.util.Strings; -import arc.util.Time; -import arc.util.Tmp; -import mindustry.content.*; -import mindustry.core.*; -import mindustry.game.*; -import mindustry.gen.*; -import mindustry.graphics.Pal; -import mindustry.input.DesktopInput; -import mindustry.type.*; -import mindustry.ui.*; -import mindustry.world.blocks.storage.*; - -import static UnitInfo.SVars.*; -import static arc.Core.*; -import static mindustry.Vars.*; - -public class CoresItemsDisplay { - static final ObjectMap> usedItems = new ObjectMap<>(); - static final ObjectMap> usedUnits = new ObjectMap<>(); - static final ObjectMap> prevItems = new ObjectMap<>(); - static final ObjectMap> updateItems = new ObjectMap<>(); - static final ObjectIntMap coreAmount = new ObjectIntMap<>(); - static CoreBlock.CoreBuild core; - public static Seq tables = new Seq<>(); - - public static Team[] teams; - static float heat; - - public CoresItemsDisplay() { - resetUsed(); - } - - public void resetUsed(){ - usedItems.clear(); - usedUnits.clear(); - updateItems.clear(); - prevItems.clear(); - coreAmount.clear(); - teams = Team.baseTeams; - for(Team team : teams) { - usedItems.put(team, new ObjectSet<>()); - usedUnits.put(team, new ObjectSet<>()); - Seq stacks = new Seq(); - content.items().each(i -> stacks.add(new ItemStack(i, 0))); - updateItems.put(team, stacks); - prevItems.put(team, stacks); - coreAmount.put(team, team.cores().size); - } - tables.each(t->t.background(null)); - rebuild(); - } - - public void updateItem(Team team){ - if(prevItems.get(team) != null && core != null) for(Item item : content.items()){ - updateItems.get(team).get(item.id).set(item, core.items.get(item) - prevItems.get(team).get(item.id).amount); - prevItems.get(team).get(item.id).set(item, core.items.get(item)); - } - prevItems.clear(); - Seq stacks = new Seq(); - if(core != null) content.items().each(i -> stacks.add(new ItemStack(i, core.items.get(i)))); - prevItems.put(team, stacks); - - } - - public Table setTable(Team team){ - return new Table(t -> { - t.update(() -> { - core = team.core(); - - if(settings.getBool("itemcal")) { - heat += Time.delta; - - if(heat >= settings.getInt("coreItemCheckRate")) { - heat = 0; - updateItem(team); - } - } - - if(coreAmount.get(team) != team.cores().size){ - coreAmount.put(team, team.cores().size); - rebuild(); - } - }); - - Label label1 = new Label(() -> "[#" + team.color.toString() + "]" + team.name + "[]"); - label1.setFontScale(modUiScale); - t.add(label1).row(); - t.table(coretable -> { - final int[] i = {0}; - for(CoreBlock.CoreBuild core : team.cores()) { - coretable.table(tt -> { - tt.stack( - new Table(s -> { - s.center(); - Image image = new Image(core.block.uiIcon); - image.clicked(() -> { - if(control.input instanceof DesktopInput) - ((DesktopInput) control.input).panning = true; - Core.camera.position.set(core.x, core.y); - }); - if(!mobile) { - HandCursorListener listener1 = new HandCursorListener(); - image.addListener(listener1); - image.update(() -> { - image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)); - }); - } - image.addListener(new Tooltip(tttt -> { - Label label = new Label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")"); - label.setFontScale(Scl.scl(modUiScale)); - tttt.background(Tex.button).add(label); - })); - s.add(image).size(iconLarge * modUiScale); - }), - new Table(h -> { - h.bottom().defaults().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * iconLarge * 1.5f).growX(); - h.add(new SBar(() -> "", () -> Pal.health, () -> core.health / core.block.health).rect().init()); - h.pack(); - }) - ); - tt.row(); - Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")"); - label.setFontScale(Scl.scl(modUiScale) * 0.75f); - tt.add(label); - }).padTop(Scl.scl(modUiScale) * 2).padLeft(Scl.scl(modUiScale) * 4).padRight(Scl.scl(modUiScale) * 4); - if(++i[0] % 4 == 0) coretable.row(); - } - }); - t.row(); - t.table().update(itemTable -> { - itemTable.clear(); - final int[] i = {0}; - for(Item item : content.items()){ - if(team.core() != null && team.core().items.has(item)) { - Table table1 = new Table(ttt -> { - ttt.image(item.uiIcon).size(iconSmall * modUiScale).tooltip(tttt -> tttt.background(Styles.black6).margin(2f * modUiScale).add(item.localizedName).style(Styles.outlineLabel)); - Label label = new Label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item))); - label.setFontScale(modUiScale); - ttt.add(label).minWidth(5 * 8f * modUiScale).left(); - }); - - - if(settings.getBool("itemcal")) { - Table table2 = new Table(ttt -> { - ttt.bottom().right(); - Label label = new Label(() -> { - int amount = (int)(updateItems.get(team).get(item.id).amount / ((settings.getInt("coreItemCheckRate") * 1f) / 60f)); - return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "/s[]"; - }); - label.setFontScale(0.65f * modUiScale); - ttt.add(label).bottom().right().padTop(16f * modUiScale); - ttt.pack(); - }); - - itemTable.stack(table1, table2).padRight(3 * modUiScale).left(); - } - else itemTable.add(table1).padRight(3 * modUiScale).left(); - if(++i[0] % 5 == 0) itemTable.row(); - } - } - }); - t.row(); - t.table().update(unitTable -> { - unitTable.clear(); - final int[] i = {0}; - for(UnitType unit : content.units()){ - if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){ - unitTable.table(tt -> { - tt.center(); - tt.image(unit.uiIcon).size(iconSmall * modUiScale).padRight(3 * modUiScale).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * modUiScale).add(unit.localizedName).style(Styles.outlineLabel)); - Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))); - label.setFontScale(modUiScale); - tt.add(label).padRight(3 * modUiScale).minWidth(5 * 8f * modUiScale).left(); - }); - if(++i[0] % 5 == 0) unitTable.row(); - } - } - }); - }); - } - - public void rebuild(){ - tables.clear(); - for(Team team : teams) { - tables.add(setTable(team)); - } - } -} diff --git a/src/UnitInfo/ui/windows/UnitDisplay.java b/src/UnitInfo/ui/windows/UnitDisplay.java index 2308f2b..42b0012 100644 --- a/src/UnitInfo/ui/windows/UnitDisplay.java +++ b/src/UnitInfo/ui/windows/UnitDisplay.java @@ -185,7 +185,7 @@ public class UnitDisplay extends WindowTable implements Updatable { float angle = 360; @Override - public void setEvent() { + public void update() { if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))) { if(input.keyTap(KeyCode.f)) { showMoving(); diff --git a/src/UnitInfo/ui/windows/WaveDisplay.java b/src/UnitInfo/ui/windows/WaveDisplay.java index bfe56b0..c4115c6 100644 --- a/src/UnitInfo/ui/windows/WaveDisplay.java +++ b/src/UnitInfo/ui/windows/WaveDisplay.java @@ -25,7 +25,7 @@ import static mindustry.Vars.*; public class WaveDisplay extends WindowTable { - static Vec2 waveScrollPos = new Vec2(0, 0); + static Vec2 scrollPos = new Vec2(0, 0); public WaveDisplay() { super("Wave Display", Icon.waves, t -> {}); @@ -37,7 +37,7 @@ public class WaveDisplay extends WindowTable { topBar(); table(Styles.black8, t -> { - ScrollPane pane = new OverScrollPane(rebuild(), Styles.nonePane, waveScrollPos).disableScroll(true, false); + ScrollPane pane = new OverScrollPane(rebuild(), Styles.nonePane, scrollPos).disableScroll(true, false); t.add(pane); Events.on(EventType.WorldLoadEvent.class, e -> { pane.clearChildren(); diff --git a/src/UnitInfo/ui/windows/WindowTables.java b/src/UnitInfo/ui/windows/WindowTables.java index 0fb507b..e1b3470 100644 --- a/src/UnitInfo/ui/windows/WindowTables.java +++ b/src/UnitInfo/ui/windows/WindowTables.java @@ -2,6 +2,11 @@ package UnitInfo.ui.windows; public class WindowTables { public static WindowTable - unitTable = new UnitDisplay(), + unitTable, waveTable, coreTable; + + public static void init() { + unitTable = new UnitDisplay(); waveTable = new WaveDisplay(); + coreTable = new CoreDisplay(); + } }