Ejemplo n.º 1
0
        protected override void DoOfflineBattle()
        {
            if (battleField != null)
            {
                if (battleField.IsGameActive)    //game has already begun.
                {
                    return;
                }
                else if (battleField.IsGameEnd)    //game has already ended.
                {
                    return;
                }
                //wait for player disconnected callback.
            }

            if (M3GameCache.GetIsFriendlyBattle())
            {
                DoCannotDoBattle();
            }
            else
            {
                Helpers.Utility.LogMessage("StateOnlineBattle: Going for offlineBattle");
                Events.EventManager.Instance.BattleFieldSceneUnloadedHandler += onBattleFieldSceneUnloaded;
                if (SceneManager.GetActiveScene().name == SceneUtil.GetSceneName(SceneType.BattleField))
                {
                    ConnectionController.Instance.LoadLevelAsyncViaPhoton(SceneUtil.GetSceneName(SceneType.BattleReloadScene));
                }
                else
                {
                    onBattleFieldSceneUnloaded(null, null);
                }
            }
        }
        void _onConenctedToMaster()
        {
            if (messageShown)
            {
                return;
            }
            messageShown = true;

            StateMachine.Instance.MakeTransition(typeof(StateInitialize));
            ConnectionController.Instance.LoadLevelAsyncViaPhoton(SceneType.MainMenu.ToString());

            if (M3GameCache.GetIsFriendlyBattle())
            {
                EventListenerForPrivateChallenge.ShowUserIsNotAvailablePopup(
                    LocalizationManager.Instance.GetString(LocalizationKeys.CANNOT_JOIN_BATTLE), () => {
                }
                    );
            }
            else
            {
                if (UserPreferenceManager.GetAIBattleCompletionState() == 0)
                {
                    EventListenerForPrivateChallenge.ShowUserIsNotAvailablePopup(
                        LocalizationManager.Instance.GetString(LocalizationKeys.OTHER_PLAYER), () => {
                    }
                        );
                }
            }
        }
Ejemplo n.º 3
0
 protected void DoOfflineBattleAfterReload()
 {
     if (M3GameCache.GetIsFriendlyBattle())
     {
         VersusScreen.Instance.StopAnimation();
         StateMachine.Instance.MakeTransition(typeof(StateBattleEndCannotBattle));
     }
     else
     {
         Helpers.Utility.LogMessage("StateGoForOnlineBattle: Going for offlineBattle");
         VersusScreen.Instance.RestartAnimation();
         Events.EventManager.Instance.BattleFieldSceneUnloadedHandler += onBattleFieldSceneUnloaded;
         if (SceneManager.GetActiveScene().name == SceneUtil.GetSceneName(SceneType.BattleField))
         {
             ConnectionController.Instance.LoadLevelAsyncViaPhoton(SceneUtil.GetSceneName(SceneType.BattleReloadScene));
         }
         else
         {
             onBattleFieldSceneUnloaded(null, null);
         }
     }
 }