private void OnGUI()
 {
     if (this.ShowLobbyGUI)
     {
         NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;
         if (networkLobbyManager)
         {
             if (!networkLobbyManager.showLobbyGUI)
             {
                 return;
             }
             string name = SceneManager.GetSceneAt(0).name;
             if (name != networkLobbyManager.lobbyScene)
             {
                 return;
             }
         }
         Rect position = new Rect((float)(100 + this.m_Slot * 100), 200f, 90f, 20f);
         if (base.isLocalPlayer)
         {
             string text;
             if (this.m_ReadyToBegin)
             {
                 text = "(Ready)";
             }
             else
             {
                 text = "(Not Ready)";
             }
             GUI.Label(position, text);
             if (this.m_ReadyToBegin)
             {
                 position.y += 25f;
                 if (GUI.Button(position, "STOP"))
                 {
                     this.SendNotReadyToBeginMessage();
                 }
             }
             else
             {
                 position.y += 25f;
                 if (GUI.Button(position, "START"))
                 {
                     this.SendReadyToBeginMessage();
                 }
                 position.y += 25f;
                 if (GUI.Button(position, "Remove"))
                 {
                     ClientScene.RemovePlayer(base.GetComponent <NetworkIdentity>().playerControllerId);
                 }
             }
         }
         else
         {
             GUI.Label(position, "Player [" + base.netId + "]");
             position.y += 25f;
             GUI.Label(position, "Ready [" + this.m_ReadyToBegin + "]");
         }
     }
 }
Пример #2
0
        public void CheckReadyToBegin()
        {
            string name = SceneManager.GetSceneAt(0).name;

            if (!(name != this.m_LobbyScene))
            {
                int num  = 0;
                int num2 = 0;
                for (int i = 0; i < NetworkServer.connections.Count; i++)
                {
                    NetworkConnection networkConnection = NetworkServer.connections[i];
                    if (networkConnection != null)
                    {
                        num2++;
                        num += NetworkLobbyManager.CheckConnectionIsReadyToBegin(networkConnection);
                    }
                }
                if (this.m_MinPlayers <= 0 || num >= this.m_MinPlayers)
                {
                    if (num >= num2)
                    {
                        this.m_PendingPlayers.Clear();
                        this.OnLobbyServerPlayersReady();
                    }
                }
            }
        }
Пример #3
0
 void StartupCall()
 {
     if (networkLobbyManager == null)
     {
         networkLobbyManager = GetComponent <NetworkLobbyManager> ();
     }
     if (SceneManager.GetActiveScene().name == "Garage")
     {
         garageObjects.SetActive(true);
         if (garageManager == null)
         {
             garageManager = GameObject.Find("Garage Manager").GetComponent <RG_GarageManager> ();
         }
         lobbyHUDReference.matchmakingWindow.SetActive(false);
         lobbyHUDReference.matchmakingImage.SetActive(false);
         lobbyHUDReference.findMatchWindow.SetActive(false);
         lobbyHUDReference.disconnectButton.SetActive(false);
         lobbyHUDReference.backButtonFindGames.SetActive(true);
         UpdateGameType();
         UpdateGameSize();
     }
     if (SceneManager.GetActiveScene().name != "Garage")
     {
         garageObjects.SetActive(false);
         loadingMultiplayerScene = false;
         lobbyHUDReference.disconnectButton.SetActive(true);
         lobbyHUDReference.startGameButton.SetActive(false);
         lobbyHUDReference.lobbyWindow.SetActive(false);
     }
 }
Пример #4
0
        private void OnLevelWasLoaded()
        {
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((!networkLobbyManager || !(Application.loadedLevelName == networkLobbyManager.lobbyScene)) && base.isLocalPlayer)
            {
                SendSceneLoadedMessage();
            }
        }
Пример #5
0
        private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (((singleton == null) || (scene.name != singleton.lobbyScene)) && base.isLocalPlayer)
            {
                this.SendSceneLoadedMessage();
            }
        }
Пример #6
0
        private void OnLevelWasLoaded()
        {
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (((singleton == null) || (Application.loadedLevelName != singleton.lobbyScene)) && base.isLocalPlayer)
            {
                this.SendSceneLoadedMessage();
            }
        }
Пример #7
0
        private void OnLevelWasLoaded()
        {
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)((Object)singleton) && SceneManager.GetSceneAt(0).name == singleton.lobbyScene || !this.isLocalPlayer)
            {
                return;
            }
            this.SendSceneLoadedMessage();
        }
Пример #8
0
        private void OnGUI()
        {
            if (!this.ShowLobbyGUI)
            {
                return;
            }
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if (networkLobbyManager)
            {
                if (!networkLobbyManager.showLobbyGUI)
                {
                    return;
                }
                if (Application.loadedLevelName != networkLobbyManager.lobbyScene)
                {
                    return;
                }
            }
            Rect position = new Rect((float)(100 + this.m_Slot * 100), 200f, 90f, 20f);

            if (base.isLocalPlayer)
            {
                GUI.Label(position, " [ You ]");
                if (this.m_ReadyToBegin)
                {
                    position.y += 25f;
                    if (GUI.Button(position, "Ready"))
                    {
                        this.SendNotReadyToBeginMessage();
                    }
                }
                else
                {
                    position.y += 25f;
                    if (GUI.Button(position, "Not Ready"))
                    {
                        this.SendReadyToBeginMessage();
                    }
                    position.y += 25f;
                    if (GUI.Button(position, "Remove"))
                    {
                        ClientScene.RemovePlayer(base.GetComponent <NetworkIdentity>().playerControllerId);
                    }
                }
            }
            else
            {
                GUI.Label(position, "Player [" + base.netId + "]");
                position.y += 25f;
                GUI.Label(position, "Ready [" + this.m_ReadyToBegin + "]");
            }
        }
Пример #9
0
        private void OnGUI()
        {
            if (!ShowLobbyGUI)
            {
                return;
            }
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)networkLobbyManager)
            {
                if (!networkLobbyManager.showLobbyGUI)
                {
                    return;
                }
                string name = SceneManager.GetSceneAt(0).name;
                if (name != networkLobbyManager.lobbyScene)
                {
                    return;
                }
            }
            Rect position = new Rect(100 + m_Slot * 100, 200f, 90f, 20f);

            if (base.isLocalPlayer)
            {
                GUI.Label(text: (!m_ReadyToBegin) ? "(Not Ready)" : "(Ready)", position: position);
                if (m_ReadyToBegin)
                {
                    position.y += 25f;
                    if (GUI.Button(position, "STOP"))
                    {
                        SendNotReadyToBeginMessage();
                    }
                    return;
                }
                position.y += 25f;
                if (GUI.Button(position, "START"))
                {
                    SendReadyToBeginMessage();
                }
                position.y += 25f;
                if (GUI.Button(position, "Remove"))
                {
                    ClientScene.RemovePlayer(GetComponent <NetworkIdentity>().playerControllerId);
                }
            }
            else
            {
                GUI.Label(position, "Player [" + base.netId + "]");
                position.y += 25f;
                GUI.Label(position, "Ready [" + m_ReadyToBegin + "]");
            }
        }
Пример #10
0
        private void OnLevelWasLoaded()
        {
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if (networkLobbyManager && Application.loadedLevelName == networkLobbyManager.lobbyScene)
            {
                return;
            }
            if (base.isLocalPlayer)
            {
                this.SendSceneLoadedMessage();
            }
        }
Пример #11
0
 private void OnGUI()
 {
     if (this.ShowLobbyGUI)
     {
         NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;
         if ((singleton == null) || (singleton.showLobbyGUI && (SceneManager.GetSceneAt(0).name == singleton.lobbyScene)))
         {
             Rect position = new Rect((float)(100 + (this.m_Slot * 100)), 200f, 90f, 20f);
             if (base.isLocalPlayer)
             {
                 string str2;
                 if (this.m_ReadyToBegin)
                 {
                     str2 = "(Ready)";
                 }
                 else
                 {
                     str2 = "(Not Ready)";
                 }
                 GUI.Label(position, str2);
                 if (this.m_ReadyToBegin)
                 {
                     position.y += 25f;
                     if (GUI.Button(position, "STOP"))
                     {
                         this.SendNotReadyToBeginMessage();
                     }
                 }
                 else
                 {
                     position.y += 25f;
                     if (GUI.Button(position, "START"))
                     {
                         this.SendReadyToBeginMessage();
                     }
                     position.y += 25f;
                     if (GUI.Button(position, "Remove"))
                     {
                         ClientScene.RemovePlayer(base.GetComponent <NetworkIdentity>().playerControllerId);
                     }
                 }
             }
             else
             {
                 GUI.Label(position, "Player [" + base.netId + "]");
                 position.y += 25f;
                 GUI.Label(position, "Ready [" + this.m_ReadyToBegin + "]");
             }
         }
     }
 }
Пример #12
0
        public void SendSceneLoadedMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkLobbyPlayer SendSceneLoadedMessage");
            }
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)networkLobbyManager)
            {
                IntegerMessage msg = new IntegerMessage(base.playerControllerId);
                networkLobbyManager.client.Send(44, msg);
            }
        }
Пример #13
0
        public void SendSceneLoadedMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkLobbyPlayer SendSceneLoadedMessage");
            }
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (singleton != null)
            {
                IntegerMessage msg = new IntegerMessage(base.playerControllerId);
                singleton.client.Send(0x2c, msg);
            }
        }
Пример #14
0
        private void OnGUI()
        {
            if (!this.ShowLobbyGUI)
            {
                return;
            }
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)((Object)singleton) && (!singleton.showLobbyGUI || SceneManager.GetSceneAt(0).name != singleton.lobbyScene))
            {
                return;
            }
            Rect position = new Rect((float)(100 + (int)this.m_Slot * 100), 200f, 90f, 20f);

            if (this.isLocalPlayer)
            {
                string text = !this.m_ReadyToBegin ? "(Not Ready)" : "(Ready)";
                GUI.Label(position, text);
                if (this.m_ReadyToBegin)
                {
                    position.y += 25f;
                    if (!GUI.Button(position, "STOP"))
                    {
                        return;
                    }
                    this.SendNotReadyToBeginMessage();
                }
                else
                {
                    position.y += 25f;
                    if (GUI.Button(position, "START"))
                    {
                        this.SendReadyToBeginMessage();
                    }
                    position.y += 25f;
                    if (!GUI.Button(position, "Remove"))
                    {
                        return;
                    }
                    ClientScene.RemovePlayer(this.GetComponent <NetworkIdentity>().playerControllerId);
                }
            }
            else
            {
                GUI.Label(position, "Player [" + (object)this.netId + "]");
                position.y += 25f;
                GUI.Label(position, "Ready [" + (object)this.m_ReadyToBegin + "]");
            }
        }
Пример #15
0
        public override void OnStartClient()
        {
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)networkLobbyManager)
            {
                networkLobbyManager.lobbySlots[m_Slot] = this;
                m_ReadyToBegin = false;
                OnClientEnterLobby();
            }
            else
            {
                Debug.LogError("No Lobby for LobbyPlayer");
            }
        }
Пример #16
0
        public override void OnStartClient()
        {
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)((Object)singleton))
            {
                singleton.lobbySlots[(int)this.m_Slot] = this;
                this.m_ReadyToBegin = false;
                this.OnClientEnterLobby();
            }
            else
            {
                Debug.LogError((object)"LobbyPlayer could not find a NetworkLobbyManager. The LobbyPlayer requires a NetworkLobbyManager object to function. Make sure that there is one in the scene.");
            }
        }
Пример #17
0
        public override void OnStartClient()
        {
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (singleton != null)
            {
                singleton.lobbySlots[this.m_Slot] = this;
                this.m_ReadyToBegin = false;
                this.OnClientEnterLobby();
            }
            else
            {
                Debug.LogError("No Lobby for LobbyPlayer");
            }
        }
Пример #18
0
        /// <summary>
        ///   <para>This is used on clients to tell the server that the client has switched from the lobby to the GameScene and is ready to play.</para>
        /// </summary>
        public void SendSceneLoadedMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log((object)"NetworkLobbyPlayer SendSceneLoadedMessage");
            }
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (!(bool)((Object)singleton))
            {
                return;
            }
            IntegerMessage integerMessage = new IntegerMessage((int)this.playerControllerId);

            singleton.client.Send((short)44, (MessageBase)integerMessage);
        }
Пример #19
0
        public void SendNotReadyToBeginMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkLobbyPlayer SendReadyToBeginMessage");
            }
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)networkLobbyManager)
            {
                LobbyReadyToBeginMessage lobbyReadyToBeginMessage = new LobbyReadyToBeginMessage();
                lobbyReadyToBeginMessage.slotId     = (byte)base.playerControllerId;
                lobbyReadyToBeginMessage.readyState = false;
                networkLobbyManager.client.Send(43, lobbyReadyToBeginMessage);
            }
        }
Пример #20
0
        private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            NetworkLobbyManager networkLobbyManager = NetworkManager.singleton as NetworkLobbyManager;

            if ((bool)networkLobbyManager)
            {
                string name = scene.name;
                if (name == networkLobbyManager.lobbyScene)
                {
                    return;
                }
            }
            if (base.isLocalPlayer)
            {
                SendSceneLoadedMessage();
            }
        }
Пример #21
0
        public void SendReadyToBeginMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkLobbyPlayer SendReadyToBeginMessage");
            }
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (singleton != null)
            {
                LobbyReadyToBeginMessage msg = new LobbyReadyToBeginMessage {
                    slotId     = (byte)base.playerControllerId,
                    readyState = true
                };
                singleton.client.Send(0x2b, msg);
            }
        }
Пример #22
0
        /// <summary>
        ///   <para>This is used on clients to tell the server that this player is ready for the game to begin.</para>
        /// </summary>
        public void SendReadyToBeginMessage()
        {
            if (LogFilter.logDebug)
            {
                Debug.Log((object)"NetworkLobbyPlayer SendReadyToBeginMessage");
            }
            NetworkLobbyManager singleton = NetworkManager.singleton as NetworkLobbyManager;

            if (!(bool)((Object)singleton))
            {
                return;
            }
            singleton.client.Send((short)43, (MessageBase) new LobbyReadyToBeginMessage()
            {
                slotId     = (byte)this.playerControllerId,
                readyState = true
            });
        }
        /// <summary>
        ///   <para>CheckReadyToBegin checks all of the players in the lobby to see if their readyToBegin flag is set.</para>
        /// </summary>
        public void CheckReadyToBegin()
        {
            if (SceneManager.GetSceneAt(0).name != this.m_LobbyScene)
            {
                return;
            }
            int num = 0;

            foreach (NetworkConnection connection in NetworkServer.connections)
            {
                if (connection != null)
                {
                    num += NetworkLobbyManager.CheckConnectionIsReadyToBegin(connection);
                }
            }
            if (this.m_MinPlayers > 0 && num < this.m_MinPlayers)
            {
                return;
            }
            this.m_PendingPlayers.Clear();
            this.OnLobbyServerPlayersReady();
        }
Пример #24
0
        public void CheckReadyToBegin()
        {
            if (Application.loadedLevelName != this.m_LobbyScene)
            {
                return;
            }
            int num = 0;

            foreach (NetworkConnection current in NetworkServer.connections)
            {
                if (current != null)
                {
                    if (!NetworkLobbyManager.CheckConnectionIsReadyToBegin(current))
                    {
                        return;
                    }
                    num++;
                }
            }
            foreach (NetworkConnection current2 in NetworkServer.localConnections)
            {
                if (current2 != null)
                {
                    if (!NetworkLobbyManager.CheckConnectionIsReadyToBegin(current2))
                    {
                        return;
                    }
                    num++;
                }
            }
            if (this.m_MinPlayers > 0 && num < this.m_MinPlayers)
            {
                return;
            }
            this.m_PendingPlayers.Clear();
            this.OnLobbyServerPlayersReady();
        }
 private void SetPlayScene(NetworkLobbyManager lobby, string sceneName)
 {
     base.serializedObject.FindProperty("m_PlayScene").stringValue = sceneName;
     base.serializedObject.FindProperty("m_OnlineScene").stringValue = "";
     EditorUtility.SetDirty(lobby);
 }