Merge pull request #3352 from kevlahnota/newmaster2

restrict menus when DuelScene or RewardScene is loading
This commit is contained in:
Anthony Calosa
2023-06-28 12:02:31 +08:00
committed by GitHub
7 changed files with 17 additions and 2 deletions

View File

@@ -62,6 +62,7 @@ public class Forge implements ApplicationListener {
static Batch animationBatch;
static TextureRegion lastScreenTexture;
private static boolean sceneWasSwapped = false;
public static boolean restrictAdvMenus = false;
private static Clipboard clipboard;
private static IDeviceAdapter deviceAdapter;
private static int screenWidth;
@@ -1060,7 +1061,6 @@ public class Forge implements ApplicationListener {
}
public static Scene switchToLast() {
if (lastScene.size != 0) {
storeScreen();
currentScene = lastScene.get(lastScene.size - 1);

View File

@@ -151,6 +151,7 @@ public class DuelScene extends ForgeScene {
}
Runnable endRunnable = null;
void afterGameEnd(String enemyName, boolean winner) {
Forge.restrictAdvMenus = winner;
endRunnable = () -> Gdx.app.postRunnable(()-> {
if (GameScene.instance().isNotInWorldMap()) {
SoundSystem.instance.pause();

View File

@@ -133,6 +133,7 @@ public class RewardScene extends UIScene {
}
//save RAM
ImageCache.unloadCardTextures(true);
Forge.restrictAdvMenus = false;
Forge.switchToLast();
}
public void reactivateInputs() {

View File

@@ -156,12 +156,16 @@ public class GameHUD extends Stage {
private void openMap() {
if (console.isVisible())
return;
if (Forge.restrictAdvMenus)
return;
Forge.switchScene(MapViewScene.instance());
}
private void logbook() {
if (console.isVisible())
return;
if (Forge.restrictAdvMenus)
return;
Forge.switchScene(QuestLogScene.instance(Forge.getCurrentScene()));
}
@@ -484,12 +488,16 @@ public class GameHUD extends Stage {
private void openDeck() {
if (console.isVisible())
return;
if (Forge.restrictAdvMenus)
return;
Forge.switchScene(DeckSelectScene.instance());
}
private void openInventory() {
if (console.isVisible())
return;
if (Forge.restrictAdvMenus)
return;
WorldSave.getCurrentSave().header.createPreview();
Forge.switchScene(InventoryScene.instance());
}
@@ -525,6 +533,8 @@ public class GameHUD extends Stage {
private void menu() {
if (console.isVisible())
return;
if (Forge.restrictAdvMenus)
return;
gameStage.openMenu();
}

View File

@@ -376,7 +376,8 @@ public abstract class GameStage extends Stage {
}
public void openMenu() {
if (Forge.restrictAdvMenus)
return;
WorldSave.getCurrentSave().header.createPreview();
Forge.switchScene(StartScene.instance());
}

View File

@@ -1125,6 +1125,7 @@ public class MapStage extends GameStage {
int duration = mob.getData().boss ? 400 : 200;
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
Controllers.getCurrent().startVibration(duration, 1);
Forge.restrictAdvMenus = true;
startPause(0.8f, () -> {
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);

View File

@@ -116,6 +116,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
int duration = mob.getData().boss ? 400 : 200;
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
Controllers.getCurrent().startVibration(duration, 1);
Forge.restrictAdvMenus = true;
startPause(0.8f, () -> {
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);