示例#1
0
 public void GoBack(GoBackRequestEvent e, Node any, [JoinAll] NavigationNode navigationNode, [JoinAll] ScreenNode screen)
 {
     if (navigationNode.history.screens.Count > 0)
     {
         ShowScreenData           showScreenData  = navigationNode.history.screens.Peek();
         ScreensRegistryComponent screensRegistry = navigationNode.screensRegistry;
         GameObject nonActiveScreen = this.GetNonActiveScreen(showScreenData.ScreenType, screensRegistry);
         if (nonActiveScreen != null)
         {
             OverrideGoBack component = nonActiveScreen.GetComponent <OverrideGoBack>();
             if (component != null)
             {
                 showScreenData  = component.ScreenData;
                 nonActiveScreen = this.GetNonActiveScreen(showScreenData.ScreenType, screensRegistry);
             }
             base.ScheduleEvent <GoBackEvent>(any.Entity);
             navigationNode.history.screens.Pop();
             CurrentScreenComponent currentScreen = navigationNode.currentScreen;
             if (currentScreen.showScreenData.Context != null)
             {
                 currentScreen.showScreenData.Context.RemoveComponent <ScreenGroupComponent>();
             }
             currentScreen.screen.RemoveComponent <ActiveScreenComponent>();
             currentScreen.screen.AddComponent <ScreenHidingComponent>();
             currentScreen.showScreenData.FreeContext();
             this.ActivateShowingScreen(nonActiveScreen, this.GetActiveScreen(currentScreen.showScreenData.ScreenType, navigationNode.screensRegistry), showScreenData, currentScreen);
             base.NewEvent <PostGoBackEvent>().Attach(navigationNode).ScheduleDelayed(0f);
         }
     }
 }
示例#2
0
        public void JoinContextToScreen(NodeAddedEvent e, GroupScreenNode screenNode, [JoinAll, Mandatory] SingleNode <CurrentScreenComponent> currentScreen)
        {
            ShowScreenData showScreenData = currentScreen.component.showScreenData;

            if ((showScreenData != null) && (showScreenData.Context != null))
            {
                this.JoinContext(showScreenData.Context, screenNode.Entity);
            }
        }
示例#3
0
        private void TryShowScreen(NavigationRequestNode navigationNode)
        {
            ShowScreenData           showScreenData  = navigationNode.requestShowScreen.Event.ShowScreenData;
            ScreensRegistryComponent screensRegistry = navigationNode.screensRegistry;
            GameObject nonActiveScreen = this.GetNonActiveScreen(showScreenData.ScreenType, screensRegistry);

            if (nonActiveScreen == null)
            {
                if (this.GetActiveScreen(showScreenData.ScreenType, screensRegistry) != null)
                {
                    navigationNode.Entity.RemoveComponent <RequestShowScreenComponent>();
                }
                else
                {
                    base.Log.WarnFormat("Skip remove RequestShowScreenComponent {0}", navigationNode.requestShowScreen.Event.ShowScreenData.ScreenType.Name);
                }
            }
            else
            {
                navigationNode.Entity.RemoveComponent <RequestShowScreenComponent>();
                CurrentScreenComponent currentScreen = navigationNode.currentScreen;
                HistoryComponent       history       = navigationNode.history;
                GameObject             hidingScreen  = null;
                if (currentScreen.screen != null)
                {
                    hidingScreen = this.GetActiveScreen(currentScreen.showScreenData.ScreenType, navigationNode.screensRegistry);
                    currentScreen.screen.RemoveComponent <ActiveScreenComponent>();
                    currentScreen.screen.AddComponent <ScreenHidingComponent>();
                    if (hidingScreen.GetComponent <ScreenComponent>().LogInHistory)
                    {
                        ShowScreenData         t       = currentScreen.showScreenData.InvertAnimationDirection(showScreenData.AnimationDirection);
                        Stack <ShowScreenData> screens = history.screens;
                        if ((screens.Count > 0) && ReferenceEquals(screens.Peek().ScreenType, t.ScreenType))
                        {
                            screens.Pop();
                        }
                        screens.Push(t);
                        if (t.Context != null)
                        {
                            t.Context.RemoveComponent <ScreenGroupComponent>();
                        }
                    }
                }
                this.ActivateShowingScreen(nonActiveScreen, hidingScreen, showScreenData, currentScreen);
            }
        }
示例#4
0
 private void ClearTo(ShowScreenData entry, Stack <ShowScreenData> history)
 {
     while (true)
     {
         if (history.Count > 0)
         {
             if (history.Peek() != entry)
             {
                 history.Pop().FreeContext();
                 continue;
             }
             if (base.GetComponent <GoodsSelectionScreenComponent>() != null)
             {
                 history.Pop().FreeContext();
             }
         }
         return;
     }
 }
示例#5
0
 private void ActivateShowingScreen(GameObject showingScreen, GameObject hidingScreen, ShowScreenData showScreenData, CurrentScreenComponent currentScreenComponent)
 {
     currentScreenComponent.showScreenData = showScreenData;
     showingScreen.GetComponent <EntityBehaviour>().enabled = false;
     showingScreen.SetActive(true);
     showingScreen.GetComponent <EntityBehaviour>().enabled = true;
     this.PlayAnimation(showingScreen, hidingScreen, showScreenData.AnimationDirection);
 }