From cbdcf3acb0a7c3296712fec1dc20074ec0624631 Mon Sep 17 00:00:00 2001 From: Cedric Date: Sat, 4 Nov 2023 13:45:59 +0100 Subject: [PATCH] changed location of counter to info&help Page --- .../troblecodings/signals/guis/GuiSignalBox.java | 8 +------- .../com/troblecodings/signals/guis/SidePanel.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java b/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java index 3593d1e40..17f8451b1 100644 --- a/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java +++ b/src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java @@ -886,10 +886,8 @@ private void initializeFieldTemplate(final BiConsumer buildColors(container.grid.getNodes()); } - private UIButton counterButton; - public void updateCounter() { - counterButton.setText(container.grid.getCurrentCounter() + ""); + helpPage.updateCounterButton(); } private void initializeBasicUI() { @@ -917,10 +915,6 @@ private void initializeBasicUI() { mainButton = GuiElements.createButton(I18Wrapper.format("btn.main"), this::initializeFieldUsage); header.add(mainButton); - final UIEntity counter = GuiElements.createButton(container.grid.getCurrentCounter() + ""); - counter.findRecursive(UIButton.class).forEach(b -> counterButton = b); - counter.add(new UIToolTip(I18Wrapper.format("btn.counter.tooltip"))); - header.add(counter); resetSelection(mainButton); final UIEntity middlePart = new UIEntity(); diff --git a/src/main/java/com/troblecodings/signals/guis/SidePanel.java b/src/main/java/com/troblecodings/signals/guis/SidePanel.java index 6b48227f7..f323162d1 100644 --- a/src/main/java/com/troblecodings/signals/guis/SidePanel.java +++ b/src/main/java/com/troblecodings/signals/guis/SidePanel.java @@ -72,6 +72,7 @@ public class SidePanel { private final UIEntity label = new UIEntity(); private final UIEntity spacerEntity = new UIEntity(); private final UIEntity helpPageSpacer = new UIEntity(); + private UIEntity counterButton = new UIEntity(); private final GuiSignalBox gui; private BiConsumer disableSubsidiary; @@ -196,6 +197,12 @@ public void updateNextNode(final int selection, final int rotation) { addHelpPageToPlane(); } + protected void updateCounterButton() { + counterButton.findRecursive(UIButton.class) + .forEach(button -> button.setText(gui.container.grid.getCurrentCounter() + "")); + lowerEntity.update(); + } + public void helpUsageMode(final Map subsidiaries, final SignalBoxNode node, final List allNodes, final Map> possibleSubsidiaries) { @@ -226,6 +233,13 @@ public void helpUsageMode(final Map subsidiaries, helpList.add(GuiElements.createLabel("[RMB] = " + I18Wrapper.format("info.usage.key.rmb"), new UIEntity().getInfoTextColor(), 0.5f)); + counterButton = GuiElements.createButton(gui.container.grid.getCurrentCounter() + ""); + counterButton.setScaleX(0.8f); + counterButton.setScaleY(0.8f); + counterButton.setX(5); + counterButton.add(new UIToolTip(I18Wrapper.format("btn.counter.tooltip"))); + helpList.add(counterButton); + final Minecraft mc = Minecraft.getInstance(); if (!allNodes.isEmpty()) { final UIEntity manuelButton = GuiElements