mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
retrict menu and movement on player defeat dialog
This commit is contained in:
@@ -63,7 +63,7 @@ public class Forge implements ApplicationListener {
|
||||
static Batch animationBatch;
|
||||
static TextureRegion lastScreenTexture;
|
||||
private static boolean sceneWasSwapped = false;
|
||||
public static boolean restrictAdvMenus = false;
|
||||
public static boolean advFreezePlayerControls = false;
|
||||
private static Clipboard clipboard;
|
||||
private static IDeviceAdapter deviceAdapter;
|
||||
private static int screenWidth;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.character;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import forge.Forge;
|
||||
import forge.adventure.player.AdventurePlayer;
|
||||
import forge.adventure.scene.Scene;
|
||||
import forge.adventure.stage.GameStage;
|
||||
@@ -58,6 +59,8 @@ public class PlayerSprite extends CharacterSprite {
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
direction.setLength(playerSpeed * delta * playerSpeedModifier*playerSpeedEquipmentModifier);
|
||||
Vector2 previousDirection = getMovementDirection().cpy();
|
||||
Scene previousScene = forge.Forge.getCurrentScene();
|
||||
|
||||
@@ -134,7 +134,7 @@ public class DuelScene extends ForgeScene {
|
||||
Runnable endRunnable = null;
|
||||
|
||||
void afterGameEnd(String enemyName, boolean winner) {
|
||||
Forge.restrictAdvMenus = winner;
|
||||
Forge.advFreezePlayerControls = winner;
|
||||
endRunnable = () -> Gdx.app.postRunnable(() -> {
|
||||
GameHUD.getInstance().switchAudio();
|
||||
dungeonEffect = null;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import forge.Forge;
|
||||
import forge.adventure.stage.GameHUD;
|
||||
import forge.adventure.stage.GameStage;
|
||||
import forge.adventure.stage.IAfterMatch;
|
||||
@@ -80,6 +81,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.keyDown(keycode);
|
||||
}
|
||||
|
||||
@@ -93,6 +96,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.keyUp(keycode);
|
||||
}
|
||||
|
||||
@@ -112,6 +117,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.keyTyped(character);
|
||||
}
|
||||
|
||||
@@ -121,6 +128,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.touchDown(screenX, screenY, pointer, button);
|
||||
}
|
||||
|
||||
@@ -130,6 +139,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.touchUp(screenX, screenY, pointer, button);
|
||||
}
|
||||
|
||||
@@ -139,6 +150,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.touchDragged(screenX, screenY, pointer);
|
||||
}
|
||||
|
||||
@@ -148,6 +161,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.mouseMoved(screenX, screenY);
|
||||
}
|
||||
|
||||
@@ -157,6 +172,8 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
return true;
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return false;
|
||||
return stage.scrolled(amountX, amountY);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ public class RewardScene extends UIScene {
|
||||
}
|
||||
}
|
||||
//save RAM
|
||||
ImageCache.unloadCardTextures(true);
|
||||
Forge.restrictAdvMenus = false;
|
||||
ImageCache.getInstance().unloadCardTextures(true);
|
||||
Forge.advFreezePlayerControls = false;
|
||||
if (this.collectionPool != null) {
|
||||
this.collectionPool.clear();
|
||||
this.collectionPool = null;
|
||||
|
||||
@@ -244,7 +244,7 @@ public class GameHUD extends Stage {
|
||||
private void openMap() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
Forge.switchScene(MapViewScene.instance());
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class GameHUD extends Stage {
|
||||
private void logbook() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
Forge.switchScene(QuestLogScene.instance(Forge.getCurrentScene()));
|
||||
}
|
||||
@@ -482,6 +482,8 @@ public class GameHUD extends Stage {
|
||||
TextraButton button = Controls.newTextButton("[%90][+" + data.iconName + "][+Shards][BLACK]" + data.shardsNeeded, () -> {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
boolean isInPoi = MapStage.getInstance().isInMap();
|
||||
if (!(isInPoi && data.usableInPoi || !isInPoi && data.usableOnWorldMap))
|
||||
return;
|
||||
@@ -619,7 +621,7 @@ public class GameHUD extends Stage {
|
||||
private void openDeck() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
Forge.switchScene(DeckSelectScene.instance());
|
||||
}
|
||||
@@ -627,7 +629,7 @@ public class GameHUD extends Stage {
|
||||
private void openInventory() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
WorldSave.getCurrentSave().header.createPreview();
|
||||
Forge.switchScene(InventoryScene.instance());
|
||||
@@ -640,7 +642,7 @@ public class GameHUD extends Stage {
|
||||
return;
|
||||
if (!MapStage.getInstance().canEscape())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
dialog.getButtonTable().clear();
|
||||
dialog.getContentTable().clear();
|
||||
@@ -664,7 +666,7 @@ public class GameHUD extends Stage {
|
||||
return;
|
||||
if (!MapStage.getInstance().canEscape())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
if (MapStage.getInstance().isInMap()) {
|
||||
if (MapStage.getInstance().getChanges().isBookmarked()) {
|
||||
@@ -704,7 +706,7 @@ public class GameHUD extends Stage {
|
||||
private void menu() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
gameStage.openMenu();
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ public abstract class GameStage extends Stage {
|
||||
}
|
||||
|
||||
public void openMenu() {
|
||||
if (Forge.restrictAdvMenus)
|
||||
if (Forge.advFreezePlayerControls)
|
||||
return;
|
||||
WorldSave.getCurrentSave().header.createPreview();
|
||||
Forge.switchScene(StartScene.instance());
|
||||
@@ -645,8 +645,10 @@ public abstract class GameStage extends Stage {
|
||||
{
|
||||
PointOfInterest poi = Current.world().findPointsOfInterest("Spawn");
|
||||
if (poi != null) {
|
||||
Forge.advFreezePlayerControls = true;
|
||||
showImageDialog(Forge.getLocalizer().getMessage("lblYouDied", Current.player().getName()), null,
|
||||
() -> FThreads.invokeInEdtNowOrLater(() -> Forge.setTransitionScreen(new TransitionScreen(() -> {
|
||||
Forge.advFreezePlayerControls = false;
|
||||
WorldStage.getInstance().setPosition(new Vector2(poi.getPosition().x - 16f, poi.getPosition().y + 16f));
|
||||
WorldStage.getInstance().loadPOI(poi);
|
||||
Forge.clearTransitionScreen();
|
||||
|
||||
@@ -1079,7 +1079,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;
|
||||
Forge.advFreezePlayerControls = true;
|
||||
player.clearCollisionHeight();
|
||||
startPause(0.8f, () -> {
|
||||
if (started)
|
||||
|
||||
@@ -122,7 +122,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;
|
||||
Forge.advFreezePlayerControls = true;
|
||||
player.clearCollisionHeight();
|
||||
startPause(0.8f, () -> {
|
||||
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
|
||||
|
||||
Reference in New Issue
Block a user