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;
|
package forge.game.event;
|
||||||
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.card.Card;
|
|
||||||
|
|
||||||
public class GameEventSubgameStart extends GameEvent {
|
public class GameEventSubgameStart extends GameEvent {
|
||||||
public final Game subgame;
|
public final Game subgame;
|
||||||
|
|||||||
@@ -202,6 +202,10 @@ public class Forge implements ApplicationListener {
|
|||||||
ImageCache.preloadCache(filteredkeys);
|
ImageCache.preloadCache(filteredkeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openHomeScreen() {
|
||||||
|
openScreen(HomeScreen.instance);
|
||||||
|
}
|
||||||
|
|
||||||
private void afterDbLoaded() {
|
private void afterDbLoaded() {
|
||||||
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
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
|
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music
|
||||||
destroyThis = false; //Allow back()
|
destroyThis = false; //Allow back()
|
||||||
Gdx.input.setCatchKey(Keys.MENU, true);
|
Gdx.input.setCatchKey(Keys.MENU, true);
|
||||||
openScreen(HomeScreen.instance);
|
openHomeScreen();
|
||||||
splashScreen = null;
|
splashScreen = null;
|
||||||
|
|
||||||
boolean isLandscapeMode = isLandscapeMode();
|
boolean isLandscapeMode = isLandscapeMode();
|
||||||
|
|||||||
@@ -77,14 +77,23 @@ public class ControlWinLose {
|
|||||||
|
|
||||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||||
public void actionOnQuit() {
|
public void actionOnQuit() {
|
||||||
|
boolean openHomeScreen = false;
|
||||||
// Reset other stuff
|
// Reset other stuff
|
||||||
saveOptions();
|
saveOptions();
|
||||||
try { MatchController.getHostedMatch().endCurrentGame();
|
try {
|
||||||
|
if(MatchController.getHostedMatch().subGameCount > 0) {
|
||||||
|
openHomeScreen = true;
|
||||||
|
MatchController.getHostedMatch().subGameCount--;
|
||||||
|
}
|
||||||
|
MatchController.getHostedMatch().endCurrentGame();
|
||||||
} catch (NullPointerException e) {}
|
} catch (NullPointerException e) {}
|
||||||
view.hide();
|
view.hide();
|
||||||
if(humancount == 0) {
|
if(humancount == 0) {
|
||||||
Forge.back();
|
Forge.back();
|
||||||
}
|
}
|
||||||
|
//todo Refresh the layout
|
||||||
|
if (openHomeScreen)
|
||||||
|
Forge.openHomeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -280,6 +280,21 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
|||||||
return null;
|
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
|
@Override
|
||||||
public Void visit(final GameEventZone event) {
|
public Void visit(final GameEventZone event) {
|
||||||
if (event.player != null) {
|
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
|
return true; //if not in game, card can be shown
|
||||||
}
|
}
|
||||||
if(GuiBase.getInterface().isLibgdxPort()){
|
if(GuiBase.getInterface().isLibgdxPort()){
|
||||||
if(gameView.isGameOver()) {
|
if(gameView != null && gameView.isGameOver()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(spectator!=null) { //workaround fix!! this is needed on above code or it will
|
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 MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
||||||
private final Map<PlayerControllerHuman, NextGameDecision> nextGameDecisions = Maps.newHashMap();
|
private final Map<PlayerControllerHuman, NextGameDecision> nextGameDecisions = Maps.newHashMap();
|
||||||
private boolean isMatchOver = false;
|
private boolean isMatchOver = false;
|
||||||
|
public int subGameCount = 0;
|
||||||
|
|
||||||
public HostedMatch() {}
|
public HostedMatch() {}
|
||||||
|
|
||||||
@@ -362,6 +363,7 @@ public class HostedMatch {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visit(final GameEventSubgameStart event) {
|
public Void visit(final GameEventSubgameStart event) {
|
||||||
|
subGameCount++;
|
||||||
event.subgame.subscribeToEvents(SoundSystem.instance);
|
event.subgame.subscribeToEvents(SoundSystem.instance);
|
||||||
event.subgame.subscribeToEvents(visitor);
|
event.subgame.subscribeToEvents(visitor);
|
||||||
|
|
||||||
@@ -387,6 +389,9 @@ public class HostedMatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (GuiBase.getInterface().isLibgdxPort())
|
||||||
|
GuiBase.getInterface().invokeInEdtNow(switchGameView);
|
||||||
|
else
|
||||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||||
|
|
||||||
//ensure opponents set properly
|
//ensure opponents set properly
|
||||||
@@ -419,7 +424,11 @@ public class HostedMatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (GuiBase.getInterface().isLibgdxPort())
|
||||||
|
GuiBase.getInterface().invokeInEdtNow(switchGameView);
|
||||||
|
else
|
||||||
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
GuiBase.getInterface().invokeInEdtAndWait(switchGameView);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user