Exemplo n.º 1
0
 public override void Execute()
 {
     base.Execute();
     if (Service.Get <GameStateMachine>().CurrentState is HomeState)
     {
         Service.Get <StaRTSLogger>().Warn("TransitionToHomeStoryAction executed but already home.");
         this.OnTransitionComplete();
         return;
     }
     HomeState.GoToHomeState(new TransitionCompleteDelegate(this.OnTransitionComplete), false);
 }
Exemplo n.º 2
0
 private void FinishUp(bool didSkip)
 {
     if (!this.finishing)
     {
         Service.Get <IBackButtonManager>().UnregisterBackButtonHandler(this);
         this.StopNow();
         this.finishing = true;
         Service.Get <EventManager>().SendEvent(EventId.TextCrawlComplete, null);
         HomeState.GoToHomeState(new TransitionCompleteDelegate(this.OnWipeComplete), true);
     }
 }
Exemplo n.º 3
0
 protected void OnMapLoadFailure()
 {
     Service.Get <CameraManager>().UXCamera.Camera.enabled = true;
     Service.Get <UXController>().HUD.Visible = false;
     if (Service.Get <GameStateMachine>().CurrentState is HomeState)
     {
         this.FinishWipe();
         return;
     }
     HomeState.GoToHomeState(null, false);
 }
Exemplo n.º 4
0
 public void OnReplayLoadFailed(uint status, object cookie)
 {
     ProcessingScreen.Hide();
     if (!(Service.GameStateMachine.CurrentState is HomeState))
     {
         HomeState.GoToHomeState(null, false);
     }
     if (status == 2110u)
     {
         string message = Service.Lang.Get("REPLAY_DATA_NOT_FOUND", new object[0]);
         AlertScreen.ShowModal(false, null, message, null, null);
     }
 }
Exemplo n.º 5
0
 public override void Execute()
 {
     base.Execute();
     if (Service.GameStateMachine.CurrentState is HomeState)
     {
         Service.Logger.Warn("TransitionToHomeStoryAction executed but already home.");
         this.OnTransitionComplete();
     }
     else
     {
         HomeState.GoToHomeState(new TransitionCompleteDelegate(this.OnTransitionComplete), false);
     }
 }
Exemplo n.º 6
0
 protected void OnMapLoadFailure()
 {
     Service.CameraManager.UXCamera.Camera.enabled = true;
     Service.UXController.HUD.Visible = false;
     if (Service.GameStateMachine.CurrentState is HomeState)
     {
         this.FinishWipe();
     }
     else
     {
         HomeState.GoToHomeState(null, false);
     }
 }
Exemplo n.º 7
0
 public override void Process(bool continueProcessing)
 {
     this.continueProcessing = continueProcessing;
     if (base.ShouldProcess)
     {
         Service.RUFManager.UpdateProcessingLoadState(false);
         if (Service.GameStateMachine.CurrentState is HomeState)
         {
             base.Process(continueProcessing);
             return;
         }
         HomeState.GoToHomeState(new TransitionCompleteDelegate(this.OnHomeLoaded), true);
     }
 }
Exemplo n.º 8
0
 private void ExitBaseLayoutTool(bool afterSave)
 {
     if (Service.Get <GameStateMachine>().CurrentState is WarBaseEditorState)
     {
         HomeMapDataLoader mapDataLoader = Service.Get <HomeMapDataLoader>();
         Service.Get <WorldTransitioner>().StartTransition(new WarbaseToWarboardTransition(new WarBoardState(), mapDataLoader, null, false, false));
         return;
     }
     if (afterSave)
     {
         HomeState.GoToHomeState(null, false);
         return;
     }
     Service.Get <GameStateMachine>().SetState(new EditBaseState(false));
 }
Exemplo n.º 9
0
 public override void Execute()
 {
     base.Execute();
     if (Service.Get <GameStateMachine>().CurrentState is EditBaseState)
     {
         HomeState.GoToHomeState(null, false);
     }
     else
     {
         Service.Get <StaRTSLogger>().WarnFormat("Story Action {0} is attempting to exit Edit mode, which we are not in", new object[]
         {
             this.vo.Uid
         });
     }
     this.parent.ChildComplete(this);
 }
Exemplo n.º 10
0
 private void ExitBaseLayoutTool(bool afterSave)
 {
     if (Service.GameStateMachine.CurrentState is WarBaseEditorState)
     {
         HomeMapDataLoader homeMapDataLoader = Service.HomeMapDataLoader;
         Service.WorldTransitioner.StartTransition(new WarbaseToWarboardTransition(new WarBoardState(), homeMapDataLoader, null, false, false));
     }
     else if (afterSave)
     {
         HomeState.GoToHomeState(null, false);
     }
     else
     {
         Service.GameStateMachine.SetState(new EditBaseState(false));
     }
 }
Exemplo n.º 11
0
        private void OnPrimaryActionButtonClicked(UXButton button)
        {
            button.Enabled = false;
            this.replayBattleButton.Enabled = false;
            BattleType type = Service.Get <BattleController>().GetCurrentBattle().Type;

            if (type == BattleType.PveDefend)
            {
                HomeState.GoToHomeStateAndReloadMap();
                this.Close(null);
            }
            else
            {
                HomeState.GoToHomeState(null, false);
            }
            Service.Get <BattlePlaybackController>().DiscardLastReplay();
        }
Exemplo n.º 12
0
        public void OnPvpGetNextTargetFailure()
        {
            IState            currentState      = Service.Get <GameStateMachine>().CurrentState;
            WorldTransitioner worldTransitioner = Service.Get <WorldTransitioner>();

            worldTransitioner.SetAlertMessage(Service.Get <Lang>().Get("GET_PVP_TARGET_FAILURE", new object[0]));
            if (worldTransitioner.IsSoftWiping())
            {
                worldTransitioner.FinishWipe();
            }
            if (!(currentState is HomeState))
            {
                if (currentState is GalaxyState)
                {
                    HomeState.GoToHomeState(null, false);
                }
                else
                {
                    worldTransitioner.SetTransitionInStartCallback(new TransitionInStartDelegate(this.OnTransitionInStartLoadHome));
                }
            }
            Service.Get <UserInputInhibitor>().AllowAll();
        }
Exemplo n.º 13
0
        private void HandleBackButton()
        {
            IState currentState = Service.GameStateMachine.CurrentState;

            if (currentState is IntroCameraState)
            {
                IntroCameraAnimation intro = Service.UXController.Intro;
                if (intro != null)
                {
                    intro.FinishUp(true);
                }
                return;
            }
            for (int i = this.backButtonHandlers.Count - 1; i >= 0; i--)
            {
                if (this.backButtonHandlers[i].HandleBackButtonPress())
                {
                    return;
                }
            }
            UICamera.selectedObject = null;
            UICamera.hoveredObject  = null;
            if (TouchScreenKeyboard.visible)
            {
                return;
            }
            ScreenController screenController = null;

            if (Service.ScreenController != null)
            {
                screenController = Service.ScreenController;
                AlertScreen highestLevelScreen = screenController.GetHighestLevelScreen <AlertScreen>();
                if (highestLevelScreen != null && highestLevelScreen.IsAlwaysOnTop)
                {
                    this.HandleScreenBack(highestLevelScreen);
                    return;
                }
            }
            if (Service.HoloController != null)
            {
                HoloController holoController = Service.HoloController;
                if (holoController.HasAnyCharacter())
                {
                    Service.EventManager.SendEvent(EventId.StoryNextButtonClicked, null);
                    return;
                }
            }
            if (screenController != null)
            {
                ScreenBase     highestLevelScreen2 = screenController.GetHighestLevelScreen <ScreenBase>();
                ClosableScreen highestLevelScreen3 = screenController.GetHighestLevelScreen <ClosableScreen>();
                if (Service.CurrentPlayer.CampaignProgress.FueInProgress || Service.UserInputInhibitor.IsDenying())
                {
                    if (highestLevelScreen2 != null && highestLevelScreen2.AllowFUEBackButton && this.HandleScreenBack(highestLevelScreen2))
                    {
                        return;
                    }
                    this.TryQuit();
                    return;
                }
                else
                {
                    if (highestLevelScreen2 != null && this.HandleScreenBack(highestLevelScreen2))
                    {
                        return;
                    }
                    if (highestLevelScreen3 != null && this.HandleScreenBack(highestLevelScreen3))
                    {
                        return;
                    }
                }
            }
            if (currentState is EditBaseState)
            {
                HomeState.GoToHomeState(null, false);
                return;
            }
            if (Service.BuildingController != null)
            {
                BuildingController buildingController = Service.BuildingController;
                if (buildingController.SelectedBuilding != null)
                {
                    buildingController.EnsureDeselectSelectedBuilding();
                    return;
                }
            }
            if (currentState is BaseLayoutToolState)
            {
                UXController uXController = Service.UXController;
                uXController.HUD.BaseLayoutToolView.CancelBaseLayoutTool();
                return;
            }
            if (Service.GalaxyViewController != null && currentState is GalaxyState)
            {
                GalaxyViewController galaxyViewController = Service.GalaxyViewController;
                galaxyViewController.GoToHome();
                return;
            }
            this.TryQuit();
        }