Esempio n. 1
0
        public override void NetworkStart()
        {
            base.NetworkStart();

            if (!IsServer)
            {
                enabled = false;
            }
            else
            {
                m_NetPortal       = GameObject.FindGameObjectWithTag("GameNetPortal").GetComponent <GameNetPortal>();
                m_ServerNetPortal = m_NetPortal.GetComponent <ServerGameNetPortal>();

                m_NetPortal.ClientSceneChanged += OnClientSceneChanged;

                // retrieve the lobby state info so that the players we're about to spawn can query it
                var o = GameStateRelay.GetRelayObject();
                if (o != null && o.GetType() != typeof(LobbyResults))
                {
                    throw new System.Exception("No LobbyResults found!");
                }
                m_LobbyResults = (LobbyResults)o;

                DoInitialSpawnIfPossible();
            }
        }
Esempio n. 2
0
        private void SaveLobbyResults()
        {
            LobbyResults lobbyResults = new LobbyResults();

            foreach (CharSelectData.LobbyPlayerState playerInfo in CharSelectData.LobbyPlayers)
            {
                lobbyResults.Choices[playerInfo.ClientId] = new LobbyResults.CharSelectChoice(playerInfo.PlayerNum,
                                                                                              CharSelectData.LobbySeatConfigurations[playerInfo.SeatIdx].Class,
                                                                                              CharSelectData.LobbySeatConfigurations[playerInfo.SeatIdx].CharacterArtIdx);
            }
            GameStateRelay.SetRelayObject(lobbyResults);
        }