summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/menu
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-22 06:48:26 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-22 06:48:26 +0100
commit8d9542b6f3a81119dbd076abc8484b6bd3b8c14d (patch)
tree3c82433de79a7a956f7005c98cf5dcb6013b739a /core/src/ch/asynk/rustanddust/menu
parent7da8beb96a470d919ccf4eee1311ac1958234689 (diff)
downloadRustAndDust-8d9542b6f3a81119dbd076abc8484b6bd3b8c14d.zip
RustAndDust-8d9542b6f3a81119dbd076abc8484b6bd3b8c14d.tar.gz
use type and enter sounds
Diffstat (limited to 'core/src/ch/asynk/rustanddust/menu')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MainMenu.java6
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MenuCtrl.java2
-rw-r--r--core/src/ch/asynk/rustanddust/menu/OptionsMenu.java8
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java6
-rw-r--r--core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java7
5 files changed, 25 insertions, 4 deletions
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;
}