public void CmdShutdown()
    {
        // Validacion: solo para ADMINs
        if (!player.isAdministrator)
        {
            return;
        }

        NetworkManagerFV.Quit();
    }
Exemple #2
0
    void Update()
    {
        if (manager.state == NetworkState.Offline || manager.state == NetworkState.Handshake)
        {
            panel.SetActive(true);

            // status
            if (manager.IsConnecting())
            {
                statusText.text = "Connecting...";
            }
            else if (manager.state == NetworkState.Handshake)
            {
                statusText.text = "Handshake...";
            }
            else
            {
                statusText.text = "";
            }

            registerButton.interactable = !manager.isNetworkActive;
            registerButton.onClick.SetListener(() => { uiPopup.Show(registerMessage); });
            loginButton.interactable = !manager.isNetworkActive && auth.IsAllowedAccountName(accountInput.text);
            loginButton.onClick.SetListener(() => { manager.StartClient(); });
            hostButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive && auth.IsAllowedAccountName(accountInput.text);
            hostButton.onClick.SetListener(() => {
                Debug.Log("hostButton fue presionado antes del statrHost");
                manager.StartHost();
                Debug.Log("hostButton fue presionado despues del statrHost");
            });
            cancelButton.gameObject.SetActive(manager.IsConnecting());
            cancelButton.onClick.SetListener(() => { manager.StopClient(); });
            dedicatedButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive;
            dedicatedButton.onClick.SetListener(() => {
                Debug.Log("dedicateButton fue presionado antes del startServer");
                manager.StartServer();
                Debug.Log("dedicatebutton fue presionado despues del startServer");
            });
            quitButton.onClick.SetListener(() => { NetworkManagerFV.Quit(); });

            auth.loginAccount  = accountInput.text;
            auth.loginPassword = passwordInput.text;

            serverDropdown.interactable = !manager.isNetworkActive;
            serverDropdown.options      = manager.serverList.Select(
                sv => new Dropdown.OptionData(sv.name)
                ).ToList();
            manager.networkAddress = manager.serverList[serverDropdown.value].ip;
        }
        else
        {
            panel.SetActive(false);
        }
    }
Exemple #3
0
    void Update()
    {
        if (manager.state == NetworkState.Lobby && !uiCharacterCreation.IsVisible())
        {
            panel.SetActive(true);

            if (manager.charactersAvailableMsg != null)
            {
                CharactersAvailableMsg.CharacterPreview[] characters = manager.charactersAvailableMsg.characters;

                startButton.gameObject.SetActive(manager.selection != -1);
                startButton.onClick.SetListener(() => {
                    ClientScene.Ready(NetworkClient.connection);

                    NetworkClient.connection.Send(new CharacterSelectMsg {
                        index = manager.selection
                    });

                    manager.ClearPreviews();

                    panel.SetActive(false);
                });

                deleteButton.gameObject.SetActive(manager.selection != -1);
                deleteButton.onClick.SetListener(() => {
                    uiConfirmation.Show(
                        "Realmente desea borrar  <b>" + characters[manager.selection].name + "</b>?",
                        () => { NetworkClient.Send(new CharacterDeleteMsg {
                            index = manager.selection
                        }); }
                        );
                });

                createButton.interactable = characters.Length < manager.characterLimit;
                createButton.onClick.SetListener(() => {
                    panel.SetActive(false);
                    uiCharacterCreation.Show();
                });

                quitButton.onClick.SetListener(() => { NetworkManagerFV.Quit(); });
            }
        }
        else
        {
            panel.SetActive(false);
        }
    }