From 81a588e386317816474e3ce81ebb9e29d851bc30 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 21 Jan 2015 14:02:01 -0500 Subject: [PATCH] v0.2.3e: added setting in options menu for double quickslot --- .../shatteredpixeldungeon/Preferences.java | 1 + .../ShatteredPixelDungeon.java | 4 ++++ .../windows/WndSettings.java | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java index 3139d5fd4..8b1b799bd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java @@ -33,6 +33,7 @@ enum Preferences { public static final String KEY_ZOOM = "zoom"; public static final String KEY_LAST_CLASS = "last_class"; public static final String KEY_CHALLENGES = "challenges"; + public static final String KEY_QUICKSLOTS = "quickslots"; public static final String KEY_INTRO = "intro"; public static final String KEY_BRIGHTNESS = "brightness"; public static final String KEY_VERSION = "version"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 1ade20fce..16e6affbe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -217,6 +217,10 @@ public class ShatteredPixelDungeon extends Game { public static int challenges() { return Preferences.INSTANCE.getInt( Preferences.KEY_CHALLENGES, 0 ); } + + public static void quickSlots( int value ){ Preferences.INSTANCE.put( Preferences.KEY_QUICKSLOTS, value ); } + + public static int quickSlots(){ return Preferences.INSTANCE.getInt( Preferences.KEY_QUICKSLOTS, 1); } public static void intro( boolean value ) { Preferences.INSTANCE.put( Preferences.KEY_INTRO, value ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index d759250a7..319546c15 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -40,6 +40,8 @@ public class WndSettings extends Window { private static final String TXT_SOUND = "Sound FX"; private static final String TXT_BRIGHTNESS = "Brightness"; + + private static final String TXT_QUICKSLOT = "Second QuickSlot"; private static final String TXT_SWITCH_PORT = "Switch to portrait"; private static final String TXT_SWITCH_LAND = "Switch to landscape"; @@ -160,8 +162,19 @@ public class WndSettings extends Window { btnBrightness.setRect( 0, btnSound.bottom() + GAP, WIDTH, BTN_HEIGHT ); btnBrightness.checked( ShatteredPixelDungeon.brightness() ); add( btnBrightness ); + + CheckBox btnQuickSlot = new CheckBox( TXT_QUICKSLOT ) { + @Override + protected void onClick() { + super.onClick(); + ShatteredPixelDungeon.quickSlots(checked() ? 2 : 1); + } + }; + btnQuickSlot.setRect( 0, btnBrightness.bottom() + GAP, WIDTH, BTN_HEIGHT ); + btnQuickSlot.checked( ShatteredPixelDungeon.quickSlots() == 1 ); + add( btnQuickSlot ); - resize( WIDTH, (int)btnBrightness.bottom() ); + resize( WIDTH, (int)btnQuickSlot.bottom() ); } }