diff options
| -rw-r--r-- | assets/sfx/ui/click.ogg | bin | 0 -> 4274 bytes | |||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/MenuScreen.java | 10 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java | 21 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/ui/SavegameWidget.java | 7 |
4 files changed, 38 insertions, 0 deletions
diff --git a/assets/sfx/ui/click.ogg b/assets/sfx/ui/click.ogg Binary files differnew file mode 100644 index 0000000..7df204e --- /dev/null +++ b/assets/sfx/ui/click.ogg diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java index 6a2b53b..707186f 100644 --- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java @@ -2,6 +2,7 @@ package kz.ilotterytea.maxon.screens; import com.badlogic.gdx.*; import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.graphics.g2d.TextureAtlas; @@ -48,6 +49,7 @@ public class MenuScreen implements Screen { private PerspectiveCamera camera; private final ArrayList<Timer.Task> tasks = new ArrayList<>(); + private Sound clickSound; public MenuScreen() { this.game = MaxonGame.getInstance(); @@ -69,6 +71,8 @@ public class MenuScreen implements Screen { this.menuMusic = game.assetManager.get("mus/menu/mus_menu_loop.mp3", Music.class); menuMusic.setLooping(true); + clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound.class); + // Tint the background Image tintImage = new Image(skin, "tint"); tintImage.setFillParent(true); @@ -138,6 +142,7 @@ public class MenuScreen implements Screen { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); + clickSound.play(); Gdx.app.exit(); } }); @@ -160,6 +165,7 @@ public class MenuScreen implements Screen { public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); Gdx.net.openURI(MaxonConstants.GAME_DEVELOPERS[developerIndex[0]][1]); + clickSound.play(); } }); developerImage.setSize(64, 64); @@ -196,6 +202,7 @@ public class MenuScreen implements Screen { public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); Gdx.net.openURI(dev[1]); + clickSound.play(); } }); } @@ -228,6 +235,7 @@ public class MenuScreen implements Screen { game.setScreen(new SplashScreen()); menuMusic.stop(); + clickSound.play(); } }); @@ -261,6 +269,7 @@ public class MenuScreen implements Screen { game.prefs.flush(); musicButton.setStyle(style); + clickSound.play(); } }); @@ -298,6 +307,7 @@ public class MenuScreen implements Screen { game.prefs.flush(); resolutionButton.setStyle(style); + clickSound.play(); } }); rightGameControlTable.add(resolutionButton); 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 e5feafc..ed29326 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java @@ -1,6 +1,7 @@ package kz.ilotterytea.maxon.screens.game.shop; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; @@ -34,8 +35,12 @@ public class ShopUI { private final ArrayList<PetWidget> petWidgets = new ArrayList<>(); + private final Sound clickSound; + 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.skin = skin; this.atlas = atlas; @@ -155,6 +160,10 @@ public class ShopUI { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); + if (!sellButton.isDisabled()) { + clickSound.play(); + } + mode = ShopMode.SELL; sellButton.setDisabled(true); buyButton.setDisabled(false); @@ -165,6 +174,10 @@ public class ShopUI { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); + if (!buyButton.isDisabled()) { + clickSound.play(); + } + mode = ShopMode.BUY; sellButton.setDisabled(false); buyButton.setDisabled(true); @@ -188,6 +201,10 @@ public class ShopUI { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); + if (!x1Button.isDisabled()) { + clickSound.play(); + } + multiplier = ShopMultiplier.X1; x1Button.setDisabled(true); x10Button.setDisabled(false); @@ -198,6 +215,10 @@ public class ShopUI { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); + if (!x10Button.isDisabled()) { + clickSound.play(); + } + multiplier = ShopMultiplier.X10; x1Button.setDisabled(false); x10Button.setDisabled(true); diff --git a/core/src/kz/ilotterytea/maxon/ui/SavegameWidget.java b/core/src/kz/ilotterytea/maxon/ui/SavegameWidget.java index 3a5667f..2b3936e 100644 --- a/core/src/kz/ilotterytea/maxon/ui/SavegameWidget.java +++ b/core/src/kz/ilotterytea/maxon/ui/SavegameWidget.java @@ -1,6 +1,7 @@ package kz.ilotterytea.maxon.ui; import com.badlogic.gdx.Screen; +import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.Action; import com.badlogic.gdx.scenes.scene2d.InputEvent; @@ -25,11 +26,14 @@ public class SavegameWidget extends Table implements Disposable { private final MaxonGame game; private final Stage stage; + private final Sound clickSound; + public SavegameWidget(final MaxonGame game, Skin skin, final Stage stage, Savegame savegame) { super(); this.game = game; this.stage = stage; this.atlas = game.assetManager.get("sprites/gui/player_icons.atlas", TextureAtlas.class); + this.clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound.class); this.skin = skin; this.savegame = savegame; @@ -65,6 +69,7 @@ public class SavegameWidget extends Table implements Disposable { public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); moveToNextScreen(); + clickSound.play(); } }); } @@ -127,6 +132,7 @@ public class SavegameWidget extends Table implements Disposable { public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); moveToNextScreen(); + clickSound.play(); } }); @@ -141,6 +147,7 @@ public class SavegameWidget extends Table implements Disposable { dataTable.clear(); savegame.delete(); createEmpty(); + clickSound.play(); } }); |
