v0.8.0: refactored most game actions into the core module
This commit is contained in:
parent
f269d68a27
commit
53b3d1e9fe
31
SPD-classes/src/main/java/com/watabou/input/GameAction.java
Normal file
31
SPD-classes/src/main/java/com/watabou/input/GameAction.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2019 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.watabou.input;
|
||||||
|
|
||||||
|
public class GameAction {
|
||||||
|
|
||||||
|
public static final int NONE = 0;
|
||||||
|
|
||||||
|
public static final int BACK = 1;
|
||||||
|
public static final int MENU = 2;
|
||||||
|
|
||||||
|
}
|
|
@ -29,8 +29,8 @@ import com.watabou.glscripts.Script;
|
||||||
import com.watabou.gltextures.TextureCache;
|
import com.watabou.gltextures.TextureCache;
|
||||||
import com.watabou.glwrap.Blending;
|
import com.watabou.glwrap.Blending;
|
||||||
import com.watabou.glwrap.Vertexbuffer;
|
import com.watabou.glwrap.Vertexbuffer;
|
||||||
|
import com.watabou.input.GameAction;
|
||||||
import com.watabou.input.InputHandler;
|
import com.watabou.input.InputHandler;
|
||||||
import com.watabou.input.KeyAction;
|
|
||||||
import com.watabou.noosa.audio.Music;
|
import com.watabou.noosa.audio.Music;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Callback;
|
import com.watabou.utils.Callback;
|
||||||
|
@ -100,7 +100,6 @@ public class Game implements ApplicationListener {
|
||||||
Blending.useDefault();
|
Blending.useDefault();
|
||||||
|
|
||||||
inputHandler = new InputHandler( Gdx.input );
|
inputHandler = new InputHandler( Gdx.input );
|
||||||
KeyAction.initialize();
|
|
||||||
|
|
||||||
//refreshes texture and vertex data stored on the gpu
|
//refreshes texture and vertex data stored on the gpu
|
||||||
TextureCache.reload();
|
TextureCache.reload();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
package com.watabou.noosa;
|
package com.watabou.noosa;
|
||||||
|
|
||||||
import com.watabou.input.KeyAction;
|
import com.watabou.input.GameAction;
|
||||||
import com.watabou.input.KeyBindings;
|
import com.watabou.input.KeyBindings;
|
||||||
import com.watabou.input.KeyEvent;
|
import com.watabou.input.KeyEvent;
|
||||||
import com.watabou.utils.Signal;
|
import com.watabou.utils.Signal;
|
||||||
|
@ -36,10 +36,10 @@ public class Scene extends Group {
|
||||||
public boolean onSignal( KeyEvent event ) {
|
public boolean onSignal( KeyEvent event ) {
|
||||||
if (Game.instance != null && event.pressed) {
|
if (Game.instance != null && event.pressed) {
|
||||||
switch (KeyBindings.getBinding( event )) {
|
switch (KeyBindings.getBinding( event )) {
|
||||||
case KeyAction.BACK:
|
case GameAction.BACK:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
break;
|
break;
|
||||||
case KeyAction.MENU:
|
case GameAction.MENU:
|
||||||
onMenuPressed();
|
onMenuPressed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
package com.watabou.noosa.ui;
|
package com.watabou.noosa.ui;
|
||||||
|
|
||||||
import com.watabou.input.KeyAction;
|
import com.watabou.input.GameAction;
|
||||||
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;
|
||||||
|
@ -79,7 +79,7 @@ public class Button extends Component {
|
||||||
private Signal.Listener<KeyEvent> keyListener;
|
private Signal.Listener<KeyEvent> keyListener;
|
||||||
|
|
||||||
public int keyAction(){
|
public int keyAction(){
|
||||||
return KeyAction.NONE;
|
return GameAction.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,17 +19,20 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.watabou.input;
|
package com.shatteredpixel.shatteredpixeldungeon;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
|
import com.watabou.input.GameAction;
|
||||||
|
import com.watabou.input.KeyBindings;
|
||||||
|
|
||||||
//FIXME this is describing actions defined in the core module, it should probably be moved there.
|
public class SPDAction extends GameAction {
|
||||||
public class KeyAction {
|
|
||||||
|
|
||||||
public static final int NONE = 0;
|
//--Existing actions from GameAction
|
||||||
|
public static final int NONE = GameAction.NONE;
|
||||||
|
|
||||||
public static final int BACK = 1;
|
public static final int BACK = GameAction.BACK;
|
||||||
public static final int MENU = 2;
|
public static final int MENU = GameAction.MENU;
|
||||||
|
//--
|
||||||
|
|
||||||
public static final int HERO_INFO = 3;
|
public static final int HERO_INFO = 3;
|
||||||
public static final int JOURNAL = 4;
|
public static final int JOURNAL = 4;
|
||||||
|
@ -101,45 +104,46 @@ public class KeyAction {
|
||||||
KeyBindings.addName(NW, "none");
|
KeyBindings.addName(NW, "none");
|
||||||
|
|
||||||
//default key bindings
|
//default key bindings
|
||||||
KeyBindings.addBinding( Input.Keys.BACK, KeyAction.BACK );
|
KeyBindings.addBinding( Input.Keys.BACK, GameAction.BACK );
|
||||||
KeyBindings.addBinding( Input.Keys.MENU, KeyAction.MENU );
|
KeyBindings.addBinding( Input.Keys.MENU, GameAction.MENU );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.H, KeyAction.HERO_INFO );
|
KeyBindings.addBinding( Input.Keys.H, SPDAction.HERO_INFO );
|
||||||
KeyBindings.addBinding( Input.Keys.J, KeyAction.JOURNAL );
|
KeyBindings.addBinding( Input.Keys.J, SPDAction.JOURNAL );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_5, KeyAction.WAIT );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_5, SPDAction.WAIT );
|
||||||
KeyBindings.addBinding( Input.Keys.SPACE, KeyAction.WAIT );
|
KeyBindings.addBinding( Input.Keys.SPACE, SPDAction.WAIT );
|
||||||
KeyBindings.addBinding( Input.Keys.S, KeyAction.SEARCH );
|
KeyBindings.addBinding( Input.Keys.S, SPDAction.SEARCH );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.I, KeyAction.INVENTORY );
|
KeyBindings.addBinding( Input.Keys.I, SPDAction.INVENTORY );
|
||||||
KeyBindings.addBinding( Input.Keys.Q, KeyAction.QUICKSLOT_1 );
|
KeyBindings.addBinding( Input.Keys.Q, SPDAction.QUICKSLOT_1 );
|
||||||
KeyBindings.addBinding( Input.Keys.W, KeyAction.QUICKSLOT_2 );
|
KeyBindings.addBinding( Input.Keys.W, SPDAction.QUICKSLOT_2 );
|
||||||
KeyBindings.addBinding( Input.Keys.E, KeyAction.QUICKSLOT_3 );
|
KeyBindings.addBinding( Input.Keys.E, SPDAction.QUICKSLOT_3 );
|
||||||
KeyBindings.addBinding( Input.Keys.R, KeyAction.QUICKSLOT_4 );
|
KeyBindings.addBinding( Input.Keys.R, SPDAction.QUICKSLOT_4 );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.A, KeyAction.TAG_ATTACK );
|
KeyBindings.addBinding( Input.Keys.A, SPDAction.TAG_ATTACK );
|
||||||
KeyBindings.addBinding( Input.Keys.TAB, KeyAction.TAG_DANGER );
|
KeyBindings.addBinding( Input.Keys.TAB, SPDAction.TAG_DANGER );
|
||||||
KeyBindings.addBinding( Input.Keys.D, KeyAction.TAG_ACTION );
|
KeyBindings.addBinding( Input.Keys.D, SPDAction.TAG_ACTION );
|
||||||
KeyBindings.addBinding( Input.Keys.ENTER, KeyAction.TAG_LOOT );
|
KeyBindings.addBinding( Input.Keys.ENTER, SPDAction.TAG_LOOT );
|
||||||
KeyBindings.addBinding( Input.Keys.T, KeyAction.TAG_RESUME );
|
KeyBindings.addBinding( Input.Keys.T, SPDAction.TAG_RESUME );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.PLUS, KeyAction.ZOOM_IN );
|
KeyBindings.addBinding( Input.Keys.PLUS, SPDAction.ZOOM_IN );
|
||||||
KeyBindings.addBinding( Input.Keys.EQUALS, KeyAction.ZOOM_IN );
|
KeyBindings.addBinding( Input.Keys.EQUALS, SPDAction.ZOOM_IN );
|
||||||
KeyBindings.addBinding( Input.Keys.MINUS, KeyAction.ZOOM_OUT );
|
KeyBindings.addBinding( Input.Keys.MINUS, SPDAction.ZOOM_OUT );
|
||||||
KeyBindings.addBinding( Input.Keys.SLASH, KeyAction.ZOOM_DEFAULT );
|
KeyBindings.addBinding( Input.Keys.SLASH, SPDAction.ZOOM_DEFAULT );
|
||||||
|
|
||||||
KeyBindings.addBinding( Input.Keys.UP, KeyAction.N );
|
KeyBindings.addBinding( Input.Keys.UP, SPDAction.N );
|
||||||
KeyBindings.addBinding( Input.Keys.RIGHT, KeyAction.E );
|
KeyBindings.addBinding( Input.Keys.RIGHT, SPDAction.E );
|
||||||
KeyBindings.addBinding( Input.Keys.DOWN, KeyAction.S );
|
KeyBindings.addBinding( Input.Keys.DOWN, SPDAction.S );
|
||||||
KeyBindings.addBinding( Input.Keys.LEFT, KeyAction.W );
|
KeyBindings.addBinding( Input.Keys.LEFT, SPDAction.W );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_8, KeyAction.N );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_8, SPDAction.N );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_9, KeyAction.NE );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_9, SPDAction.NE );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_6, KeyAction.E );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_6, SPDAction.E );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_3, KeyAction.SE );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_3, SPDAction.SE );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_2, KeyAction.S );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_2, SPDAction.S );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_1, KeyAction.SW );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_1, SPDAction.SW );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_4, KeyAction.W );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_4, SPDAction.W );
|
||||||
KeyBindings.addBinding( Input.Keys.NUMPAD_7, KeyAction.NW );
|
KeyBindings.addBinding( Input.Keys.NUMPAD_7, SPDAction.NW );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -132,6 +132,7 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
updateSystemUI();
|
updateSystemUI();
|
||||||
|
SPDAction.initialize();
|
||||||
|
|
||||||
Music.INSTANCE.enable( SPDSettings.music() );
|
Music.INSTANCE.enable( SPDSettings.music() );
|
||||||
Music.INSTANCE.volume( SPDSettings.musicVol()/10f );
|
Music.INSTANCE.volume( SPDSettings.musicVol()/10f );
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
@ -29,7 +30,6 @@ 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;
|
||||||
|
@ -208,7 +208,7 @@ public class CellSelector extends ScrollArea {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int heldAction = KeyAction.NONE;
|
private int heldAction = SPDAction.NONE;
|
||||||
private int heldTurns = 0;
|
private int heldTurns = 0;
|
||||||
|
|
||||||
private Signal.Listener<KeyEvent> keyListener = new Signal.Listener<KeyEvent>() {
|
private Signal.Listener<KeyEvent> keyListener = new Signal.Listener<KeyEvent>() {
|
||||||
|
@ -222,13 +222,13 @@ public class CellSelector extends ScrollArea {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
switch (action){
|
switch (action){
|
||||||
case KeyAction.ZOOM_IN:
|
case SPDAction.ZOOM_IN:
|
||||||
zoom( camera.zoom+1 );
|
zoom( camera.zoom+1 );
|
||||||
return true;
|
return true;
|
||||||
case KeyAction.ZOOM_OUT:
|
case SPDAction.ZOOM_OUT:
|
||||||
zoom( camera.zoom-1 );
|
zoom( camera.zoom-1 );
|
||||||
return true;
|
return true;
|
||||||
case KeyAction.ZOOM_DEFAULT:
|
case SPDAction.ZOOM_DEFAULT:
|
||||||
zoom( PixelScene.defaultZoom );
|
zoom( PixelScene.defaultZoom );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -245,30 +245,29 @@ public class CellSelector extends ScrollArea {
|
||||||
private boolean moveFromKey(int event){
|
private boolean moveFromKey(int 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
|
|
||||||
switch (event){
|
switch (event){
|
||||||
case KeyAction.N:
|
case SPDAction.N:
|
||||||
cell += -Dungeon.level.width();
|
cell += -Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
case KeyAction.NE:
|
case SPDAction.NE:
|
||||||
cell += +1-Dungeon.level.width();
|
cell += +1-Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
case KeyAction.E:
|
case SPDAction.E:
|
||||||
cell += +1;
|
cell += +1;
|
||||||
break;
|
break;
|
||||||
case KeyAction.SE:
|
case SPDAction.SE:
|
||||||
cell += +1+Dungeon.level.width();
|
cell += +1+Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
case KeyAction.S:
|
case SPDAction.S:
|
||||||
cell += +Dungeon.level.width();
|
cell += +Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
case KeyAction.SW:
|
case SPDAction.SW:
|
||||||
cell += -1+Dungeon.level.width();
|
cell += -1+Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
case KeyAction.W:
|
case SPDAction.W:
|
||||||
cell += -1;
|
cell += -1;
|
||||||
break;
|
break;
|
||||||
case KeyAction.NW:
|
case SPDAction.NW:
|
||||||
cell += -1-Dungeon.level.width();
|
cell += -1-Dungeon.level.width();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -287,7 +286,7 @@ public class CellSelector extends ScrollArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processKeyHold(){
|
public void processKeyHold(){
|
||||||
if (heldAction != KeyAction.NONE){
|
if (heldAction != SPDAction.NONE){
|
||||||
enabled = true;
|
enabled = true;
|
||||||
heldTurns++;
|
heldTurns++;
|
||||||
moveFromKey(heldAction);
|
moveFromKey(heldAction);
|
||||||
|
@ -295,7 +294,7 @@ public class CellSelector extends ScrollArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetKeyHold(){
|
public void resetKeyHold(){
|
||||||
heldAction = KeyAction.NONE;
|
heldAction = SPDAction.NONE;
|
||||||
heldTurns = 0;
|
heldTurns = 0;
|
||||||
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL );
|
CharSprite.setMoveInterval( CharSprite.DEFAULT_MOVE_INTERVAL );
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
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 {
|
||||||
|
@ -44,7 +44,7 @@ public class ActionIndicator extends Tag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.TAG_ACTION;
|
return SPDAction.TAG_ACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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;
|
||||||
|
@ -60,7 +60,7 @@ public class AttackIndicator extends Tag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.TAG_ATTACK;
|
return SPDAction.TAG_ATTACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
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;
|
||||||
|
@ -50,7 +50,7 @@ public class DangerIndicator extends Tag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.TAG_DANGER;
|
return SPDAction.TAG_DANGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
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 {
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class LootIndicator extends Tag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.TAG_LOOT;
|
return SPDAction.TAG_LOOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
@ -31,7 +32,6 @@ 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;
|
||||||
|
@ -145,13 +145,13 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
switch (slotNum){
|
switch (slotNum){
|
||||||
case 0:
|
case 0:
|
||||||
return KeyAction.QUICKSLOT_1;
|
return SPDAction.QUICKSLOT_1;
|
||||||
case 1:
|
case 1:
|
||||||
return KeyAction.QUICKSLOT_2;
|
return SPDAction.QUICKSLOT_2;
|
||||||
case 2:
|
case 2:
|
||||||
return KeyAction.QUICKSLOT_3;
|
return SPDAction.QUICKSLOT_3;
|
||||||
case 3:
|
case 3:
|
||||||
return KeyAction.QUICKSLOT_4;
|
return SPDAction.QUICKSLOT_4;
|
||||||
default:
|
default:
|
||||||
return super.keyAction();
|
return super.keyAction();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
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 {
|
||||||
|
@ -41,7 +41,7 @@ public class ResumeIndicator extends Tag {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.TAG_RESUME;
|
return SPDAction.TAG_RESUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
@ -32,7 +33,6 @@ 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.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;
|
||||||
|
@ -90,7 +90,7 @@ public class StatusPane extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.HERO_INFO;
|
return SPDAction.HERO_INFO;
|
||||||
}
|
}
|
||||||
}.setRect( 0, 1, 30, 30 ));
|
}.setRect( 0, 1, 30, 30 ));
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class StatusPane extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.JOURNAL;
|
return SPDAction.JOURNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -32,7 +33,6 @@ 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;
|
||||||
|
@ -89,7 +89,7 @@ public class Toolbar extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.WAIT;
|
return SPDAction.WAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
|
@ -113,7 +113,7 @@ public class Toolbar extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.SEARCH;
|
return SPDAction.SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,7 +133,7 @@ public class Toolbar extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int keyAction() {
|
public int keyAction() {
|
||||||
return KeyAction.INVENTORY;
|
return SPDAction.INVENTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.ShadowBox;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.ShadowBox;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
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;
|
||||||
|
@ -159,10 +159,10 @@ public class Window extends Group implements Signal.Listener<KeyEvent> {
|
||||||
public boolean onSignal( KeyEvent event ) {
|
public boolean onSignal( KeyEvent event ) {
|
||||||
if (event.pressed) {
|
if (event.pressed) {
|
||||||
switch (KeyBindings.getBinding( event )) {
|
switch (KeyBindings.getBinding( event )) {
|
||||||
case KeyAction.BACK:
|
case SPDAction.BACK:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
case KeyAction.MENU:
|
case SPDAction.MENU:
|
||||||
onMenuPressed();
|
onMenuPressed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user