示例#1
0
 private bool EnsureScreenActive()
 {
     if (this.holocommScreen == null)
     {
         this.holocommScreen = new HolocommScreen();
         if (Service.ScreenController.GetHighestLevelScreen <HQCelebScreen>() != null)
         {
             Service.ScreenController.AddScreen(this.holocommScreen, true, QueueScreenBehavior.QueueAndDeferTillClosed);
         }
         else
         {
             Service.ScreenController.AddScreen(this.holocommScreen, true);
         }
         Service.UXController.HUD.Visible = false;
         return(false);
     }
     return(this.holocommScreen.IsLoaded() && !this.holocommScreen.HiddenInQueue);
 }
示例#2
0
 public HoloController()
 {
     Service.Set <HoloController>(this);
     this.holocommScreen = new HolocommScreen();
     this.holocommScreen = null;
     this.commandBuffer  = new List <HoloCommand>();
     this.events         = Service.Get <EventManager>();
     this.events.RegisterObserver(this, EventId.HoloCommScreenDestroyed);
     this.events.RegisterObserver(this, EventId.ShowHologram);
     this.events.RegisterObserver(this, EventId.ShowTranscript);
     this.events.RegisterObserver(this, EventId.PlayHologramAnimation);
     this.events.RegisterObserver(this, EventId.HideHologram);
     this.events.RegisterObserver(this, EventId.HideTranscript);
     this.events.RegisterObserver(this, EventId.ShowNextButton);
     this.events.RegisterObserver(this, EventId.ShowStoreNextButton);
     this.events.RegisterObserver(this, EventId.HideAllHolograms);
     this.events.RegisterObserver(this, EventId.ScreenLoaded);
     this.events.RegisterObserver(this, EventId.ShowInfoPanel);
     this.events.RegisterObserver(this, EventId.HideInfoPanel);
     this.events.RegisterObserver(this, EventId.ScreenSizeChanged);
 }
示例#3
0
        public EatResponse OnEvent(EventId id, object cookie)
        {
            switch (id)
            {
            case EventId.ShowHologram:
            {
                ShowHologramStoryAction showHologramStoryAction = (ShowHologramStoryAction)cookie;
                if (this.EnsureScreenActive())
                {
                    this.holocommScreen.ShowHoloCharacter(showHologramStoryAction.Character);
                }
                else
                {
                    this.StoreCommandInBuffer(id, cookie);
                }
                return(EatResponse.NotEaten);
            }

            case EventId.ShowHologramComplete:
            case EventId.ShowAttackButton:
            case EventId.HideHologramComplete:
IL_40:
                if (id == EventId.ScreenLoaded)
                {
                    if (cookie is HolocommScreen)
                    {
                        HolocommScreen holocommScreen = (HolocommScreen)cookie;
                        if (!holocommScreen.HiddenInQueue)
                        {
                            this.SafeRunThroughCommandBuffer();
                            this.commandBuffer.Clear();
                        }
                    }
                    return(EatResponse.NotEaten);
                }
                if (id != EventId.HoloCommScreenDestroyed)
                {
                    return(EatResponse.NotEaten);
                }
                this.holocommScreen = null;
                if (!(Service.GameStateMachine.CurrentState is GalaxyState))
                {
                    Service.UXController.HUD.Visible = true;
                }
                return(EatResponse.NotEaten);

            case EventId.ShowTranscript:
            {
                ShowTranscriptStoryAction showTranscriptStoryAction = (ShowTranscriptStoryAction)cookie;
                if (this.EnsureScreenActive())
                {
                    this.holocommScreen.AddDialogue(showTranscriptStoryAction.Text, showTranscriptStoryAction.Title);
                }
                else
                {
                    this.StoreCommandInBuffer(id, cookie);
                }
                return(EatResponse.NotEaten);
            }

            case EventId.PlayHologramAnimation:
            {
                PlayHoloAnimationStoryAction playHoloAnimationStoryAction = (PlayHoloAnimationStoryAction)cookie;
                this.holocommScreen.PlayHoloAnimation(playHoloAnimationStoryAction.AnimName);
                return(EatResponse.NotEaten);
            }

            case EventId.HideHologram:
                if (this.holocommScreen != null && this.holocommScreen.IsLoaded())
                {
                    this.holocommScreen.CloseAndDestroyHoloCharacter();
                }
                return(EatResponse.NotEaten);

            case EventId.HideTranscript:
                if (this.holocommScreen != null && this.holocommScreen.IsLoaded())
                {
                    this.holocommScreen.RemoveDialogue();
                }
                return(EatResponse.NotEaten);

            case EventId.ShowNextButton:
                if (this.EnsureScreenActive())
                {
                    this.holocommScreen.ShowButton("BtnNext");
                }
                else
                {
                    this.StoreCommandInBuffer(id, cookie);
                }
                return(EatResponse.NotEaten);

            case EventId.ShowStoreNextButton:
                if (this.EnsureScreenActive())
                {
                    this.holocommScreen.ShowButton("ButtonStore");
                }
                else
                {
                    this.StoreCommandInBuffer(id, cookie);
                }
                return(EatResponse.NotEaten);

            case EventId.HideAllHolograms:
                if (this.holocommScreen != null && this.holocommScreen.IsLoaded())
                {
                    this.holocommScreen.HideAllElements();
                    this.holocommScreen.CloseAndDestroyHoloCharacter();
                }
                return(EatResponse.NotEaten);

            case EventId.ShowInfoPanel:
                if (this.EnsureScreenActive())
                {
                    ShowHologramInfoStoryAction showHologramInfoStoryAction = (ShowHologramInfoStoryAction)cookie;
                    this.holocommScreen.ShowInfoPanel(showHologramInfoStoryAction.ImageName, showHologramInfoStoryAction.DisplayText, showHologramInfoStoryAction.TitleText, showHologramInfoStoryAction.PlanetPanel);
                }
                else
                {
                    this.StoreCommandInBuffer(id, cookie);
                }
                return(EatResponse.NotEaten);

            case EventId.HideInfoPanel:
                if (this.holocommScreen != null && this.holocommScreen.IsLoaded())
                {
                    this.holocommScreen.HideInfoPanel();
                }
                return(EatResponse.NotEaten);
            }
            goto IL_40;
        }