diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-10 14:27:59 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-10 14:27:59 +0200 |
commit | 251b365e4846aa89513d78208a7c0f77a5540701 (patch) | |
tree | fb2690eb7690eb6ed66b3ef35ee643ccce8ab536 /src/main | |
parent | 580e8a302ed89ef99403a327d003278ff873b334 (diff) | |
download | NotEnoughUpdates-251b365e4846aa89513d78208a7c0f77a5540701.tar.gz NotEnoughUpdates-251b365e4846aa89513d78208a7c0f77a5540701.tar.bz2 NotEnoughUpdates-251b365e4846aa89513d78208a7c0f77a5540701.zip |
fixed needed minion count read error on profile switch and reworked the design
Diffstat (limited to 'src/main')
3 files changed, 14 insertions, 15 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java index 9a3a4883..952bd07a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java @@ -134,9 +134,10 @@ public class MinionHelperManager { minion.setMeetRequirements(false); } + needForNextSlot = -1; api.onProfileSwitch(); overlay.onProfileSwitch(); - needForNextSlot = -1; + inventoryLoader.onProfileSwitch(); } public void reloadData() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java index fa3cc5de..3ff5a9c8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java @@ -59,7 +59,9 @@ public class MinionHelperInventoryLoader { checkInventory(); } else { pagesSeenAlready.clear(); - shouldCheckNextSlot = true; + if (shouldCheckNextSlot) { + shouldCheckNextSlot = true; + } } } @@ -137,4 +139,8 @@ public class MinionHelperInventoryLoader { manager.getOverlay().resetCache(); } } + + public void onProfileSwitch() { + shouldCheckNextSlot = true; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java index 5f1e7e16..12a8c24d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java @@ -223,8 +223,9 @@ public class MinionHelperOverlay { LinkedHashMap<String, OverviewLine> renderMap ) { int neededForNextSlot = manager.getNeedForNextSlot(); + String color = showOnlyAvailable ? "§e" : "§c"; if (neededForNextSlot == -1) { - renderMap.put("Next slot in: ?", new OverviewText(Collections.emptyList(), () -> {})); + renderMap.put(color + "Next slot in: ?", new OverviewText(Collections.emptyList(), () -> {})); return; } @@ -236,17 +237,8 @@ public class MinionHelperOverlay { if (index == neededForNextSlot) break; } String format = manager.getPriceCalculation().formatCoins(priceNeeded); - String text = "Next slot in: §b" + neededForNextSlot + " §8- " + format; - List<String> list = new ArrayList<>(); - list.add("§7The combined upgrade cost for"); - list.add("§7the next §b" + index + " minions §7is " + format); - - if (!showOnlyAvailable) { - list.add(""); - list.add("§cThis shows minions that don't meet requirements!"); - } - - renderMap.put(text, new OverviewText(list, () -> {})); + String text = color + "Next slot in: §b" + neededForNextSlot + " §8- " + format; + renderMap.put(text, new OverviewText(Collections.emptyList(), () -> {})); } private void addTitle(Map<Minion, Long> prices, LinkedHashMap<String, OverviewLine> renderMap) { @@ -264,7 +256,7 @@ public class MinionHelperOverlay { } } String toggleText = "§eClick to " + (showOnlyAvailable ? "show" : "hide") + " minion upgrades without requirements"; - renderMap.put(name, new OverviewText(Arrays.asList(hoverText, "", toggleText), this::toggleShowAvailable)); + renderMap.put("§e" + name, new OverviewText(Arrays.asList(hoverText, "", toggleText), this::toggleShowAvailable)); } private void addMinions(Map<Minion, Long> prices, LinkedHashMap<String, OverviewLine> renderMap) { |