v1.1.0: added safety checks for multiple inputs in the same frame

This commit is contained in:
Evan Debenham 2021-12-05 13:09:23 -05:00
parent 6d77ed872d
commit d747590bcf
3 changed files with 17 additions and 4 deletions

View File

@ -143,7 +143,8 @@ public class CellSelector extends ScrollArea {
}
public void select( int cell ) {
if (enabled && listener != null && cell != -1) {
if (enabled && Dungeon.hero.ready && !GameScene.isShowingWindow()
&& listener != null && cell != -1) {
listener.onSelect( cell );
GameScene.ready();

View File

@ -1027,6 +1027,16 @@ public class GameScene extends PixelScene {
}
}
public static boolean isShowingWindow(){
if (scene == null) return false;
for (Gizmo g : scene.members){
if (g instanceof Window) return true;
}
return false;
}
public static void updateFog(){
if (scene != null) {
scene.fog.updateFog();
@ -1097,8 +1107,10 @@ public class GameScene extends PixelScene {
cellSelector.listener.onSelect(null);
}
cellSelector.listener = listener;
if (scene != null)
scene.prompt( listener.prompt() );
cellSelector.enabled = Dungeon.hero.ready;
if (scene != null) {
scene.prompt(listener.prompt());
}
}
private static boolean cancelCellSelector() {

View File

@ -79,7 +79,7 @@ public class QuickSlotButton extends Button {
slot = new ItemSlot() {
@Override
protected void onClick() {
if (!Dungeon.hero.isAlive()){
if (!Dungeon.hero.isAlive() || !Dungeon.hero.ready){
return;
}
if (targeting) {