mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Support showing hidden cards if in developer mode
This commit is contained in:
@@ -99,15 +99,17 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
public static void openScreen(FScreen screen0) {
|
public static void openScreen(FScreen screen0) {
|
||||||
if (currentScreen == screen0) { return; }
|
if (currentScreen == screen0) { return; }
|
||||||
|
if (currentScreen != null && !currentScreen.onSwitchAway()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
screens.push(screen0);
|
screens.push(screen0);
|
||||||
setCurrentScreen(screen0);
|
setCurrentScreen(screen0);
|
||||||
screen0.onOpen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setCurrentScreen(FScreen screen0) {
|
private static void setCurrentScreen(FScreen screen0) {
|
||||||
currentScreen = screen0;
|
currentScreen = screen0;
|
||||||
currentScreen.setSize(screenWidth, screenHeight);
|
currentScreen.setSize(screenWidth, screenHeight);
|
||||||
currentScreen.onOpen();
|
currentScreen.onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ public abstract class FScreen extends FContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpen() {
|
public void onActivate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onSwitch() {
|
public boolean onSwitchAway() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class FControl {
|
|||||||
private static List<Player> sortedPlayers;
|
private static List<Player> sortedPlayers;
|
||||||
private static final EventBus uiEvents;
|
private static final EventBus uiEvents;
|
||||||
private static boolean gameHasHumanPlayer;
|
private static boolean gameHasHumanPlayer;
|
||||||
|
private static boolean devMode;
|
||||||
private static final MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
private static final MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
||||||
private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler();
|
private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler();
|
||||||
private static final FControlGamePlayback playbackControl = new FControlGamePlayback();
|
private static final FControlGamePlayback playbackControl = new FControlGamePlayback();
|
||||||
@@ -164,7 +165,13 @@ public class FControl {
|
|||||||
playerPanels.add(new VPlayerPanel(p, localPlayer));
|
playerPanels.add(new VPlayerPanel(p, localPlayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
view = new MatchScreen(playerPanels);
|
view = new MatchScreen(playerPanels) {
|
||||||
|
@Override
|
||||||
|
public void onActivate() {
|
||||||
|
devMode = FModel.getPreferences().getPrefBoolean(FPref.DEV_MODE_ENABLED); //cache devMode for performance when match screen opened
|
||||||
|
super.onActivate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
view.getGameDetails().init(players);
|
view.getGameDetails().init(players);
|
||||||
}
|
}
|
||||||
@@ -241,7 +248,7 @@ public class FControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean mayShowCard(Card c) {
|
public static boolean mayShowCard(Card c) {
|
||||||
return game == null || !gameHasHumanPlayer || c.canBeShownTo(getCurrentPlayer());
|
return game == null || !gameHasHumanPlayer || devMode || c.canBeShownTo(getCurrentPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showCombat(Combat combat) {
|
public static void showCombat(Combat combat) {
|
||||||
|
|||||||
Reference in New Issue
Block a user