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 + "]");
         }
     }
 }
Exemplo n.º 2
0
 public void RemovePlayer()
 {
     if (base.isLocalPlayer && !m_ReadyToBegin)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("NetworkLobbyPlayer RemovePlayer");
         }
         ClientScene.RemovePlayer(GetComponent <NetworkIdentity>().playerControllerId);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 ///   <para>This removes this player from the lobby.</para>
 /// </summary>
 public void RemovePlayer()
 {
     if (!this.isLocalPlayer || this.m_ReadyToBegin)
     {
         return;
     }
     if (LogFilter.logDebug)
     {
         Debug.Log((object)"NetworkLobbyPlayer RemovePlayer");
     }
     ClientScene.RemovePlayer(this.GetComponent <NetworkIdentity>().playerControllerId);
 }
Exemplo n.º 4
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 + "]");
            }
        }
Exemplo n.º 5
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 + "]");
            }
        }
Exemplo n.º 6
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 + "]");
             }
         }
     }
 }
Exemplo n.º 7
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 + "]");
            }
        }
Exemplo n.º 8
0
        // ------------------------ optional UI ------------------------

        void OnGUI()
        {
            if (!ShowLobbyGUI)
            {
                return;
            }

            var lobby = NetworkManager.singleton as NetworkLobbyManager;

            if (lobby)
            {
                if (!lobby.showLobbyGUI)
                {
                    return;
                }

                string loadedSceneName = SceneManager.GetSceneAt(0).name;
                if (loadedSceneName != lobby.lobbyScene)
                {
                    return;
                }
            }

            Rect rec = new Rect(100 + m_Slot * 100, 200, 90, 20);

            if (isLocalPlayer)
            {
                string youStr;
                if (m_ReadyToBegin)
                {
                    youStr = "(Ready)";
                }
                else
                {
                    youStr = "(Not Ready)";
                }
                GUI.Label(rec, youStr);

                if (m_ReadyToBegin)
                {
                    rec.y += 25;
                    if (GUI.Button(rec, "STOP"))
                    {
                        SendNotReadyToBeginMessage();
                    }
                }
                else
                {
                    rec.y += 25;
                    if (GUI.Button(rec, "START"))
                    {
                        SendReadyToBeginMessage();
                    }

                    rec.y += 25;
                    if (GUI.Button(rec, "Remove"))
                    {
                        ClientScene.RemovePlayer(GetComponent <NetworkIdentity>().playerControllerId);
                    }
                }
            }
            else
            {
                GUI.Label(rec, "Player [" + netId + "]");
                rec.y += 25;
                GUI.Label(rec, "Ready [" + m_ReadyToBegin + "]");
            }
        }