private void OnDeviceDisabled(int index)
        {
            m_connectButton.gameObject.SetActive(m_inputManager.DeviceCount > 0);

            Player player = m_playerMenu[index].Player;

            m_playerMenu[index].gameObject.SetActive(false);

            if (player != null)
            {
                IProgressIndicator progress = m_progress.GetChild(index);
                progress.IsVisible = true;

                IGameServer gameServer = Dependencies.GameServer;
                gameServer.Logoff(m_gSettings.ClientId, player.Id, (error, playerId) =>
                {
                    progress.IsVisible = false;
                    if (gameServer.HasError(error))
                    {
                        m_notification.ShowError(error);
                        return;
                    }

                    SetDisabledAsLast(index);
                    TryNavigateToMainMenu();
                });
            }
            else
            {
                SetDisabledAsLast(index);
                TryNavigateToMainMenu();
            }
        }
Пример #2
0
        private void OnDisable()
        {
            if (m_coSubscribe != null)
            {
                StopCoroutine(m_coSubscribe);
                m_coSubscribe = null;
            }

            if (m_progress != null)
            {
                IProgressIndicator progress = m_progress.GetChild(LocalPlayerIndex);
                if (progress != null)
                {
                    progress.IsVisible = false;
                }
            }

            if (m_loggedOffPanel != null)
            {
                m_loggedOffPanel.SetActive(false);
            }

            if (m_loggedInPanel != null)
            {
                m_loggedInPanel.SetActive(false);
            }

            if (m_signUpPanel != null)
            {
                m_signUpPanel.gameObject.SetActive(false);
            }

            if (m_loginPanel != null)
            {
                m_loginPanel.gameObject.SetActive(false);
            }

            if (m_goButton != null)
            {
                m_goButton.gameObject.SetActive(true);
            }

            if (m_readyButton != null)
            {
                m_readyButton.gameObject.SetActive(false);
            }

            if (m_disableButton != null)
            {
                m_disableButton.onClick.RemoveListener(OnDisableClick);
            }
            if (m_loginButton != null)
            {
                m_loginButton.onClick.RemoveListener(OnLoginClick);
            }
            if (m_signUpButton != null)
            {
                m_signUpButton.onClick.RemoveListener(OnSignupClick);
            }
            if (m_logoffButton != null)
            {
                m_logoffButton.onClick.RemoveListener(OnLogoffClick);
            }
            if (m_goButton != null)
            {
                m_goButton.onClick.RemoveListener(OnGoClick);
            }

            if (m_readyButton != null)
            {
                m_readyButton.onClick.RemoveListener(OnReadyClick);
            }
        }