Пример #1
0
        void OnPlayGame(string gameId)
        {
            _multiplayerWindow.OnPlay -= OnPlayGame;
            _uiManager.ShowWindow(UIWindowEnum.SPLASH, true);

            Core.Instance.GetService <NetworkManager>().Join_Play(gameId, _playerManager.selectedCar, () =>
            {
                if (!_sPlayerP.IsGameId(gameId))
                {
                    Debug.Log("NEW GAME");
                    _sPlayerP.SafeDataOnPlayClick(_gameManager.GetGameDataByID(gameId));
                    _gameManager.StartGame(gameId);
                }
                else if (_sPlayerP.IsRecord(gameId))
                {
                    Debug.Log("RECORD GAME");
                    _gameManager.ApplyTrack(_sPlayerP.GetTrack(gameId), gameId);
                    _sPlayerP.FillReplayStatistic(gameId);
                    _sPlayerP.FillUserStatistic(gameId);
                }
                else
                {
                    Debug.Log("REPLAY GAME");
                    _gameManager.StartGame(gameId);
                }
            }, (err) =>
            {
                if (err == "timeout")
                {
                    _uiManager.ShowWindow(UIWindowEnum.SPLASH, false);
                    _enternetWindow.ShowErrorEnternet();
                    _multiplayerWindow.OnPlay += OnPlayGame;
                }
                else
                {
                    Debug.LogError("OnPlayGame err");
                }
            });
        }
Пример #2
0
        // used on button !
        public void PlayGame()
        {
            // pre-condition
            Assert.IsTrue(_gameID != "");

            Core.Instance.GetService <NetworkManager>().Join_Play(_gameID, Core.Instance.GetService <PlayerManager>().selectedCar, () =>
            {
                _safePlayerPrefs.SafeDataOnPlayClick(_gameData);
                _gameManager.StartGame(_gameID);
            },
                                                                  (err) =>
            {
                if (err == "timeout")
                {
                    _uiManager.ShowWindow(UIWindowEnum.SPLASH, false);
                    _enternetWindow.ShowErrorEnternet();
                }
                else
                {
                    Debug.LogError("PlayGame err");
                }
            });
        }
Пример #3
0
 void OnFreeGame(GameData gd)
 {
     Debug.Log("OnFreeGame");
     _networkManager.Join_Play(gd.gameId, _playerManager.selectedCar, () => {
         Debug.Log("Join_Play ok");
         _safePlayerPrefs.SafeDataOnPlayClick(gd);
         _podiumNew.SetActive(false);
         StartGame(gd.gameId);
     },
                               (err) =>
     {
         if (err == "timeout")
         {
             Debug.Log("Join_Play err");
             _uiManager.ShowWindow(UIWindowEnum.SPLASH, false);
             _enternetWindow.ShowErrorEnternet();
         }
         else
         {
             Debug.LogError("Join_Play err");
         }
     });
     //_uiManager.ShowWindow(UIWindowEnum.SPLASH, false);
 }