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_CHALLENGES = "challenges";
|
||||
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_INTRO = "intro";
|
||||
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 void flippedUI( boolean value) {
|
||||
Preferences.INSTANCE.put(Preferences.KEY_FLIPPEDUI, value ); }
|
||||
public static void flipToolbar( boolean 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 ) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_BARMODE, value );
|
||||
|
|
|
@ -240,9 +240,6 @@ public class GameScene extends PixelScene {
|
|||
|
||||
attack = new AttackIndicator();
|
||||
attack.camera = uiCamera;
|
||||
attack.setPos(
|
||||
uiCamera.width - attack.width(),
|
||||
toolbar.top() - attack.height() );
|
||||
add( attack );
|
||||
|
||||
loot = new LootIndicator();
|
||||
|
@ -253,12 +250,11 @@ public class GameScene extends PixelScene {
|
|||
resume.camera = uiCamera;
|
||||
add( resume );
|
||||
|
||||
layoutTags();
|
||||
|
||||
log = new GameLog();
|
||||
log.camera = uiCamera;
|
||||
log.setRect( 0, toolbar.top(), attack.left(), 0 );
|
||||
add( log );
|
||||
|
||||
layoutTags();
|
||||
|
||||
if (Dungeon.depth < Statistics.deepestFloor) {
|
||||
GLog.i(TXT_WELCOME_BACK, Dungeon.depth);
|
||||
|
@ -410,17 +406,33 @@ public class GameScene extends PixelScene {
|
|||
private boolean tagLoot = 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) {
|
||||
loot.setPos( uiCamera.width - loot.width(), pos - loot.height() );
|
||||
pos = loot.top();
|
||||
if (ShatteredPixelDungeon.flipTags()) {
|
||||
scene.log.setRect(scene.attack.width(), scene.toolbar.top(), uiCamera.width - scene.attack.width(), 0);
|
||||
} else {
|
||||
scene.log.setRect(0, scene.toolbar.top(), scene.attack.left(), 0 );
|
||||
}
|
||||
|
||||
if (tagResume) {
|
||||
resume.setPos( uiCamera.width - resume.width(), pos - resume.height() );
|
||||
float pos = scene.toolbar.top();
|
||||
|
||||
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() {
|
||||
lightness = 1f;
|
||||
}
|
||||
|
||||
public void flip(boolean value){
|
||||
bg.flipHorizontal(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
|
|
@ -208,7 +208,7 @@ public class Toolbar extends Component {
|
|||
}
|
||||
right = width;
|
||||
|
||||
if (ShatteredPixelDungeon.flippedUI()) {
|
||||
if (ShatteredPixelDungeon.flipToolbar()) {
|
||||
|
||||
btnWait.setPos( (right - btnWait.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.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
|
||||
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);
|
||||
add(slots);
|
||||
|
||||
CheckBox chkFlip = new CheckBox("Flip Toolbar"){
|
||||
CheckBox chkFlipToolbar = new CheckBox("Flip Toolbar"){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
super.onClick();
|
||||
ShatteredPixelDungeon.flippedUI(checked());
|
||||
ShatteredPixelDungeon.flipToolbar(checked());
|
||||
Toolbar.updateLayout();
|
||||
}
|
||||
};
|
||||
chkFlip.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT);
|
||||
chkFlip.checked(ShatteredPixelDungeon.flippedUI());
|
||||
add(chkFlip);
|
||||
chkFlipToolbar.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT);
|
||||
chkFlipToolbar.checked(ShatteredPixelDungeon.flipToolbar());
|
||||
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