mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
[Mobile] add Shahrazad support
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package forge.game.event;
|
||||
|
||||
import forge.game.Game;
|
||||
import forge.game.card.Card;
|
||||
|
||||
public class GameEventSubgameStart extends GameEvent {
|
||||
public final Game subgame;
|
||||
|
||||
@@ -202,6 +202,10 @@ public class Forge implements ApplicationListener {
|
||||
ImageCache.preloadCache(filteredkeys);
|
||||
}
|
||||
|
||||
public static void openHomeScreen() {
|
||||
openScreen(HomeScreen.instance);
|
||||
}
|
||||
|
||||
private void afterDbLoaded() {
|
||||
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
||||
|
||||
@@ -210,7 +214,7 @@ public class Forge implements ApplicationListener {
|
||||
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music
|
||||
destroyThis = false; //Allow back()
|
||||
Gdx.input.setCatchKey(Keys.MENU, true);
|
||||
openScreen(HomeScreen.instance);
|
||||
openHomeScreen();
|
||||
splashScreen = null;
|
||||
|
||||
boolean isLandscapeMode = isLandscapeMode();
|
||||
|
||||
@@ -77,14 +77,23 @@ public class ControlWinLose {
|
||||
|
||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||
public void actionOnQuit() {
|
||||
boolean openHomeScreen = false;
|
||||
// Reset other stuff
|
||||
saveOptions();
|
||||
try { MatchController.getHostedMatch().endCurrentGame();
|
||||
try {
|
||||
if(MatchController.getHostedMatch().subGameCount > 0) {
|
||||
openHomeScreen = true;
|
||||
MatchController.getHostedMatch().subGameCount--;
|
||||
}
|
||||
MatchController.getHostedMatch().endCurrentGame();
|
||||
} catch (NullPointerException e) {}
|
||||
view.hide();
|
||||
if(humancount == 0) {
|
||||
Forge.back();
|
||||
}
|
||||
//todo Refresh the layout
|
||||
if (openHomeScreen)
|
||||
Forge.openHomeScreen();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,6 +280,21 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visit(final GameEventSubgameEnd event) {
|
||||
if (event.maingame != null) {
|
||||
for (Player p : event.maingame.getPlayers()) {
|
||||
updateZone(p, ZoneType.Battlefield);
|
||||
updateZone(p, ZoneType.Hand);
|
||||
updateZone(p, ZoneType.Graveyard);
|
||||
updateZone(p, ZoneType.Exile);
|
||||
updateZone(p, ZoneType.Command);
|
||||
}
|
||||
return processEvent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visit(final GameEventZone event) {
|
||||
if (event.player != null) {
|
||||
|
||||
@@ -185,7 +185,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
return true; //if not in game, card can be shown
|
||||
}
|
||||
if(GuiBase.getInterface().isLibgdxPort()){
|
||||
if(gameView.isGameOver()) {
|
||||
if(gameView != null && gameView.isGameOver()) {
|
||||
return true;
|
||||
}
|
||||
if(spectator!=null) { //workaround fix!! this is needed on above code or it will
|
||||
|
||||
@@ -69,6 +69,7 @@ public class HostedMatch {
|
||||
private final MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
||||
private final Map<PlayerControllerHuman, NextGameDecision> nextGameDecisions = Maps.newHashMap();
|
||||
private boolean isMatchOver = false;
|
||||
public int subGameCount = 0;
|
||||
|
||||
public HostedMatch() {}
|
||||
|
||||
@@ -362,6 +363,7 @@ public class HostedMatch {
|
||||
|
||||
@Override
|
||||
public Void visit(final GameEventSubgameStart event) {
|
||||
subGameCount++;
|
||||
event.subgame.subscribeToEvents(SoundSystem.instance);
|
||||
event.subgame.subscribeToEvents(visitor);
|
||||
|
||||
@@ -387,7 +389,10 @@ public class HostedMatch {
|
||||
}
|
||||
}
|
||||
};
|
||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||
if (GuiBase.getInterface().isLibgdxPort())
|
||||
GuiBase.getInterface().invokeInEdtNow(switchGameView);
|
||||
else
|
||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||
|
||||
//ensure opponents set properly
|
||||
for (final Player p : event.subgame.getPlayers()) {
|
||||
@@ -419,7 +424,11 @@ public class HostedMatch {
|
||||
}
|
||||
}
|
||||
};
|
||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||
if (GuiBase.getInterface().isLibgdxPort())
|
||||
GuiBase.getInterface().invokeInEdtNow(switchGameView);
|
||||
else
|
||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user