예제 #1
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();
            }
        }
예제 #2
0
        //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);
        }