示例#1
0
        public void Init(NetworkPlayer netPlayer)
        {
            Debug.LogFormat("Initializing lobby player - Ready {0}", netPlayer.ready);
            this.m_NetPlayer = netPlayer;
            if (netPlayer != null)
            {
                netPlayer.syncVarsChanged += OnNetworkPlayerSyncvarChanged;
            }

            m_NetManager = NetworkManager.s_Instance;
            if (m_NetManager != null)
            {
                m_NetManager.playerJoined += PlayerJoined;
                m_NetManager.playerLeft   += PlayerLeft;
            }

            m_ReadyLabel.gameObject.SetActive(false);
            m_WaitingLabel.gameObject.SetActive(false);
            m_ReadyButton.gameObject.SetActive(true);
            m_ReadyButton.interactable = m_NetManager.hasSufficientPlayers;

            if (m_NetManager.gameType == NetworkGameType.Singleplayer)
            {
                return;
            }

            MainMenuUI mainMenu = MainMenuUI.s_Instance;

            mainMenu.playerList.AddPlayer(this);
            mainMenu.playerList.DisplayDirectServerWarning(netPlayer.isServer && m_NetManager.matchMaker == null);

            if (netPlayer.hasAuthority)
            {
                SetupLocalPlayer();
            }
            else
            {
                SetupRemotePlayer();
            }

            UpdateValues();
        }
 //Log player leaving for tracing
 protected virtual void PlayerLeft(NetworkPlayer player)
 {
     Debug.LogFormat("Player left {0}", player.name);
 }
 //Log player joining for tracing
 protected virtual void PlayerJoined(NetworkPlayer player)
 {
     Debug.LogFormat("Player joined {0}", player.name);
 }
示例#4
0
 private void OnNetworkPlayerSyncvarChanged(NetworkPlayer player)
 {
     // Update everything
     UpdateValues();
 }
示例#5
0
 protected virtual void PlayerLeft(NetworkPlayer player)
 {
     RefreshJoinButton();
 }