v0.8.0: added all other key actions from old desktop build, no remapping yet
This commit is contained in:
parent
1539d57f71
commit
0696bf1f36
|
@ -21,11 +21,32 @@
|
||||||
|
|
||||||
package com.watabou.input;
|
package com.watabou.input;
|
||||||
|
|
||||||
|
//FIXME this is describing actions defined in the core module, it should probably be moved there.
|
||||||
public enum KeyAction {
|
public enum KeyAction {
|
||||||
BACK,
|
BACK,
|
||||||
MENU,
|
MENU,
|
||||||
|
|
||||||
N, NE, E, SE, S, SW, W, NW,
|
HERO_INFO,
|
||||||
|
JOURNAL,
|
||||||
|
|
||||||
UNKNOWN
|
WAIT,
|
||||||
|
SEARCH,
|
||||||
|
|
||||||
|
INVENTORY,
|
||||||
|
QUICKSLOT_1,
|
||||||
|
QUICKSLOT_2,
|
||||||
|
QUICKSLOT_3,
|
||||||
|
QUICKSLOT_4,
|
||||||
|
|
||||||
|
TAG_ATTACK,
|
||||||
|
TAG_DANGER,
|
||||||
|
TAG_ACTION,
|
||||||
|
TAG_LOOT,
|
||||||
|
TAG_RESUME,
|
||||||
|
|
||||||
|
ZOOM_IN,
|
||||||
|
ZOOM_OUT,
|
||||||
|
ZOOM_DEFAULT,
|
||||||
|
|
||||||
|
N, NE, E, SE, S, SW, W, NW
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,37 @@ public class KeyBindings {
|
||||||
static {
|
static {
|
||||||
bindings = new HashMap<>();
|
bindings = new HashMap<>();
|
||||||
|
|
||||||
bindings.put( Input.Keys.BACK, KeyAction.BACK );
|
bindings.put( Input.Keys.BACK, KeyAction.BACK );
|
||||||
bindings.put( Input.Keys.MENU, KeyAction.MENU );
|
bindings.put( Input.Keys.MENU, KeyAction.MENU );
|
||||||
|
|
||||||
|
bindings.put( Input.Keys.H, KeyAction.HERO_INFO );
|
||||||
|
bindings.put( Input.Keys.J, KeyAction.JOURNAL );
|
||||||
|
|
||||||
|
bindings.put( Input.Keys.NUMPAD_5, KeyAction.WAIT );
|
||||||
|
bindings.put( Input.Keys.SPACE, KeyAction.WAIT );
|
||||||
|
bindings.put( Input.Keys.S, KeyAction.SEARCH );
|
||||||
|
|
||||||
|
bindings.put( Input.Keys.I, KeyAction.INVENTORY );
|
||||||
|
bindings.put( Input.Keys.Q, KeyAction.QUICKSLOT_1 );
|
||||||
|
bindings.put( Input.Keys.W, KeyAction.QUICKSLOT_2 );
|
||||||
|
bindings.put( Input.Keys.E, KeyAction.QUICKSLOT_3 );
|
||||||
|
bindings.put( Input.Keys.R, KeyAction.QUICKSLOT_4 );
|
||||||
|
|
||||||
|
bindings.put( Input.Keys.A, KeyAction.TAG_ATTACK );
|
||||||
|
bindings.put( Input.Keys.TAB, KeyAction.TAG_DANGER );
|
||||||
|
bindings.put( Input.Keys.D, KeyAction.TAG_ACTION );
|
||||||
|
bindings.put( Input.Keys.ENTER, KeyAction.TAG_LOOT );
|
||||||
|
bindings.put( Input.Keys.T, KeyAction.TAG_RESUME );
|
||||||
|
|
||||||
|
bindings.put( Input.Keys.PLUS, KeyAction.ZOOM_IN );
|
||||||
|
bindings.put( Input.Keys.EQUALS, KeyAction.ZOOM_IN );
|
||||||
|
bindings.put( Input.Keys.MINUS, KeyAction.ZOOM_OUT );
|
||||||
|
bindings.put( Input.Keys.SLASH, KeyAction.ZOOM_DEFAULT );
|
||||||
|
|
||||||
bindings.put( Input.Keys.UP, KeyAction.N );
|
bindings.put( Input.Keys.UP, KeyAction.N );
|
||||||
bindings.put( Input.Keys.RIGHT, KeyAction.E );
|
bindings.put( Input.Keys.RIGHT, KeyAction.E );
|
||||||
bindings.put( Input.Keys.DOWN, KeyAction.S );
|
bindings.put( Input.Keys.DOWN, KeyAction.S );
|
||||||
bindings.put( Input.Keys.LEFT, KeyAction.W );
|
bindings.put( Input.Keys.LEFT, KeyAction.W );
|
||||||
|
|
||||||
bindings.put( Input.Keys.NUMPAD_8, KeyAction.N );
|
bindings.put( Input.Keys.NUMPAD_8, KeyAction.N );
|
||||||
bindings.put( Input.Keys.NUMPAD_9, KeyAction.NE );
|
bindings.put( Input.Keys.NUMPAD_9, KeyAction.NE );
|
||||||
bindings.put( Input.Keys.NUMPAD_6, KeyAction.E );
|
bindings.put( Input.Keys.NUMPAD_6, KeyAction.E );
|
||||||
|
|
|
@ -21,9 +21,13 @@
|
||||||
|
|
||||||
package com.watabou.noosa.ui;
|
package com.watabou.noosa.ui;
|
||||||
|
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
|
import com.watabou.input.KeyBindings;
|
||||||
|
import com.watabou.input.KeyEvent;
|
||||||
import com.watabou.input.PointerEvent;
|
import com.watabou.input.PointerEvent;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.PointerArea;
|
import com.watabou.noosa.PointerArea;
|
||||||
|
import com.watabou.utils.Signal;
|
||||||
|
|
||||||
public class Button extends Component {
|
public class Button extends Component {
|
||||||
|
|
||||||
|
@ -33,7 +37,6 @@ public class Button extends Component {
|
||||||
|
|
||||||
protected boolean pressed;
|
protected boolean pressed;
|
||||||
protected float pressTime;
|
protected float pressTime;
|
||||||
|
|
||||||
protected boolean processed;
|
protected boolean processed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +62,24 @@ public class Button extends Component {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
add( hotArea );
|
add( hotArea );
|
||||||
|
|
||||||
|
KeyEvent.addKeyListener( keyListener = new Signal.Listener<KeyEvent>() {
|
||||||
|
@Override
|
||||||
|
public boolean onSignal ( KeyEvent event ) {
|
||||||
|
if ( active && !event.pressed && KeyBindings.getBinding( event ) != null
|
||||||
|
&& KeyBindings.getBinding( event ) == keyAction()){
|
||||||
|
onClick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Signal.Listener<KeyEvent> keyListener;
|
||||||
|
|
||||||
|
public KeyAction keyAction(){
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,4 +117,11 @@ public class Button extends Component {
|
||||||
hotArea.width = width;
|
hotArea.width = width;
|
||||||
hotArea.height = height;
|
hotArea.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void destroy () {
|
||||||
|
super.destroy();
|
||||||
|
KeyEvent.removeKeyListener( keyListener );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
|
@ -30,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.input.KeyBindings;
|
import com.watabou.input.KeyBindings;
|
||||||
import com.watabou.input.KeyEvent;
|
import com.watabou.input.KeyEvent;
|
||||||
import com.watabou.input.PointerEvent;
|
import com.watabou.input.PointerEvent;
|
||||||
|
@ -55,7 +55,7 @@ public class CellSelector extends ScrollArea {
|
||||||
dragThreshold = PixelScene.defaultZoom * DungeonTilemap.SIZE / 2;
|
dragThreshold = PixelScene.defaultZoom * DungeonTilemap.SIZE / 2;
|
||||||
|
|
||||||
mouseZoom = camera.zoom;
|
mouseZoom = camera.zoom;
|
||||||
KeyEvent.addKeyListener(movementListener);
|
KeyEvent.addKeyListener( keyListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
private float mouseZoom;
|
private float mouseZoom;
|
||||||
|
@ -208,19 +208,33 @@ public class CellSelector extends ScrollArea {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyEvent heldKey = null;
|
private KeyAction heldAction = null;
|
||||||
private int heldKeyTurns = 0;
|
private int heldTurns = 0;
|
||||||
|
|
||||||
private Signal.Listener<KeyEvent> movementListener = new Signal.Listener<KeyEvent>() {
|
private Signal.Listener<KeyEvent> keyListener = new Signal.Listener<KeyEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onSignal(KeyEvent event) {
|
public boolean onSignal(KeyEvent event) {
|
||||||
|
KeyAction action = KeyBindings.getBinding( event );
|
||||||
if (!event.pressed){
|
if (!event.pressed){
|
||||||
if (heldKey != null && heldKey.code == event.code) {
|
|
||||||
|
if (heldAction != null && heldAction == action) {
|
||||||
resetKeyHold();
|
resetKeyHold();
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
switch (action){
|
||||||
|
case ZOOM_IN:
|
||||||
|
zoom( camera.zoom+1 );
|
||||||
|
return true;
|
||||||
|
case ZOOM_OUT:
|
||||||
|
zoom( camera.zoom-1 );
|
||||||
|
return true;
|
||||||
|
case ZOOM_DEFAULT:
|
||||||
|
zoom( PixelScene.defaultZoom );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (moveFromKey(event)) {
|
} else if (moveFromKey(action)) {
|
||||||
heldKey = event;
|
heldAction = action;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +242,11 @@ public class CellSelector extends ScrollArea {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean moveFromKey(KeyEvent event){
|
private boolean moveFromKey(KeyAction event){
|
||||||
boolean moved = true;
|
boolean moved = true;
|
||||||
int cell = Dungeon.hero.pos;
|
int cell = Dungeon.hero.pos;
|
||||||
//TODO implement game actions, instead of using keys directly
|
//TODO implement game actions, instead of using keys directly
|
||||||
switch (KeyBindings.getBinding( event )){
|
switch (event){
|
||||||
case N:
|
case N:
|
||||||
cell += -Dungeon.level.width();
|
cell += -Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
|
@ -265,7 +279,7 @@ public class CellSelector extends ScrollArea {
|
||||||
//each step when keyboard moving takes 0.15s, 0.125s, 0.1s, 0.1s, ...
|
//each step when keyboard moving takes 0.15s, 0.125s, 0.1s, 0.1s, ...
|
||||||
// this is to make it easier to move 1 or 2 steps without overshooting
|
// this is to make it easier to move 1 or 2 steps without overshooting
|
||||||
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL +
|
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL +
|
||||||
Math.max(0, 0.05f - heldKeyTurns*0.025f));
|
Math.max(0, 0.05f - heldTurns *0.025f));
|
||||||
select(cell);
|
select(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,16 +287,16 @@ public class CellSelector extends ScrollArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processKeyHold(){
|
public void processKeyHold(){
|
||||||
if (heldKey != null){
|
if (heldAction != null){
|
||||||
enabled = true;
|
enabled = true;
|
||||||
heldKeyTurns++;
|
heldTurns++;
|
||||||
moveFromKey(heldKey);
|
moveFromKey(heldAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetKeyHold(){
|
public void resetKeyHold(){
|
||||||
heldKey = null;
|
heldAction = null;
|
||||||
heldKeyTurns = 0;
|
heldTurns = 0;
|
||||||
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL );
|
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +329,7 @@ public class CellSelector extends ScrollArea {
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
KeyEvent.removeKeyListener(movementListener);
|
KeyEvent.removeKeyListener( keyListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
|
||||||
public class ActionIndicator extends Tag {
|
public class ActionIndicator extends Tag {
|
||||||
|
@ -41,6 +42,11 @@ public class ActionIndicator extends Tag {
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.TAG_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
import com.watabou.utils.Reflection;
|
import com.watabou.utils.Reflection;
|
||||||
|
@ -57,6 +58,11 @@ public class AttackIndicator extends Tag {
|
||||||
enable( false );
|
enable( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.TAG_ATTACK;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.BitmapText;
|
import com.watabou.noosa.BitmapText;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
@ -47,6 +48,11 @@ public class DangerIndicator extends Tag {
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.TAG_DANGER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
|
|
||||||
public class LootIndicator extends Tag {
|
public class LootIndicator extends Tag {
|
||||||
|
|
||||||
|
@ -40,6 +41,11 @@ public class LootIndicator extends Tag {
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.TAG_LOOT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
import com.watabou.noosa.ui.Button;
|
import com.watabou.noosa.ui.Button;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
@ -92,6 +93,11 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
item.execute( Dungeon.hero );
|
item.execute( Dungeon.hero );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return QuickSlotButton.this.keyAction();
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
return QuickSlotButton.this.onLongClick();
|
return QuickSlotButton.this.onLongClick();
|
||||||
|
@ -127,6 +133,22 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
PixelScene.align(crossB);
|
PixelScene.align(crossB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
switch (slotNum){
|
||||||
|
case 0:
|
||||||
|
return KeyAction.QUICKSLOT_1;
|
||||||
|
case 1:
|
||||||
|
return KeyAction.QUICKSLOT_2;
|
||||||
|
case 2:
|
||||||
|
return KeyAction.QUICKSLOT_3;
|
||||||
|
case 3:
|
||||||
|
return KeyAction.QUICKSLOT_4;
|
||||||
|
default:
|
||||||
|
return super.keyAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
GameScene.selectItem( this, WndBag.Mode.QUICKSLOT, Messages.get(this, "select_item") );
|
GameScene.selectItem( this, WndBag.Mode.QUICKSLOT, Messages.get(this, "select_item") );
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
|
||||||
public class ResumeIndicator extends Tag {
|
public class ResumeIndicator extends Tag {
|
||||||
|
@ -38,6 +39,11 @@ public class ResumeIndicator extends Tag {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.TAG_RESUME;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||||
import com.watabou.input.PointerEvent;
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.BitmapText;
|
import com.watabou.noosa.BitmapText;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
|
@ -82,14 +82,18 @@ public class StatusPane extends Component {
|
||||||
bg = new NinePatch( Assets.STATUS, 0, 0, 128, 36, 85, 0, 45, 0 );
|
bg = new NinePatch( Assets.STATUS, 0, 0, 128, 36, 85, 0, 45, 0 );
|
||||||
add( bg );
|
add( bg );
|
||||||
|
|
||||||
add( new PointerArea( 0, 1, 31, 31 ) {
|
add( new Button(){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick( PointerEvent event ) {
|
protected void onClick () {
|
||||||
Image sprite = Dungeon.hero.sprite;
|
Camera.main.panTo( Dungeon.hero.sprite.center(), 5f );
|
||||||
Camera.main.panTo( sprite.center(), 5f );
|
|
||||||
GameScene.show( new WndHero() );
|
GameScene.show( new WndHero() );
|
||||||
}
|
}
|
||||||
} );
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.HERO_INFO;
|
||||||
|
}
|
||||||
|
}.setRect( 0, 1, 30, 30 ));
|
||||||
|
|
||||||
btnJournal = new JournalButton();
|
btnJournal = new JournalButton();
|
||||||
add( btnJournal );
|
add( btnJournal );
|
||||||
|
@ -260,6 +264,11 @@ public class StatusPane extends Component {
|
||||||
height = bg.height + 4;
|
height = bg.height + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.JOURNAL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTerrainTilemap;
|
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTerrainTilemap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
|
||||||
|
import com.watabou.input.KeyAction;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.Gizmo;
|
import com.watabou.noosa.Gizmo;
|
||||||
|
@ -79,6 +80,11 @@ public class Toolbar extends Component {
|
||||||
Dungeon.hero.rest(false);
|
Dungeon.hero.rest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.WAIT;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
examining = false;
|
examining = false;
|
||||||
Dungeon.hero.rest(true);
|
Dungeon.hero.rest(true);
|
||||||
|
@ -98,6 +104,11 @@ public class Toolbar extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
Dungeon.hero.search(true);
|
Dungeon.hero.search(true);
|
||||||
|
@ -123,6 +134,11 @@ public class Toolbar extends Component {
|
||||||
GameScene.show(new WndBag(Dungeon.hero.belongings.backpack, null, WndBag.Mode.ALL, null));
|
GameScene.show(new WndBag(Dungeon.hero.belongings.backpack, null, WndBag.Mode.ALL, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyAction keyAction() {
|
||||||
|
return KeyAction.INVENTORY;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
WndJournal.last_index = 3; //catalog page
|
WndJournal.last_index = 3; //catalog page
|
||||||
|
|
Loading…
Reference in New Issue
Block a user