summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/screens
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-10-29 10:28:45 +0500
committerilotterytea <iltsu@alright.party>2024-10-29 10:28:45 +0500
commit730a41522c3be8cf8d5ac3b72d1d4d64b74018a6 (patch)
tree90acba41af10cc9732ee5686058b3c1e5989b180 /core/src/kz/ilotterytea/maxon/screens
parentb9050a21c0bcb988ac90a1d0082ab03277e490da (diff)
feat: show the amount of purchased pets
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/screens')
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
index 76e5a04..b0b6d77 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
@@ -248,6 +248,9 @@ public class ShopUI {
for (Pet pet : pets) {
PetWidget widget = new PetWidget(this.skin, pet, this.atlas);
+ Integer amount = savegame.getPurchasedPets().get(pet.getId());
+ if (amount == null) amount = 0;
+ widget.setAmount(amount);
widget.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
@@ -258,12 +261,11 @@ public class ShopUI {
return;
}
- if (mode == ShopMode.BUY) {
- Integer amount = savegame.getPurchasedPets().get(pet.getId());
+ Integer amount = savegame.getPurchasedPets().get(pet.getId());
+ if (amount == null) amount = 0;
- if (amount == null) {
- amount = 0;
- }
+ if (mode == ShopMode.BUY) {
+ widget.setAmount(amount + multiplier.getMultiplier());
savegame.decreaseMoney(widget.getPrice());
savegame.increaseMultiplier(pet.getMultiplier() * multiplier.getMultiplier());
@@ -273,6 +275,8 @@ public class ShopUI {
);
purchaseSound.play(soundVolume);
} else {
+ widget.setAmount(amount - multiplier.getMultiplier());
+
savegame.increaseMoney(widget.getPrice());
savegame.decreaseMultiplier(pet.getMultiplier() * multiplier.getMultiplier());
savegame.getPurchasedPets().put(