} //Only used in tournament so quick solve a bug when changing slots public PreGame(IPeer admin, PreGameSpecs specs, AlbotSpectatorModule specModule) { this.specs = specs; this.admin = admin; this.specModule = specModule; initPlayerslots(specs.maxPlayers); storedInfoMsg = new RunningGameInfoMsg() { status = PreGameState.Lobby }; }
private void addIconNumbersToInfoMsg(RunningGameInfoMsg infoMsg) { for (int i = 0; i < infoMsg.players.Length; i++) { infoMsg.players[i].iconNumber = playerSlots.First(p => p.info.playerInfo.username == infoMsg.players[i].username).info.playerInfo.iconNumber; } storedInfoMsg = infoMsg; storedInfoMsg.status = state; }
public void onGameStarted(RunningGameInfoMsg infoMsg, IIncommingMessage rawMsg) { updateState(PreGameState.Running); currentRound++; addIconNumbersToInfoMsg(infoMsg); specModule.preGameStarted(this, storedInfoMsg); runningGameConnection = rawMsg.Peer; resetPlayerReady(); runOnGameStartedFuncs(); }
private void handleRunningGamesInfoMsg(IIncommingMessage rawMsg) { RunningGameInfoMsg infoMsg = rawMsg.Deserialize <RunningGameInfoMsg>(); if (activeGames.ContainsKey(infoMsg.gameID) == false) { Debug.LogError("Game " + infoMsg.gameID + " started, but no such game was located in ActiveGames"); } else { activeGames[infoMsg.gameID].onGameStarted(infoMsg, rawMsg); } }