Exemple #1
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (e.RaisedEvent is EventBeginTurn)
     {
         TutorialInstructionPanel.Show(TutorialInstructionPanel.WaitingInstruction.Title, TutorialInstructionPanel.WaitingInstruction.Content, TutorialInstructionPanel.WaitingInstruction.Action, TutorialInstructionPanel.WaitingInstruction.Modal, TutorialInstructionPanel.WaitingInstruction.WheelGrabber, TutorialInstructionPanel.WaitingInstruction.DisplayNextButton, TutorialInstructionPanel.WaitingInstruction.OverNotifications, TutorialInstructionPanel.WaitingInstruction.OverModals, TutorialInstructionPanel.WaitingInstruction.WaitForPanelTypeName, TutorialInstructionPanel.WaitingInstruction.WaitForPanelName, TutorialInstructionPanel.WaitingInstruction.Placement);
         this.eventService.EventRaise -= this.EventService_EventRaise;
         if (!string.IsNullOrEmpty(TutorialHighlightPanel.WaitingHighlight.TargetName))
         {
             AgeTransform ageTransform             = null;
             Amplitude.Unity.Gui.GuiPanel guiPanel = null;
             if (this.guiService.TryGetGuiPanelByName(TutorialHighlightPanel.WaitingHighlight.TargetName, out guiPanel) && guiPanel != null)
             {
                 ageTransform = guiPanel.AgeTransform;
             }
             else
             {
                 Transform transform = (this.guiService as global::GuiManager).transform.Search(TutorialHighlightPanel.WaitingHighlight.TargetName);
                 if (transform != null)
                 {
                     ageTransform = transform.GetComponent <AgeTransform>();
                 }
             }
             if (ageTransform != null)
             {
                 TutorialHighlightPanel.ShowHighlight(TutorialHighlightPanel.WaitingHighlight.Content, ageTransform, TutorialHighlightPanel.WaitingHighlight.RectangularHighlight);
             }
             else
             {
                 Diagnostics.LogWarning("Could not restore highlight on: " + TutorialHighlightPanel.WaitingHighlight.TargetName);
             }
         }
     }
 }
Exemple #2
0
 protected override void Releasing()
 {
     if (this.eventService != null)
     {
         this.eventService.EventRaise -= this.EventService_EventRaise;
     }
     if (this.guiService != null)
     {
         TutorialHighlightPanel guiPanel = this.guiService.GetGuiPanel <TutorialHighlightPanel>();
         if (guiPanel != null)
         {
             guiPanel.OnTutorialRelease();
         }
         TutorialInstructionPanel guiPanel2 = this.guiService.GetGuiPanel <TutorialInstructionPanel>();
         if (guiPanel2 != null)
         {
             guiPanel2.OnTutorialRelease();
         }
     }
     if (this.IsActive)
     {
         this.RestoreNotifications();
     }
     if (this.CommandService != null)
     {
         if (Amplitude.Unity.Framework.Application.Version.Accessibility <= Accessibility.Internal)
         {
             this.CommandService.UnregisterCommand("/Tutorial");
         }
         this.CommandService = null;
     }
     this.registers.Clear();
     base.Releasing();
     this.IsActive = false;
 }
Exemple #3
0
    public override bool HandleCancelRequest()
    {
        bool flag = false;

        if (!flag && LoadingScreen.LoadingInProgress)
        {
            flag = true;
        }
        TutorialInstructionPanel guiPanel = base.GetGuiPanel <TutorialInstructionPanel>();

        if (!flag && guiPanel != null && guiPanel.IsVisible && guiPanel.ModalFrame.Visible)
        {
            flag = true;
        }
        if (!flag && base.AgeManager.FocusedControl != null && base.AgeManager.FocusedControl.IsKeyExclusive)
        {
            base.AgeManager.FocusedControl = null;
            flag = true;
        }
        if (!flag && this.modalManager.CurrentModalPanel != null && this.modalManager.CurrentModalPanel.HandleCancelRequest())
        {
            flag = true;
        }
        if (!flag && NotificationPanelBase.OpenedPanel != null)
        {
            NotificationPanelBase.OpenedPanel.Hide(false);
            flag = true;
        }
        if (!flag && Amplitude.Unity.Gui.GuiScreen.CurrentScreen != null)
        {
            flag = Amplitude.Unity.Gui.GuiScreen.CurrentScreen.HandleCancelRequest();
        }
        return(flag);
    }
Exemple #4
0
    public override IEnumerator LoadGame(global::Game game)
    {
        yield return(base.LoadGame(game));

        if (this.CommandService != null && Amplitude.Unity.Framework.Application.Version.Accessibility <= Accessibility.Internal)
        {
            this.CommandService.RegisterCommand(new Command("/Tutorial", "Changes the activation state of the tutorial manager."), new Func <string[], string>(this.Command_Tutorial));
        }
        if (this.IsActive)
        {
            this.SetNotifications(true);
            IGameService gameService = Services.GetService <IGameService>();
            Diagnostics.Assert(gameService != null);
            Diagnostics.Assert(gameService.Game != null);
            Diagnostics.Assert(gameService.Game is global::Game);
            SimulationDescriptor tutorialEmpireDescriptor = Databases.GetDatabase <SimulationDescriptor>(false).GetValue("EmpireTutorial");
            Diagnostics.Assert(tutorialEmpireDescriptor != null);
            foreach (global::Empire empire in game.Empires)
            {
                empire.AddDescriptor(tutorialEmpireDescriptor, false);
            }
            if (!string.IsNullOrEmpty(TutorialInstructionPanel.WaitingInstruction.Content))
            {
                this.eventService = Services.GetService <IEventService>();
                Diagnostics.Assert(this.eventService != null);
                this.eventService.EventRaise += this.EventService_EventRaise;
            }
            this.guiService = Services.GetService <Amplitude.Unity.Gui.IGuiService>();
            Diagnostics.Assert(this.guiService != null);
            TutorialInstructionPanel instructionPanel = this.guiService.GetGuiPanel <TutorialInstructionPanel>();
            Diagnostics.Assert(instructionPanel != null);
            instructionPanel.OnTutorialLoad();
            TutorialHighlightPanel highlightPanel = this.guiService.GetGuiPanel <TutorialHighlightPanel>();
            Diagnostics.Assert(highlightPanel != null);
            highlightPanel.OnTutorialLoad();
        }
        yield break;
    }