v1.4.0: reworked danger keybind to cycle target/tabs
This commit is contained in:
@@ -132,10 +132,10 @@ windows.wndkeybindings.bag_3=Container 3
|
||||
windows.wndkeybindings.bag_4=Container 4
|
||||
windows.wndkeybindings.bag_5=Container 5
|
||||
windows.wndkeybindings.tag_attack=Attack Enemy
|
||||
windows.wndkeybindings.tag_danger=Switch Enemy
|
||||
windows.wndkeybindings.tag_action=Special Action
|
||||
windows.wndkeybindings.tag_loot=Pickup Item
|
||||
windows.wndkeybindings.tag_resume=Resume Motion
|
||||
windows.wndkeybindings.cycle=Next Target / Next Tab
|
||||
windows.wndkeybindings.zoom_in=Zoom In / Scroll Down
|
||||
windows.wndkeybindings.zoom_out=Zoom Out / Scroll Up
|
||||
windows.wndkeybindings.n=Go North
|
||||
|
||||
@@ -77,11 +77,12 @@ public class SPDAction extends GameAction {
|
||||
public static final GameAction REST = new SPDAction("rest");
|
||||
|
||||
public static final GameAction TAG_ATTACK = new SPDAction("tag_attack");
|
||||
public static final GameAction TAG_DANGER = new SPDAction("tag_danger");
|
||||
public static final GameAction TAG_ACTION = new SPDAction("tag_action");
|
||||
public static final GameAction TAG_LOOT = new SPDAction("tag_loot");
|
||||
public static final GameAction TAG_RESUME = new SPDAction("tag_resume");
|
||||
|
||||
public static final GameAction CYCLE = new SPDAction("cycle");
|
||||
|
||||
public static final GameAction HERO_INFO = new SPDAction("hero_info");
|
||||
public static final GameAction JOURNAL = new SPDAction("journal");
|
||||
|
||||
@@ -133,7 +134,7 @@ public class SPDAction extends GameAction {
|
||||
defaultBindings.put( Input.Keys.Z, SPDAction.REST );
|
||||
|
||||
defaultBindings.put( Input.Keys.Q, SPDAction.TAG_ATTACK );
|
||||
defaultBindings.put( Input.Keys.TAB, SPDAction.TAG_DANGER );
|
||||
defaultBindings.put( Input.Keys.TAB, SPDAction.CYCLE);
|
||||
defaultBindings.put( Input.Keys.X, SPDAction.TAG_ACTION );
|
||||
defaultBindings.put( Input.Keys.C, SPDAction.TAG_LOOT );
|
||||
defaultBindings.put( Input.Keys.ENTER, SPDAction.TAG_LOOT );
|
||||
@@ -161,7 +162,7 @@ public class SPDAction extends GameAction {
|
||||
defaultControllerBindings.put( Input.Keys.BUTTON_SELECT, SPDAction.MIDDLE_CLICK );
|
||||
|
||||
defaultControllerBindings.put( Input.Keys.DPAD_UP+1000, SPDAction.TAG_ACTION );
|
||||
defaultControllerBindings.put( Input.Keys.DPAD_LEFT+1000, SPDAction.TAG_DANGER );
|
||||
defaultControllerBindings.put( Input.Keys.DPAD_LEFT+1000, SPDAction.CYCLE);
|
||||
defaultControllerBindings.put( Input.Keys.DPAD_DOWN+1000, SPDAction.TAG_RESUME );
|
||||
defaultControllerBindings.put( Input.Keys.DPAD_RIGHT+1000, SPDAction.TAG_LOOT );
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class DangerIndicator extends Tag {
|
||||
|
||||
@Override
|
||||
public GameAction keyAction() {
|
||||
return SPDAction.TAG_DANGER;
|
||||
return SPDAction.CYCLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,9 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.input.KeyBindings;
|
||||
import com.watabou.input.KeyEvent;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
@@ -33,6 +36,7 @@ import com.watabou.noosa.PointerArea;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Button;
|
||||
import com.watabou.utils.RectF;
|
||||
import com.watabou.utils.Signal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -40,12 +44,37 @@ public class WndTabbed extends Window {
|
||||
|
||||
protected ArrayList<Tab> tabs = new ArrayList<>();
|
||||
protected Tab selected;
|
||||
|
||||
private Signal.Listener<KeyEvent> tabListener;
|
||||
|
||||
public WndTabbed() {
|
||||
super( 0, 0, Chrome.get( Chrome.Type.TAB_SET ) );
|
||||
|
||||
KeyEvent.addKeyListener(tabListener = new Signal.Listener<KeyEvent>() {
|
||||
@Override
|
||||
public boolean onSignal(KeyEvent keyEvent) {
|
||||
|
||||
if (!keyEvent.pressed && KeyBindings.getActionForKey(keyEvent) == SPDAction.CYCLE){
|
||||
int idx = tabs.indexOf(selected);
|
||||
idx++;
|
||||
if (idx >= tabs.size()) idx = 0;
|
||||
select(idx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Tab add( Tab tab ) {
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
KeyEvent.removeKeyListener(tabListener);
|
||||
}
|
||||
|
||||
protected Tab add(Tab tab ) {
|
||||
|
||||
tab.setPos( tabs.size() == 0 ?
|
||||
-chrome.marginLeft() + 1 :
|
||||
|
||||
Reference in New Issue
Block a user