mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Code cleanup
This commit is contained in:
@@ -608,12 +608,12 @@ public enum CMatchUI implements ICDoc, IMenuProvider, IMatchController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openView(List<Player> sortedPlayers, int humanCount) {
|
public void openView(List<Player> sortedPlayers) {
|
||||||
List<PlayerView> sortedPlayerViews = new ArrayList<PlayerView>();
|
List<PlayerView> sortedPlayerViews = new ArrayList<PlayerView>();
|
||||||
for (Player p : sortedPlayers) {
|
for (Player p : sortedPlayers) {
|
||||||
sortedPlayerViews.add(MatchUtil.getGameView().getPlayerView(p));
|
sortedPlayerViews.add(MatchUtil.getGameView().getPlayerView(p));
|
||||||
}
|
}
|
||||||
CMatchUI.SINGLETON_INSTANCE.initMatch(sortedPlayerViews, humanCount != 1);
|
CMatchUI.SINGLETON_INSTANCE.initMatch(sortedPlayerViews, MatchUtil.getHumanCount() != 1);
|
||||||
|
|
||||||
actuateMatchPreferences();
|
actuateMatchPreferences();
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider, IMatchController {
|
|||||||
|
|
||||||
// per player observers were set in CMatchUI.SINGLETON_INSTANCE.initMatch
|
// per player observers were set in CMatchUI.SINGLETON_INSTANCE.initMatch
|
||||||
//Set Field shown to current player.
|
//Set Field shown to current player.
|
||||||
if (humanCount > 0) {
|
if (MatchUtil.getHumanCount() > 0) {
|
||||||
final VField nextField = CMatchUI.SINGLETON_INSTANCE.getFieldViewFor(sortedPlayerViews.get(0));
|
final VField nextField = CMatchUI.SINGLETON_INSTANCE.getFieldViewFor(sortedPlayerViews.get(0));
|
||||||
SDisplayUtil.showTab(nextField);
|
SDisplayUtil.showTab(nextField);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,14 +124,15 @@ public class MatchController implements IMatchController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openView(List<Player> sortedPlayers, int humanCount) {
|
public void openView(List<Player> sortedPlayers) {
|
||||||
|
boolean noHumans = MatchUtil.getHumanCount() == 0;
|
||||||
List<VPlayerPanel> playerPanels = new ArrayList<VPlayerPanel>();
|
List<VPlayerPanel> playerPanels = new ArrayList<VPlayerPanel>();
|
||||||
for (Player p : sortedPlayers) {
|
for (Player p : sortedPlayers) {
|
||||||
playerPanels.add(new VPlayerPanel(MatchUtil.getGameView(p).getPlayerView(p), humanCount == 0 || p.getController() instanceof PlayerControllerHuman));
|
playerPanels.add(new VPlayerPanel(MatchUtil.getGameView(p).getPlayerView(p), noHumans || p.getController() instanceof PlayerControllerHuman));
|
||||||
}
|
}
|
||||||
view = new MatchScreen(playerPanels);
|
view = new MatchScreen(playerPanels);
|
||||||
|
|
||||||
if (humanCount == 0) {
|
if (noHumans) {
|
||||||
//add special object that pauses game if screen touched
|
//add special object that pauses game if screen touched
|
||||||
view.add(new FDisplayObject() {
|
view.add(new FDisplayObject() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.match.MatchUtil;
|
import forge.match.MatchUtil;
|
||||||
import forge.menu.FMenuBar;
|
import forge.menu.FMenuBar;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.LobbyPlayerHuman;
|
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.screens.FScreen;
|
import forge.screens.FScreen;
|
||||||
@@ -66,12 +65,8 @@ public class MatchScreen extends FScreen {
|
|||||||
|
|
||||||
scroller = add(new FieldScroller());
|
scroller = add(new FieldScroller());
|
||||||
|
|
||||||
int humanCount = 0;
|
|
||||||
for (VPlayerPanel playerPanel : playerPanels0) {
|
for (VPlayerPanel playerPanel : playerPanels0) {
|
||||||
playerPanels.put(playerPanel.getPlayer(), scroller.add(playerPanel));
|
playerPanels.put(playerPanel.getPlayer(), scroller.add(playerPanel));
|
||||||
if (playerPanel.getPlayer().getLobbyPlayer() instanceof LobbyPlayerHuman) {
|
|
||||||
humanCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bottomPlayerPanel = playerPanels0.get(0);
|
bottomPlayerPanel = playerPanels0.get(0);
|
||||||
topPlayerPanel = playerPanels0.get(1);
|
topPlayerPanel = playerPanels0.get(1);
|
||||||
@@ -91,7 +86,7 @@ public class MatchScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (humanCount > 1) { //show top prompt if multiple human players
|
if (MatchUtil.getHumanCount() > 1) { //show top prompt if multiple human players
|
||||||
topPlayerPrompt = add(new VPrompt("", "",
|
topPlayerPrompt = add(new VPrompt("", "",
|
||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import forge.view.SpellAbilityView;
|
|||||||
public interface IMatchController {
|
public interface IMatchController {
|
||||||
void startNewMatch(Match match);
|
void startNewMatch(Match match);
|
||||||
boolean resetForNewGame();
|
boolean resetForNewGame();
|
||||||
void openView(List<Player> sortedPlayers, int humanCount);
|
void openView(List<Player> sortedPlayers);
|
||||||
void afterGameEnd();
|
void afterGameEnd();
|
||||||
void showCombat(CombatView combat);
|
void showCombat(CombatView combat);
|
||||||
void showPromptMessage(PlayerView playerView, String message);
|
void showPromptMessage(PlayerView playerView, String message);
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class MatchUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.openView(sortedPlayers, humanCount);
|
controller.openView(sortedPlayers);
|
||||||
|
|
||||||
if (humanCount == 0) {
|
if (humanCount == 0) {
|
||||||
playbackControl = new FControlGamePlayback(GuiBase.getInterface(), getGameView());
|
playbackControl = new FControlGamePlayback(GuiBase.getInterface(), getGameView());
|
||||||
|
|||||||
Reference in New Issue
Block a user