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