Esempio n. 1
0
        // Use this for initialization
        void Start()
        {
            LoadingModal modal = LoadingModal.s_Instance;

            if (modal != null)
            {
                modal.FadeOut();
            }

            if (m_QuitButton != null)
            {
                m_QuitButton.SetActive(true);
            }
            else
            {
                Debug.LogError("Missing quitButton from MainMenuUI");
            }

            //Used to return to correct page on return to menu
            switch (s_ReturnPage)
            {
            case MenuPage.Home:
            default:
                ShowDefaultPanel();
                break;

            case MenuPage.Lobby:
                ShowLobbyPanel();
                break;
            }
        }
Esempio n. 2
0
        // Update is called once per frame
        void Update()
        {
            if (m_ReadyToFireTask)
            {
                bool canFire = false;

                LoadingModal modal = LoadingModal.s_Instance;
                if (modal != null && modal.readyToTransition)
                {
                    modal.FadeOut();
                    canFire = true;
                }
                else if (modal == null)
                {
                    canFire = true;
                }

                if (canFire)
                {
                    if (m_WaitTask != null)
                    {
                        m_WaitTask();
                        m_WaitTask = null;
                    }

                    m_ReadyToFireTask = false;
                }
            }
        }
Esempio n. 3
0
        /// Wait for network to disconnect before performing an action
        public void DoIfNetworkReady(Action task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            NetworkManager netManager = NetworkManager.s_Instance;

            if (netManager.isNetworkActive)
            {
                m_WaitTask = task;

                LoadingModal modal = LoadingModal.s_Instance;
                if (modal != null)
                {
                    modal.FadeIn();
                }

                m_ReadyToFireTask         = false;
                netManager.clientStopped += OnClientStopped;
            }
            else
            {
                task();
            }
        }