mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
added a method to launch game by a single call to FControl (removed duplicate code from controllers specific to game modes)
This commit is contained in:
@@ -38,6 +38,7 @@ import forge.Singletons;
|
||||
import forge.control.KeyboardShortcuts.Shortcut;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameType;
|
||||
import forge.game.Match;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.game.player.Player;
|
||||
import forge.gui.GuiDialog;
|
||||
@@ -401,9 +402,14 @@ public enum FControl {
|
||||
}
|
||||
|
||||
|
||||
public final void startGameWithUi(Match match) {
|
||||
attachToGame(match.createGame());
|
||||
match.startGame();
|
||||
}
|
||||
|
||||
private final FControlGameEventHandler fcVisitor = new FControlGameEventHandler(this);
|
||||
private final FControlGamePlayback playbackControl = new FControlGamePlayback(this);
|
||||
public void attachToGame(Game game0) {
|
||||
private void attachToGame(Game game0) {
|
||||
// TODO: Detach from other game we might be looking at
|
||||
|
||||
|
||||
|
||||
@@ -169,8 +169,7 @@ public class GauntletMini {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -127,8 +127,7 @@ public enum CSubmenuGauntletContests implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,8 +118,7 @@ public enum CSubmenuGauntletLoad implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -152,8 +152,7 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -444,8 +444,7 @@ public class SSubmenuQuestUtil {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
// no overlays here?
|
||||
}
|
||||
});
|
||||
|
||||
@@ -127,8 +127,7 @@ public enum CSubmenuConstructed implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -140,8 +140,7 @@ public enum CSubmenuDraft implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -238,8 +238,7 @@ public enum CSubmenuArchenemy implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -219,8 +219,7 @@ public enum CSubmenuPlanechase implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -181,8 +181,7 @@ public enum CSubmenuVanguard implements ICDoc {
|
||||
FThreads.invokeInEdtLater(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
SOverlayUtils.hideOverlay();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,8 +78,7 @@ public class ControlWinLose {
|
||||
executeAnte();
|
||||
}
|
||||
|
||||
Singletons.getControl().attachToGame(match.createGame());
|
||||
match.startGame();
|
||||
Singletons.getControl().startGameWithUi(match);
|
||||
}
|
||||
|
||||
/** Action performed when "restart" button is pressed in default win/lose UI. */
|
||||
@@ -87,8 +86,7 @@ public class ControlWinLose {
|
||||
SOverlayUtils.hideOverlay();
|
||||
saveOptions();
|
||||
match.clearGamesPlayed();
|
||||
Singletons.getControl().attachToGame(match.createGame());
|
||||
match.startGame();
|
||||
Singletons.getControl().startGameWithUi(match);
|
||||
}
|
||||
|
||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||
|
||||
@@ -206,8 +206,7 @@ public class GauntletWinLose extends ControlWinLose {
|
||||
|
||||
SOverlayUtils.hideOverlay();
|
||||
saveOptions();
|
||||
Singletons.getControl().attachToGame(mc.createGame());
|
||||
mc.startGame();
|
||||
Singletons.getControl().startGameWithUi(mc);
|
||||
} else {
|
||||
super.actionOnContinue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user