mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Lots of small fixes and cleanup for the GUI refactoring.
This commit is contained in:
@@ -17,6 +17,7 @@ import forge.assets.ImageCache;
|
||||
import forge.error.BugReporter;
|
||||
import forge.error.ExceptionHandler;
|
||||
import forge.interfaces.IDeviceAdapter;
|
||||
import forge.interfaces.IGuiBase;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.properties.ForgePreferences;
|
||||
@@ -49,7 +50,7 @@ public class Forge implements ApplicationListener {
|
||||
private static SplashScreen splashScreen;
|
||||
private static KeyInputAdapter keyInputAdapter;
|
||||
private static boolean exited;
|
||||
private static final SoundSystem soundSystem = new SoundSystem(GuiBase.getInterface());
|
||||
private static SoundSystem soundSystem;
|
||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
||||
@@ -57,7 +58,9 @@ public class Forge implements ApplicationListener {
|
||||
ForgeConstants.init(assetDir0);
|
||||
clipboard = clipboard0;
|
||||
deviceAdapter = deviceAdapter0;
|
||||
GuiBase.setInterface(new GuiMobile());
|
||||
final IGuiBase gui = new GuiMobile();
|
||||
GuiBase.setInterface(gui);
|
||||
soundSystem = new SoundSystem(gui);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import forge.interfaces.IButton;
|
||||
import forge.interfaces.IGuiBase;
|
||||
import forge.item.PaperCard;
|
||||
import forge.match.input.InputQueue;
|
||||
import forge.player.LobbyPlayerHuman;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.screens.match.FControl;
|
||||
import forge.screens.match.views.VPlayerPanel;
|
||||
@@ -442,9 +443,10 @@ public class GuiMobile implements IGuiBase {
|
||||
Gdx.net.openURI(url);
|
||||
}
|
||||
|
||||
private final LobbyPlayer guiPlayer = new LobbyPlayerHuman("Human", this);
|
||||
@Override
|
||||
public LobbyPlayer getGuiPlayer() {
|
||||
return FControl.getGuiPlayer();
|
||||
return guiPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,6 @@ import forge.game.zone.ZoneType;
|
||||
import forge.match.input.InputPlaybackControl;
|
||||
import forge.match.input.InputQueue;
|
||||
import forge.model.FModel;
|
||||
import forge.player.LobbyPlayerHuman;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -79,6 +78,7 @@ import forge.view.CardView.CardStateView;
|
||||
import forge.view.CombatView;
|
||||
import forge.view.GameEntityView;
|
||||
import forge.view.IGameView;
|
||||
import forge.view.LocalGameView;
|
||||
import forge.view.PlayerView;
|
||||
|
||||
public class FControl {
|
||||
@@ -247,14 +247,14 @@ public class FControl {
|
||||
}
|
||||
|
||||
final PlayerControllerHuman humanController = (PlayerControllerHuman) localPlayer.getController();
|
||||
gameView = (IGameView) humanController;
|
||||
fcVisitor = new FControlGameEventHandler(humanController);
|
||||
playbackControl = new FControlGamePlayback(humanController);
|
||||
final LocalGameView localGameView = humanController.getGameView();
|
||||
gameView = localGameView;
|
||||
fcVisitor = new FControlGameEventHandler(GuiBase.getInterface(), localGameView);
|
||||
|
||||
for (Player p : sortedPlayers) {
|
||||
playerPanels.add(new VPlayerPanel(humanController.getPlayerView(p)));
|
||||
}
|
||||
view = new MatchScreen(gameView, humanController.getPlayerView(localPlayer), playerPanels);
|
||||
view = new MatchScreen(localGameView, humanController.getPlayerView(localPlayer), playerPanels);
|
||||
}
|
||||
|
||||
private static List<Player> shiftPlayersPlaceLocalFirst(final List<Player> players, Player localPlayer) {
|
||||
@@ -533,7 +533,9 @@ public class FControl {
|
||||
inputQueue.onGameOver(false); //release any waiting input, effectively passing priority
|
||||
}
|
||||
|
||||
playbackControl.onGameStopRequested();
|
||||
if (playbackControl != null) {
|
||||
playbackControl.onGameStopRequested();
|
||||
}
|
||||
}
|
||||
|
||||
public static void endCurrentGame() {
|
||||
@@ -852,9 +854,8 @@ public class FControl {
|
||||
return player;
|
||||
}
|
||||
|
||||
private final static LobbyPlayer guiPlayer = new LobbyPlayerHuman("Human", GuiBase.getInterface());
|
||||
public final static LobbyPlayer getGuiPlayer() {
|
||||
return guiPlayer;
|
||||
return GuiBase.getInterface().getGuiPlayer();
|
||||
}
|
||||
|
||||
public static FImage getPlayerAvatar(final PlayerView p) {
|
||||
|
||||
Reference in New Issue
Block a user