From b7736a15442cee4c56ee8d0badeaf4201ed69a6d Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Mon, 10 Jun 2024 02:07:12 +0500 Subject: feat: sounds for shop ui --- assets/sfx/shop/not_enough_money.ogg | Bin 0 -> 6823 bytes assets/sfx/shop/purchase.ogg | Bin 0 -> 13749 bytes assets/sfx/shop/sell.ogg | Bin 0 -> 7599 bytes .../kz/ilotterytea/maxon/screens/game/shop/ShopUI.java | 8 +++++++- 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 assets/sfx/shop/not_enough_money.ogg create mode 100644 assets/sfx/shop/purchase.ogg create mode 100644 assets/sfx/shop/sell.ogg diff --git a/assets/sfx/shop/not_enough_money.ogg b/assets/sfx/shop/not_enough_money.ogg new file mode 100644 index 0000000..015062d Binary files /dev/null and b/assets/sfx/shop/not_enough_money.ogg differ diff --git a/assets/sfx/shop/purchase.ogg b/assets/sfx/shop/purchase.ogg new file mode 100644 index 0000000..e28a4cc Binary files /dev/null and b/assets/sfx/shop/purchase.ogg differ diff --git a/assets/sfx/shop/sell.ogg b/assets/sfx/shop/sell.ogg new file mode 100644 index 0000000..fdae919 Binary files /dev/null and b/assets/sfx/shop/sell.ogg differ 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 ed29326..71af190 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java @@ -35,12 +35,15 @@ public class ShopUI { private final ArrayList petWidgets = new ArrayList<>(); - private final Sound clickSound; + private final Sound clickSound, notEnoughMoneySound, purchaseSound, sellSound; public ShopUI(final Savegame savegame, Stage stage, Skin skin, TextureAtlas atlas) { this.savegame = savegame; MaxonGame game = MaxonGame.getInstance(); this.clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound.class); + this.notEnoughMoneySound = game.assetManager.get("sfx/shop/not_enough_money.ogg", Sound.class); + this.purchaseSound = game.assetManager.get("sfx/shop/purchase.ogg", Sound.class); + this.sellSound = game.assetManager.get("sfx/shop/sell.ogg", Sound.class); this.skin = skin; this.atlas = atlas; @@ -244,6 +247,7 @@ public class ShopUI { super.clicked(event, x, y); if (widget.isDisabled()) { + notEnoughMoneySound.play(); return; } @@ -255,6 +259,7 @@ public class ShopUI { savegame.getPurchasedPets().getOrDefault(pet.getId(), 0) + multiplier.getMultiplier() ); + purchaseSound.play(); } else { savegame.increaseMoney(widget.getPrice()); savegame.decreaseMultiplier(pet.getMultiplier() * multiplier.getMultiplier()); @@ -263,6 +268,7 @@ public class ShopUI { savegame.getPurchasedPets().get(pet.getId()) - multiplier.getMultiplier() ); + sellSound.play(); } } }); -- cgit v1.2.3