mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge pull request #3352 from kevlahnota/newmaster2
restrict menus when DuelScene or RewardScene is loading
This commit is contained in:
@@ -62,6 +62,7 @@ public class Forge implements ApplicationListener {
|
|||||||
static Batch animationBatch;
|
static Batch animationBatch;
|
||||||
static TextureRegion lastScreenTexture;
|
static TextureRegion lastScreenTexture;
|
||||||
private static boolean sceneWasSwapped = false;
|
private static boolean sceneWasSwapped = false;
|
||||||
|
public static boolean restrictAdvMenus = false;
|
||||||
private static Clipboard clipboard;
|
private static Clipboard clipboard;
|
||||||
private static IDeviceAdapter deviceAdapter;
|
private static IDeviceAdapter deviceAdapter;
|
||||||
private static int screenWidth;
|
private static int screenWidth;
|
||||||
@@ -1060,7 +1061,6 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Scene switchToLast() {
|
public static Scene switchToLast() {
|
||||||
|
|
||||||
if (lastScene.size != 0) {
|
if (lastScene.size != 0) {
|
||||||
storeScreen();
|
storeScreen();
|
||||||
currentScene = lastScene.get(lastScene.size - 1);
|
currentScene = lastScene.get(lastScene.size - 1);
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ public class DuelScene extends ForgeScene {
|
|||||||
}
|
}
|
||||||
Runnable endRunnable = null;
|
Runnable endRunnable = null;
|
||||||
void afterGameEnd(String enemyName, boolean winner) {
|
void afterGameEnd(String enemyName, boolean winner) {
|
||||||
|
Forge.restrictAdvMenus = winner;
|
||||||
endRunnable = () -> Gdx.app.postRunnable(()-> {
|
endRunnable = () -> Gdx.app.postRunnable(()-> {
|
||||||
if (GameScene.instance().isNotInWorldMap()) {
|
if (GameScene.instance().isNotInWorldMap()) {
|
||||||
SoundSystem.instance.pause();
|
SoundSystem.instance.pause();
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ public class RewardScene extends UIScene {
|
|||||||
}
|
}
|
||||||
//save RAM
|
//save RAM
|
||||||
ImageCache.unloadCardTextures(true);
|
ImageCache.unloadCardTextures(true);
|
||||||
|
Forge.restrictAdvMenus = false;
|
||||||
Forge.switchToLast();
|
Forge.switchToLast();
|
||||||
}
|
}
|
||||||
public void reactivateInputs() {
|
public void reactivateInputs() {
|
||||||
|
|||||||
@@ -156,12 +156,16 @@ public class GameHUD extends Stage {
|
|||||||
private void openMap() {
|
private void openMap() {
|
||||||
if (console.isVisible())
|
if (console.isVisible())
|
||||||
return;
|
return;
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
Forge.switchScene(MapViewScene.instance());
|
Forge.switchScene(MapViewScene.instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logbook() {
|
private void logbook() {
|
||||||
if (console.isVisible())
|
if (console.isVisible())
|
||||||
return;
|
return;
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
Forge.switchScene(QuestLogScene.instance(Forge.getCurrentScene()));
|
Forge.switchScene(QuestLogScene.instance(Forge.getCurrentScene()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,12 +488,16 @@ public class GameHUD extends Stage {
|
|||||||
private void openDeck() {
|
private void openDeck() {
|
||||||
if (console.isVisible())
|
if (console.isVisible())
|
||||||
return;
|
return;
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
Forge.switchScene(DeckSelectScene.instance());
|
Forge.switchScene(DeckSelectScene.instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openInventory() {
|
private void openInventory() {
|
||||||
if (console.isVisible())
|
if (console.isVisible())
|
||||||
return;
|
return;
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
WorldSave.getCurrentSave().header.createPreview();
|
WorldSave.getCurrentSave().header.createPreview();
|
||||||
Forge.switchScene(InventoryScene.instance());
|
Forge.switchScene(InventoryScene.instance());
|
||||||
}
|
}
|
||||||
@@ -525,6 +533,8 @@ public class GameHUD extends Stage {
|
|||||||
private void menu() {
|
private void menu() {
|
||||||
if (console.isVisible())
|
if (console.isVisible())
|
||||||
return;
|
return;
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
gameStage.openMenu();
|
gameStage.openMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -376,7 +376,8 @@ public abstract class GameStage extends Stage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openMenu() {
|
public void openMenu() {
|
||||||
|
if (Forge.restrictAdvMenus)
|
||||||
|
return;
|
||||||
WorldSave.getCurrentSave().header.createPreview();
|
WorldSave.getCurrentSave().header.createPreview();
|
||||||
Forge.switchScene(StartScene.instance());
|
Forge.switchScene(StartScene.instance());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1125,6 +1125,7 @@ public class MapStage extends GameStage {
|
|||||||
int duration = mob.getData().boss ? 400 : 200;
|
int duration = mob.getData().boss ? 400 : 200;
|
||||||
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
|
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
|
||||||
Controllers.getCurrent().startVibration(duration, 1);
|
Controllers.getCurrent().startVibration(duration, 1);
|
||||||
|
Forge.restrictAdvMenus = true;
|
||||||
startPause(0.8f, () -> {
|
startPause(0.8f, () -> {
|
||||||
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
|
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
|
||||||
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
|
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
|
|||||||
int duration = mob.getData().boss ? 400 : 200;
|
int duration = mob.getData().boss ? 400 : 200;
|
||||||
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
|
if (Controllers.getCurrent() != null && Controllers.getCurrent().canVibrate())
|
||||||
Controllers.getCurrent().startVibration(duration, 1);
|
Controllers.getCurrent().startVibration(duration, 1);
|
||||||
|
Forge.restrictAdvMenus = true;
|
||||||
startPause(0.8f, () -> {
|
startPause(0.8f, () -> {
|
||||||
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
|
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
|
||||||
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
|
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user