Skip to content

Commit

Permalink
changed location of counter to info&help Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Nov 4, 2023
1 parent d5e9b16 commit cbdcf3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,8 @@ private void initializeFieldTemplate(final BiConsumer<UIEntity, UISignalBoxTile>
buildColors(container.grid.getNodes());
}

private UIButton counterButton;

public void updateCounter() {
counterButton.setText(container.grid.getCurrentCounter() + "");
helpPage.updateCounterButton();
}

private void initializeBasicUI() {
Expand Down Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/troblecodings/signals/guis/SidePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlockPos, SubsidiaryHolder> disableSubsidiary;
Expand Down Expand Up @@ -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<BlockPos, SubsidiaryHolder> subsidiaries,
final SignalBoxNode node, final List<SignalBoxNode> allNodes,
final Map<BlockPos, List<SubsidiaryState>> possibleSubsidiaries) {
Expand Down Expand Up @@ -226,6 +233,13 @@ public void helpUsageMode(final Map<BlockPos, SubsidiaryHolder> 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
Expand Down

0 comments on commit cbdcf3a

Please sign in to comment.