Exemplo n.º 1
0
        public void HighScore()
        {
            if (_homeMessageManager == null)
            {
                _homeMessageManager =
                    GameObject.FindGameObjectWithTag("HomeManager").GetComponent <HomeMessageManager>();
            }

            _homeMessageManager.GetYesOrNoMessage(
                "这场比赛将会被服务器记录\n并且影响你的Rank分\n请确保在网络畅通下进行", b =>
            {
                if (!b)
                {
                    return;
                }
                gameMode    = -1;
                _gameStatus = GameStatus.HighScoreGame;
                _webConnector.StartGame(response =>
                {
                    if (response)
                    {
                        SceneManager.LoadScene(2);
                    }
                    else
                    {
#if UNITY_EDITOR
                        Debug.Log("Unknown error on High Score");
#endif
                    }
                });
            });
        }
Exemplo n.º 2
0
        public void AcceptGame()
        {
            if (_homeMessageManager == null)
            {
                _homeMessageManager =
                    GameObject.FindGameObjectWithTag("HomeManager").GetComponent <HomeMessageManager>();
            }

            _homeMessageManager.GetYesOrNoMessage(
                "这场比赛将会被服务器记录\n并且影响你的Rank分\n请确保在网络畅通下进行", b =>
            {
                if (!b)
                {
                    return;
                }
                _gameStatus = GameStatus.AcceptGame;
                _webConnector.GetGame(f =>
                {
                    gameMode = f;
                    if (gameMode < 0)
                    {
#if UNITY_EDITOR
                        Debug.Log("Unknown error on accept game");
#endif
                        _homeMessageManager.ShowImportantMessage("抱歉,当前比赛池中\n未能找到匹配\n您当前Rank的比赛", b1 => { });
                    }
                    else
                    {
                        SceneManager.LoadScene(2);
                    }
                });
            });
        }
Exemplo n.º 3
0
        private void Start()
        {
            if (!_onScene)
            {
                DontDestroyOnLoad(gameObject);
                _onScene = true;
            }
            else
            {
                Destroy(gameObject);
            }
#if UNITY_EDITOR
            try
            {
#endif
            _webConnector = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <WebConnector>();
#if UNITY_EDITOR
        }
        catch (Exception)
        {
            // ignored
        }
#endif
            _homeMessageManager = GameObject.FindGameObjectWithTag("HomeManager").GetComponent <HomeMessageManager>();
        }
Exemplo n.º 4
0
        private void Start()
        {
            _friends   = new List <Friend>();
            _nextFlush = Time.time + flushTime;
#if UNITY_EDITOR
            try
            {
#endif
            _webConnector       = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <WebConnector>();
            _homeMessageManager = GetComponent <HomeMessageManager>();
            _webConnector.GetFriends(this);
            _webConnector.GetScore(() => { SetMine(_webConnector.Account); });
            _pos = -130;
#if UNITY_EDITOR
        }
        catch (Exception)
        {
            // ignored
        }
#endif
        }