Exemplo n.º 1
0
        public void CmdChangeReadyState(bool ReadyState)
        {
            ReadyToBegin = ReadyState;
            NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;

            lobby?.ReadyStatusChanged();
        }
Exemplo n.º 2
0
        public void CmdChangeReadyState(bool readyState)
        {
            readyToBegin = readyState;
            NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;

            if (lobby != null)
            {
                lobby.ReadyStatusChanged();
            }
        }
Exemplo n.º 3
0
        public virtual void ClientLoadedScene(Scene arg0, LoadSceneMode arg1)
        {
            NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;

            if (lobby != null && SceneManager.GetActiveScene().name == lobby.LobbyScene)
            {
                return;
            }

            if (this != null && isLocalPlayer)
            {
                CmdSendLevelLoaded();
            }
        }
Exemplo n.º 4
0
        public virtual void OnGUI()
        {
            if (!ShowLobbyGUI)
            {
                return;
            }

            NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;

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

                if (SceneManager.GetActiveScene().name != lobby.LobbyScene)
                {
                    return;
                }

                GUILayout.BeginArea(new Rect(20f + (Index * 100), 200f, 90f, 130f));

                GUILayout.Label($"Player [{Index + 1}]");

                if (ReadyToBegin)
                {
                    GUILayout.Label("Ready");
                }
                else
                {
                    GUILayout.Label("Not Ready");
                }

                if (((isServer && Index > 0) || isServerOnly) && GUILayout.Button("REMOVE"))
                {
                    // This button only shows on the Host for all players other than the Host
                    // Host and Players can't remove themselves (stop the client instead)
                    // Host can kick a Player this way.
                    GetComponent <NetworkIdentity>().connectionToClient.Disconnect();
                }

                GUILayout.EndArea();

                if (NetworkClient.active && isLocalPlayer)
                {
                    GUILayout.BeginArea(new Rect(20f, 300f, 120f, 20f));

                    if (ReadyToBegin)
                    {
                        if (GUILayout.Button("Cancel"))
                        {
                            CmdChangeReadyState(false);
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Ready"))
                        {
                            CmdChangeReadyState(true);
                        }
                    }

                    GUILayout.EndArea();
                }
            }
        }
Exemplo n.º 5
0
        public void CmdSendLevelLoaded()
        {
            NetworkLobbyManager lobby = NetworkManager.singleton as NetworkLobbyManager;

            lobby?.PlayerLoadedScene(GetComponent <NetworkIdentity>().connectionToClient);
        }