void OnPlayersListUpdate(List <PlayerInfo> players) { Debug.Log("ListOfPlayers " + players.Count.ToString()); ClearList(); bool allPlayersReady = true; foreach (PlayerInfo player in players) { PlayerListView playerView = GameObject.Instantiate <PlayerListView>(playerListViewPrefab, content); playerView.Init(this, player.number, player.name, player.isLocal, player.isReady); if (!player.isReady) { allPlayersReady = false; } allPlayers.Add(player.number, playerView); } roomInfoView.Init(NetworkLobbyHelper.GetCurrentRoomInfo()); if (allPlayersReady) { //All players ready - start game! lobbyView.OnStartGameButtonClicked(); } }
private void OnPlayersListUpdate(List <PlayerInfo> players) { OMSRoomInfo roomInfo = NetworkLobbyHelper.GetCurrentRoomInfo(); if (roomInfo.currentPlayers == roomInfo.maximumPlayers) { //Start the game automatically when all players are ready StartGame(); } }
private void StartGame() { OMSRoomInfo roomInfo = NetworkLobbyHelper.GetCurrentRoomInfo(); NetworkLobbyHelper.StartGame(roomInfo.scenarioName); }