diff options
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
8 files changed, 41 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java index 89b6349..e59cae2 100644 --- a/core/src/ch/asynk/rustanddust/game/Hud.java +++ b/core/src/ch/asynk/rustanddust/game/Hud.java @@ -67,7 +67,7 @@ public class Hud implements Disposable, Animation actionButtons = new ActionButtons(game); actionButtons.hide(); msg = new Msg(game.font, game.bgPatch, 20f); - okCancel = new OkCancel(game.font, game.bgPatch, game.factory.getHudRegion(game.factory.ACT_DONE), game.factory.getHudRegion(game.factory.ACT_ABORT)); + okCancel = new OkCancel(game.font, game.bgPatch, game.factory.getHudRegion(game.factory.ACT_DONE), game.factory.getHudRegion(game.factory.ACT_ABORT), game.typeSnd); optionsBtn = new Bg(game.factory.getHudRegion(game.factory.ACT_OPTIONS)); optionsPanel = new OptionsPanel(game); stats = new StatisticsPanel(game); @@ -185,6 +185,7 @@ public class Hud implements Disposable, Animation public boolean hit(float x, float y, boolean isInAnimation) { if (optionsBtn.hit(x, y)) { + game.typeSnd.play(); toggleOptionsPanel(); return true; } diff --git a/core/src/ch/asynk/rustanddust/game/hud/OptionsPanel.java b/core/src/ch/asynk/rustanddust/game/hud/OptionsPanel.java index bb7f231..ea175c9 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/OptionsPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/OptionsPanel.java @@ -139,6 +139,7 @@ public class OptionsPanel extends Patch public boolean hit(float x, float y) { if (objectivesPanel.hit(x, y)) { + game.typeSnd.play(); objectivesPanel.visible = false; this.visible = true; return false; @@ -147,18 +148,23 @@ public class OptionsPanel extends Patch if (!visible) return false; if (fxVolume.hit(x, y) || fxVolumeValue.hit(x, y)) { + game.typeSnd.play(); cycleFxVolume(); } else if (quit.hit(x, y)) { + game.typeSnd.play(); game.ctrl.hud.askQuitBattle(); return false; } else if (objectives.hit(x, y)) { + game.typeSnd.play(); this.visible = false; objectivesPanel.show(game.config.battle); return false; } else { for (int i = 0; i < checkLabels.length; i++) { - if (checkLabels[i].hit(x, y)) + if (checkLabels[i].hit(x, y)) { + game.typeSnd.play(); checkValues[i] =! checkValues[i]; + } } } diff --git a/core/src/ch/asynk/rustanddust/menu/MainMenu.java b/core/src/ch/asynk/rustanddust/menu/MainMenu.java index 6023ce8..7908c62 100644 --- a/core/src/ch/asynk/rustanddust/menu/MainMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/MainMenu.java @@ -42,10 +42,12 @@ public class MainMenu extends Patch implements MenuCtrl.Panel }; protected Label []labels; + private final RustAndDust game; public MainMenu(RustAndDust game) { super(game.bgPatch); + this.game = game; this.labels = new Label[Item.NONE.i]; for (int i = 0; i < Item.NONE.i; i++) labels[i] = new Label(game.font, 10); @@ -96,8 +98,10 @@ public class MainMenu extends Patch implements MenuCtrl.Panel { int idx = -1; for (int i = 0; i< Item.NONE.i; i ++) { - if (labels[i].hit(x, y)) + if (labels[i].hit(x, y)) { + game.typeSnd.play(); return Item.get(i).t; + } } return MenuCtrl.MenuType.NONE; diff --git a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java index 960ada3..d84660b 100644 --- a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java +++ b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java @@ -47,7 +47,7 @@ public class MenuCtrl implements Disposable, Drawable this.panels[MenuType.OPTIONS.i] = new OptionsMenu(game); this.panels[MenuType.TUTORIALS.i] = new TutorialsMenu(game); this.panels[MenuType.PLAY.i] = new PlayMenu(game); - this.okCancel = new OkCancel(game.font, game.bgPatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL)); + this.okCancel = new OkCancel(game.font, game.bgPatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL), game.typeSnd); this.current = MenuType.MAIN; diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java index 146d38b..c99295e 100644 --- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java @@ -161,19 +161,25 @@ public class OptionsMenu extends Patch implements MenuCtrl.Panel public MenuCtrl.MenuType touch(float x, float y) { if (okBtn.hit(x, y)) { + game.enterSnd.play(); apply(); return MenuCtrl.MenuType.MAIN; } else if (cancelBtn.hit(x, y)) { + game.typeSnd.play(); getValues(); return MenuCtrl.MenuType.MAIN; } else if (fxVolume.hit(x, y) || fxVolumeValue.hit(x, y)) { + game.typeSnd.play(); cycleFxVolume(); } else if (graphics.hit(x, y) || graphicsValue.hit(x, y)) { + game.typeSnd.play(); cycleGraphics(); } else { for (int i = 0; i < checkLabels.length; i++) { - if (checkLabels[i].hit(x, y)) + if (checkLabels[i].hit(x, y)) { + game.typeSnd.play(); checkValues[i] =! checkValues[i]; + } } } diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java index 1bac295..83e01d7 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -118,6 +118,7 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel public MenuCtrl.MenuType touch(float x, float y) { if (objectivesPanel.hit(x, y)) { + game.typeSnd.play(); this.visible = true; objectivesPanel.visible = false; return MenuCtrl.MenuType.NONE; @@ -126,14 +127,19 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel if (!visible) return MenuCtrl.MenuType.NONE; if (okBtn.hit(x, y)) { + game.enterSnd.play(); return apply(); } else if (cancelBtn.hit(x, y)) { + game.typeSnd.play(); return MenuCtrl.MenuType.MAIN; } else if (gameMode.hit(x, y) || gameModeValue.hit(x, y)) { + game.typeSnd.play(); cycleGameMode(); } else if (battle.hit(x, y) || battleValue.hit(x, y)) { + game.typeSnd.play(); cycleBattle(); } else if (objectives.hit(x, y)) { + game.typeSnd.play(); this.visible = false; objectivesPanel.show(game.config.battle); } diff --git a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java index 3224e29..202cea7 100644 --- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java @@ -12,6 +12,8 @@ public class TutorialsMenu extends Patch implements MenuCtrl.Panel public static int PADDING = 40; public static int TITLE_PADDING = 30; + private final RustAndDust game; + private Label title; private Label msg; protected Bg okBtn; @@ -19,6 +21,7 @@ public class TutorialsMenu extends Patch implements MenuCtrl.Panel public TutorialsMenu(RustAndDust game) { super(game.bgPatch); + this.game = game; this.okBtn = new Bg(game.getUiRegion(game.UI_OK)); this.title = new Label("- Tutorials", game.font); this.msg = new Label("Not implemented yet.\nPlease Visit:\nhttp://rustanddust.ch", game.font); @@ -62,8 +65,10 @@ public class TutorialsMenu extends Patch implements MenuCtrl.Panel @Override public MenuCtrl.MenuType touch(float x, float y) { - if (rect.contains(x, y) || okBtn.hit(x, y)) + if (rect.contains(x, y) || okBtn.hit(x, y)) { + game.enterSnd.play(); return MenuCtrl.MenuType.MAIN; + } return MenuCtrl.MenuType.NONE; } diff --git a/core/src/ch/asynk/rustanddust/ui/OkCancel.java b/core/src/ch/asynk/rustanddust/ui/OkCancel.java index 5036995..8bbceef 100644 --- a/core/src/ch/asynk/rustanddust/ui/OkCancel.java +++ b/core/src/ch/asynk/rustanddust/ui/OkCancel.java @@ -1,5 +1,6 @@ package ch.asynk.rustanddust.ui; +import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.graphics.g2d.BitmapFont; @@ -16,13 +17,15 @@ public class OkCancel extends Patch protected Label label; protected Bg okBtn; protected Bg cancelBtn; + protected Sound snd; - public OkCancel(BitmapFont font, NinePatch patch, AtlasRegion okRegion, AtlasRegion cancelRegion) + public OkCancel(BitmapFont font, NinePatch patch, AtlasRegion okRegion, AtlasRegion cancelRegion, Sound snd) { super(patch); this.label = new Label(font); this.okBtn = new Bg(okRegion); this.cancelBtn = new Bg(cancelRegion); + this.snd = snd; this.visible = false; } @@ -72,13 +75,16 @@ public class OkCancel extends Patch public boolean hit(float x, float y) { if (!cancelBtn.visible && super.hit(x, y)) { + snd.play(); ok = true; return true; } if (okBtn.hit(x, y)) { + snd.play(); ok = true; return true; } else if (cancelBtn.hit(x, y)) { + snd.play(); ok = false; return true; } |