summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/screens
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-11-10 21:02:17 +0500
committerilotterytea <iltsu@alright.party>2024-11-10 21:02:17 +0500
commit34f3b60afdc7d6934cf45d990bead9d90f1380f9 (patch)
tree347e5ae8c2eee910a84a6368e82f1082312e020e /core/src/kz/ilotterytea/maxon/screens
parent9534ea1bdfe588c653be91f139bfc7457a108801 (diff)
upd: name for music and sfx in settings
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/screens')
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/MenuScreen.java14
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.java4
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java3
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java5
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/shop/ShopMerchant.java3
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java3
6 files changed, 18 insertions, 14 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
index 054ca4e..43dfbca 100644
--- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
@@ -74,7 +74,7 @@ public class MenuScreen implements Screen {
menuMusic.setLooping(true);
clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound.class);
- soundVolume = game.prefs.getInteger("sfx", 10) / 10f;
+ soundVolume = game.prefs.getInteger(SettingsConstants.SFX_NAME, 10) / 10f;
// - - - - - - U I - - - - - -
float iconSize = (OsUtils.isMobile ? 256f : 64f) * game.prefs.getFloat("guiScale", SettingsConstants.UI_DEFAULT_SCALE);
@@ -230,10 +230,10 @@ public class MenuScreen implements Screen {
});
// Music button
- menuMusic.setVolume(game.prefs.getInteger("music", 10) / 10f);
+ menuMusic.setVolume(game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) / 10f);
String musicButtonStyleName;
- if (OsUtils.isPC || game.prefs.getInteger("music", 10) > 0) {
+ if (OsUtils.isPC || game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) > 0) {
musicButtonStyleName = "music_on";
menuMusic.play();
} else {
@@ -253,7 +253,7 @@ public class MenuScreen implements Screen {
}
String style;
- int v = game.prefs.getInteger("music", 10);
+ int v = game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10);
if (v > 0) {
style = "music_off";
@@ -263,7 +263,7 @@ public class MenuScreen implements Screen {
menuMusic.play();
}
- game.prefs.putInteger("music", game.prefs.getInteger("music", 10) > 0 ? 0 : 10);
+ game.prefs.putInteger(SettingsConstants.MUSIC_NAME, game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) > 0 ? 0 : 10);
game.prefs.flush();
musicButton.setDrawable(widgetSkin, style);
@@ -516,7 +516,7 @@ public class MenuScreen implements Screen {
public void changed(ChangeEvent event, Actor actor) {
if (actor instanceof Slider s) {
int v = (int) s.getValue();
- game.prefs.putInteger(sliderName, v);
+ game.prefs.putInteger(sliderName + "Volume", v);
game.prefs.flush();
switch (sliderName) {
@@ -535,7 +535,7 @@ public class MenuScreen implements Screen {
}
});
- int value = game.prefs.getInteger(sliderName, 10);
+ int value = game.prefs.getInteger(sliderName + "Volume", 10);
if (value > 10) value = 10;
else if (value < 0) value = 0;
diff --git a/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.java b/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.java
index ce564e5..0ea6c5d 100644
--- a/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/SlotsMinigameScreen.java
@@ -242,8 +242,8 @@ public class SlotsMinigameScreen implements Screen {
audioLoop = game.assetManager.get("mus/minigames/slots/slots_loop.mp3");
audioLoop.setLooping(true);
- audioLoop.setVolume(game.prefs.getInteger("music", 10) / 10f);
- soundVolume = game.prefs.getInteger("sfx", 10) / 10f;
+ audioLoop.setVolume(game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) / 10f);
+ soundVolume = game.prefs.getInteger(SettingsConstants.SFX_NAME, 10) / 10f;
Timer.schedule(multiplierTask, 0.1f, 0.1f);
diff --git a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java
index bdc2f8d..3bea785 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java
@@ -19,6 +19,7 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
import kz.ilotterytea.maxon.MaxonGame;
import kz.ilotterytea.maxon.anim.SpriteUtils;
import kz.ilotterytea.maxon.audio.Playlist;
+import kz.ilotterytea.maxon.constants.SettingsConstants;
import kz.ilotterytea.maxon.inputprocessors.CrossProcessor;
import kz.ilotterytea.maxon.pets.Pet;
import kz.ilotterytea.maxon.pets.PetManager;
@@ -91,7 +92,7 @@ public class GameScreen implements Screen, InputProcessor {
game.assetManager.get("mus/game/shopping_spree.mp3", Music.class)
);
playlist.setShuffleMode(true);
- playlist.setVolume(game.prefs.getInteger("music", 10) / 10f);
+ playlist.setVolume(game.prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) / 10f);
playlist.next();
createStageUI();
diff --git a/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java b/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java
index d79bfb1..d676709 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/Giftbox.java
@@ -24,6 +24,7 @@ import kz.ilotterytea.javaextra.tuples.Triple;
import kz.ilotterytea.maxon.MaxonGame;
import kz.ilotterytea.javaextra.comparators.MapValueKeyComparator;
import kz.ilotterytea.maxon.anim.SpriteUtils;
+import kz.ilotterytea.maxon.constants.SettingsConstants;
import kz.ilotterytea.maxon.localization.LineId;
import kz.ilotterytea.maxon.pets.Pet;
import kz.ilotterytea.maxon.pets.PetManager;
@@ -96,12 +97,12 @@ public class Giftbox implements Disposable {
this.openedSound = assetManager.get("sfx/giftbox/giftbox_click.ogg");
}
- this.soundVolume = MaxonGame.getInstance().prefs.getInteger("sfx", 10) / 10f;
+ this.soundVolume = MaxonGame.getInstance().prefs.getInteger(SettingsConstants.SFX_NAME, 10) / 10f;
this.openedMusic = assetManager.get("mus/giftbox/giftbox_opened.mp3");
openedMusic.setLooping(true);
- float musicVolume = MaxonGame.getInstance().prefs.getInteger("music", 10) / 10f;
+ float musicVolume = MaxonGame.getInstance().prefs.getInteger(SettingsConstants.MUSIC_NAME, 10) / 10f;
openedMusic.setVolume(musicVolume);
this.boxPosition = new Vector3(3.3f, 0f, 0.4f);
diff --git a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopMerchant.java b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopMerchant.java
index 85c2bbe..294514c 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopMerchant.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopMerchant.java
@@ -11,6 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import kz.ilotterytea.maxon.MaxonGame;
import kz.ilotterytea.maxon.anim.SpriteUtils;
+import kz.ilotterytea.maxon.constants.SettingsConstants;
import kz.ilotterytea.maxon.ui.AnimatedImage;
import kz.ilotterytea.maxon.utils.OsUtils;
@@ -51,7 +52,7 @@ public class ShopMerchant extends Stack {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
- sound.play(game.prefs.getInteger("sfx", 10) / 10f);
+ sound.play(game.prefs.getInteger(SettingsConstants.SFX_NAME, 10) / 10f);
}
});
}
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 8189eb7..8d4291d 100644
--- a/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
+++ b/core/src/kz/ilotterytea/maxon/screens/game/shop/ShopUI.java
@@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import kz.ilotterytea.maxon.MaxonGame;
+import kz.ilotterytea.maxon.constants.SettingsConstants;
import kz.ilotterytea.maxon.localization.LineId;
import kz.ilotterytea.maxon.pets.Pet;
import kz.ilotterytea.maxon.pets.PetWidget;
@@ -51,7 +52,7 @@ public class ShopUI {
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.soundVolume = game.prefs.getInteger("sfx", 10) / 10f;
+ this.soundVolume = game.prefs.getInteger(SettingsConstants.SFX_NAME, 10) / 10f;
this.stageWidth = stage.getWidth();