v0.3.1: added functionaltiy to flip indicators in the game UI
This commit is contained in:
parent
432f9ee440
commit
00aab9bd2d
|
@ -39,7 +39,8 @@ enum Preferences {
|
||||||
public static final String KEY_LAST_CLASS = "last_class";
|
public static final String KEY_LAST_CLASS = "last_class";
|
||||||
public static final String KEY_CHALLENGES = "challenges";
|
public static final String KEY_CHALLENGES = "challenges";
|
||||||
public static final String KEY_QUICKSLOTS = "quickslots";
|
public static final String KEY_QUICKSLOTS = "quickslots";
|
||||||
public static final String KEY_FLIPPEDUI = "flipped_ui";
|
public static final String KEY_FLIPTOOLBAR = "flipped_ui";
|
||||||
|
public static final String KEY_FLIPTAGS = "flip_tags";
|
||||||
public static final String KEY_BARMODE = "toolbar_mode";
|
public static final String KEY_BARMODE = "toolbar_mode";
|
||||||
public static final String KEY_INTRO = "intro";
|
public static final String KEY_INTRO = "intro";
|
||||||
public static final String KEY_BRIGHTNESS = "brightness";
|
public static final String KEY_BRIGHTNESS = "brightness";
|
||||||
|
|
|
@ -337,10 +337,17 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
|
|
||||||
public static int quickSlots(){ return Preferences.INSTANCE.getInt( Preferences.KEY_QUICKSLOTS, 4); }
|
public static int quickSlots(){ return Preferences.INSTANCE.getInt( Preferences.KEY_QUICKSLOTS, 4); }
|
||||||
|
|
||||||
public static void flippedUI( boolean value) {
|
public static void flipToolbar( boolean value) {
|
||||||
Preferences.INSTANCE.put(Preferences.KEY_FLIPPEDUI, value ); }
|
Preferences.INSTANCE.put(Preferences.KEY_FLIPTOOLBAR, value );
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean flippedUI(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPPEDUI, false); }
|
public static boolean flipToolbar(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPTOOLBAR, false); }
|
||||||
|
|
||||||
|
public static void flipTags( boolean value) {
|
||||||
|
Preferences.INSTANCE.put(Preferences.KEY_FLIPTAGS, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean flipTags(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPTAGS, false); }
|
||||||
|
|
||||||
public static void toolbarMode( String value ) {
|
public static void toolbarMode( String value ) {
|
||||||
Preferences.INSTANCE.put( Preferences.KEY_BARMODE, value );
|
Preferences.INSTANCE.put( Preferences.KEY_BARMODE, value );
|
||||||
|
|
|
@ -240,9 +240,6 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
attack = new AttackIndicator();
|
attack = new AttackIndicator();
|
||||||
attack.camera = uiCamera;
|
attack.camera = uiCamera;
|
||||||
attack.setPos(
|
|
||||||
uiCamera.width - attack.width(),
|
|
||||||
toolbar.top() - attack.height() );
|
|
||||||
add( attack );
|
add( attack );
|
||||||
|
|
||||||
loot = new LootIndicator();
|
loot = new LootIndicator();
|
||||||
|
@ -253,12 +250,11 @@ public class GameScene extends PixelScene {
|
||||||
resume.camera = uiCamera;
|
resume.camera = uiCamera;
|
||||||
add( resume );
|
add( resume );
|
||||||
|
|
||||||
layoutTags();
|
|
||||||
|
|
||||||
log = new GameLog();
|
log = new GameLog();
|
||||||
log.camera = uiCamera;
|
log.camera = uiCamera;
|
||||||
log.setRect( 0, toolbar.top(), attack.left(), 0 );
|
|
||||||
add( log );
|
add( log );
|
||||||
|
|
||||||
|
layoutTags();
|
||||||
|
|
||||||
if (Dungeon.depth < Statistics.deepestFloor) {
|
if (Dungeon.depth < Statistics.deepestFloor) {
|
||||||
GLog.i(TXT_WELCOME_BACK, Dungeon.depth);
|
GLog.i(TXT_WELCOME_BACK, Dungeon.depth);
|
||||||
|
@ -410,17 +406,33 @@ public class GameScene extends PixelScene {
|
||||||
private boolean tagLoot = false;
|
private boolean tagLoot = false;
|
||||||
private boolean tagResume = false;
|
private boolean tagResume = false;
|
||||||
|
|
||||||
private void layoutTags() {
|
public static void layoutTags() {
|
||||||
|
|
||||||
float pos = tagAttack ? attack.top() : toolbar.top();
|
float tagLeft = ShatteredPixelDungeon.flipTags() ? 0 : uiCamera.width - scene.attack.width();
|
||||||
|
|
||||||
if (tagLoot) {
|
if (ShatteredPixelDungeon.flipTags()) {
|
||||||
loot.setPos( uiCamera.width - loot.width(), pos - loot.height() );
|
scene.log.setRect(scene.attack.width(), scene.toolbar.top(), uiCamera.width - scene.attack.width(), 0);
|
||||||
pos = loot.top();
|
} else {
|
||||||
|
scene.log.setRect(0, scene.toolbar.top(), scene.attack.left(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagResume) {
|
float pos = scene.toolbar.top();
|
||||||
resume.setPos( uiCamera.width - resume.width(), pos - resume.height() );
|
|
||||||
|
if (scene.tagAttack){
|
||||||
|
scene.attack.setPos( tagLeft, pos - scene.attack.height());
|
||||||
|
scene.attack.flip(tagLeft == 0);
|
||||||
|
pos = scene.attack.top();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scene.tagLoot) {
|
||||||
|
scene.loot.setPos( tagLeft, pos - scene.loot.height() );
|
||||||
|
scene.loot.flip(tagLeft == 0);
|
||||||
|
pos = scene.loot.top();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scene.tagResume) {
|
||||||
|
scene.resume.setPos( tagLeft, pos - scene.resume.height() );
|
||||||
|
scene.resume.flip(tagLeft == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,10 @@ public class Tag extends Button {
|
||||||
public void flash() {
|
public void flash() {
|
||||||
lightness = 1f;
|
lightness = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void flip(boolean value){
|
||||||
|
bg.flipHorizontal(value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class Toolbar extends Component {
|
||||||
}
|
}
|
||||||
right = width;
|
right = width;
|
||||||
|
|
||||||
if (ShatteredPixelDungeon.flippedUI()) {
|
if (ShatteredPixelDungeon.flipToolbar()) {
|
||||||
|
|
||||||
btnWait.setPos( (right - btnWait.right()), y);
|
btnWait.setPos( (right - btnWait.right()), y);
|
||||||
btnSearch.setPos( (right - btnSearch.right()), y);
|
btnSearch.setPos( (right - btnSearch.right()), y);
|
||||||
|
|
|
@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.OptionSlider;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.OptionSlider;
|
||||||
|
@ -202,17 +203,29 @@ public class WndSettings extends WndTabbed {
|
||||||
slots.setRect(0, btnGrouped.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
|
slots.setRect(0, btnGrouped.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
|
||||||
add(slots);
|
add(slots);
|
||||||
|
|
||||||
CheckBox chkFlip = new CheckBox("Flip Toolbar"){
|
CheckBox chkFlipToolbar = new CheckBox("Flip Toolbar"){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
ShatteredPixelDungeon.flippedUI(checked());
|
ShatteredPixelDungeon.flipToolbar(checked());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
chkFlip.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT);
|
chkFlipToolbar.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT);
|
||||||
chkFlip.checked(ShatteredPixelDungeon.flippedUI());
|
chkFlipToolbar.checked(ShatteredPixelDungeon.flipToolbar());
|
||||||
add(chkFlip);
|
add(chkFlipToolbar);
|
||||||
|
|
||||||
|
CheckBox chkFlipTags = new CheckBox("Flip Indicators"){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
ShatteredPixelDungeon.flipTags(checked());
|
||||||
|
GameScene.layoutTags();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP_SML, WIDTH, BTN_HEIGHT);
|
||||||
|
chkFlipTags.checked(ShatteredPixelDungeon.flipTags());
|
||||||
|
add(chkFlipTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user