v2.0.0: improved cell selector cancelling logic
This commit is contained in:
@@ -391,6 +391,10 @@ public class CellSelector extends ScrollArea {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameScene.cancelCellSelector()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int cell = Dungeon.hero.pos;
|
int cell = Dungeon.hero.pos;
|
||||||
for (GameAction action : actions) {
|
for (GameAction action : actions) {
|
||||||
cell += directionFromAction(action);
|
cell += directionFromAction(action);
|
||||||
|
|||||||
@@ -1167,7 +1167,7 @@ public class GameScene extends PixelScene {
|
|||||||
|
|
||||||
public static void show( Window wnd ) {
|
public static void show( Window wnd ) {
|
||||||
if (scene != null) {
|
if (scene != null) {
|
||||||
cancelCellSelector();
|
cancel();
|
||||||
|
|
||||||
//If a window is already present (or was just present)
|
//If a window is already present (or was just present)
|
||||||
// then inherit the offset it had
|
// then inherit the offset it had
|
||||||
@@ -1353,9 +1353,9 @@ public class GameScene extends PixelScene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean cancelCellSelector() {
|
public static boolean cancelCellSelector() {
|
||||||
cellSelector.resetKeyHold();
|
|
||||||
if (cellSelector.listener != null && cellSelector.listener != defaultCellListener) {
|
if (cellSelector.listener != null && cellSelector.listener != defaultCellListener) {
|
||||||
|
cellSelector.resetKeyHold();
|
||||||
cellSelector.cancel();
|
cellSelector.cancel();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1364,7 +1364,7 @@ public class GameScene extends PixelScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static WndBag selectItem( WndBag.ItemSelector listener ) {
|
public static WndBag selectItem( WndBag.ItemSelector listener ) {
|
||||||
cancelCellSelector();
|
cancel();
|
||||||
|
|
||||||
if (scene != null) {
|
if (scene != null) {
|
||||||
//TODO can the inventory pane work in these cases? bad to fallback to mobile window
|
//TODO can the inventory pane work in these cases? bad to fallback to mobile window
|
||||||
@@ -1382,6 +1382,7 @@ public class GameScene extends PixelScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean cancel() {
|
public static boolean cancel() {
|
||||||
|
cellSelector.resetKeyHold();
|
||||||
if (Dungeon.hero != null && (Dungeon.hero.curAction != null || Dungeon.hero.resting)) {
|
if (Dungeon.hero != null && (Dungeon.hero.curAction != null || Dungeon.hero.resting)) {
|
||||||
|
|
||||||
Dungeon.hero.curAction = null;
|
Dungeon.hero.curAction = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user