Example #1
0
        //public LobbyPlayerList playerList
        //{
        //	get
        //	{
        //		return m_PlayerList;
        //	}
        //}


        #region Methods

        protected virtual 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;
                }
            }
        }
Example #2
0
        //public void ShowTankSelectModal(TanksNetworkPlayer player)
        //{
        //	if (m_CustomiseModal != null)
        //	{
        //		m_CustomiseModal.Open(player);
        //	}
        //}

        /// <summary>
        /// Shows the info popup with a callback
        /// </summary>
        /// <param name="label">Label.</param>
        /// <param name="callback">Callback.</param>
        //public void ShowInfoPopup(string label, UnityAction callback)
        //{
        //    //if (m_InfoPanel != null)
        //    //{
        //    //    m_InfoPanel.Display(label, callback, true);
        //    //}
        //}

        //public void ShowInfoPopup(string label)
        //{
        //    //if (m_InfoPanel != null)
        //    //{
        //    //    m_InfoPanel.Display(label, null, false);
        //    //}
        //}

        //public void ShowConnectingModal(bool reconnectMatchmakingClient)
        //{
        //    ShowInfoPopup("Connecting...", () =>
        //        {
        //            if (NetworkManager.s_InstanceExists)
        //            {
        //                if (reconnectMatchmakingClient)
        //                {
        //                    NetworkManager.s_Instance.Disconnect();
        //                    NetworkManager.s_Instance.StartMatchingmakingClient();
        //                }
        //                else
        //                {
        //                    NetworkManager.s_Instance.Disconnect();
        //                }
        //            }
        //        });
        //}

        //public void HideInfoPopup()
        //{
        //    //if (m_InfoPanel != null)
        //    //{
        //    //    m_InfoPanel.gameObject.SetActive(false);
        //    //}
        //}

        /// <summary>
        /// Wait for network to disconnect before performing an action
        /// </summary>
        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();
            }
        }
Example #3
0
        protected virtual void Start()
        {
            LoadingModal modal = LoadingModal.s_Instance;

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

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

            if (m_SharingModal != null)
            {
                m_SharingModal.ShowIfRecording();
            }

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

            case MenuPage.Lobby:
                ShowLobbyPanel();
                break;

            case MenuPage.CustomizationPage:
                ShowCustomizePanel();
                break;

            case MenuPage.SinglePlayer:
                ShowSingleplayerPanel();
                break;
            }
        }
        //Go to shooting range
        private void GotoShootingRange()
        {
            m_DecorationPanel.CloseModal();
            CloseModal();

            LoadingModal loading = LoadingModal.s_Instance;

            if (loading != null)
            {
                loading.FadeIn();
            }

            GameSettings.s_Instance.SetupSinglePlayer(m_ShootingRangeLevel, new ModeDetails(m_ShootingRangeLevel.name, m_ShootingRangeLevel.description, m_ShootingRangeLevel.rulesProcessor));

            NetworkManager netManager = NetworkManager.s_Instance;

            netManager.playerJoined += StartGame;
            netManager.StartSinglePlayerMode(null);
        }
Example #5
0
        protected virtual void Start()
        {
            LoadingModal modal = LoadingModal.s_Instance;

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

            switch (s_ReturnPage)
            {
            case MenuPage.Home:
                ShowDefaultPanel();
                break;

            case MenuPage.SinglePlayer:
                ShowSingleplayerPanel();
                break;
            }
        }