public void receiveCommandList(CommandList ls) { turnCommands.addCommands(ls.getCommands()); commandsReceived++; System.out.println(commandsReceived + " " + myInfo.getPlayers().size()); if (commandsReceived >= myInfo.getPlayers().size()) { this.processCommands(); if (!unitsPlaced) { unitsPlaced = true; this.start(); } } }
public void addPlayer(ServerPlayer p) { if (myInfo.addPlayer(p) && !inProgress) { myGame = new GameState(myInfo.getPlayers()); myModel = new GameModel(myGame, this); this.updateGame(myGame); this.updateGame(new PromptUnits()); inProgress = true; } else if (inProgress) { this.updateGame(); } }
public ServerGame(GameInfo info, GameState game, ObjectServer os) { myInfo = info; myInfo.getPlayers().clear(); myGame = game; myServer = os; myModel = new GameModel(myGame, this); if (!myInfo.getOriginalPlayers().isEmpty()) { unitsPlaced = true; inProgress = true; this.start(); } }