Exemplo n.º 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);
             }
         }
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 public virtual void WriteXml(Amplitude.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("AssemblyQualifiedName", base.GetType().AssemblyQualifiedName);
     writer.WriteAttributeString <bool>("IsActive", this.IsActive);
     writer.WriteStartElement("Registers");
     writer.WriteAttributeString <int>("Count", this.registers.Count);
     foreach (KeyValuePair <StaticString, string> keyValuePair in this.registers)
     {
         writer.WriteStartElement("Register");
         writer.WriteAttributeString <StaticString>("Key", keyValuePair.Key);
         writer.WriteString(keyValuePair.Value);
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
     if (this.IsActive)
     {
         writer.WriteStartElement("InstructionPanel");
         writer.WriteAttributeString("Title", TutorialInstructionPanel.WaitingInstruction.Title);
         writer.WriteAttributeString("Content", TutorialInstructionPanel.WaitingInstruction.Content);
         writer.WriteAttributeString("Action", TutorialInstructionPanel.WaitingInstruction.Action);
         writer.WriteAttributeString <bool>("Modal", TutorialInstructionPanel.WaitingInstruction.Modal);
         writer.WriteAttributeString <bool>("WheelGrabber", TutorialInstructionPanel.WaitingInstruction.WheelGrabber);
         writer.WriteAttributeString <bool>("DisplayNextButton", TutorialInstructionPanel.WaitingInstruction.DisplayNextButton);
         writer.WriteAttributeString <bool>("OverNotifications", TutorialInstructionPanel.WaitingInstruction.OverNotifications);
         writer.WriteAttributeString <bool>("OverModals", TutorialInstructionPanel.WaitingInstruction.OverModals);
         writer.WriteAttributeString("WaitForPanelTypeName", TutorialInstructionPanel.WaitingInstruction.WaitForPanelTypeName);
         writer.WriteAttributeString("WaitForPanelName", TutorialInstructionPanel.WaitingInstruction.WaitForPanelName);
         writer.WriteAttributeString("Placement", TutorialInstructionPanel.WaitingInstruction.Placement.ToString());
         writer.WriteEndElement();
         writer.WriteStartElement("HighlightPanel");
         string value  = string.Empty;
         string value2 = string.Empty;
         bool   value3 = true;
         if (this.guiService != null)
         {
             TutorialHighlightPanel guiPanel = this.guiService.GetGuiPanel <TutorialHighlightPanel>();
             if (guiPanel != null && guiPanel.Target != null)
             {
                 value  = guiPanel.Content;
                 value2 = guiPanel.Target.name;
                 value3 = guiPanel.RectangularHighlight;
             }
         }
         writer.WriteAttributeString("Content", value);
         writer.WriteAttributeString("TargetName", value2);
         writer.WriteAttributeString <bool>("Rectangular", value3);
         writer.WriteEndElement();
     }
 }
Exemplo n.º 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;
    }