예제 #1
0
        public void AdjustDepths()
        {
            int num   = 0;
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                int        num2       = 0;
                ScreenInfo screenInfo = this.screens[i];
                UXElement  screen     = screenInfo.Screen;
                if (screen.Root != null)
                {
                    int depth = screenInfo.Depth;
                    if (depth != num)
                    {
                        this.AddDepthRecursively(screen.Root, num, depth, ref num2);
                        screenInfo.Depth = num;
                        screenInfo.ScreenPanelThickness = num2;
                    }
                    else
                    {
                        num2 += screenInfo.ScreenPanelThickness;
                    }
                }
                num += num2 + 1;
                i++;
            }
        }
예제 #2
0
        public void CloseAll()
        {
            List <ScreenBase> list = new List <ScreenBase>();
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                if (this.IsScreenAutoCloseable(this.screens[i]))
                {
                    list.Add(this.screens[i].Screen as ScreenBase);
                }
                i++;
            }
            int count2 = this.queuedScreens.Count;
            int num    = 0;

            while (num < count2 && this.queuedScreens.Count > 0)
            {
                ScreenInfo screenInfo = this.queuedScreens.Dequeue();
                if (this.IsScreenAutoCloseable(screenInfo))
                {
                    list.Add(screenInfo.Screen as ScreenBase);
                }
                num++;
            }
            for (int j = list.Count - 1; j >= 0; j--)
            {
                list[j].CloseNoTransition(null);
            }
        }
예제 #3
0
        private void UpdateScrimAndDepths()
        {
            bool flag = false;

            if (this.scrim != null)
            {
                this.RemoveScreenHelper(this.scrim.Screen);
                this.scrim = null;
            }
            for (int i = this.screens.Count - 1; i >= 0; i--)
            {
                if (this.screens[i].IsModal || this.screens[i].IsPersistentAndOpen())
                {
                    UXElement screen = Service.Get <UXController>().MiscElementsManager.ShowScrim(true, this.screens[i].VisibleScrim);
                    this.scrim = new ScreenInfo(screen, false);
                    this.screens.Insert(i, this.scrim);
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                Service.Get <UXController>().MiscElementsManager.ShowScrim(false);
            }
            this.AdjustDepths();
        }
예제 #4
0
        private bool IsScreenAutoCloseable(ScreenInfo screenInfo)
        {
            bool result = false;

            if (screenInfo.Screen is ScreenBase && !(screenInfo.Screen is HUD) && !(screenInfo.Screen is PersistentAnimatedScreen))
            {
                result = true;
            }
            return(result);
        }
예제 #5
0
        private bool ShouldDequeueScreen(ScreenInfo screen)
        {
            bool flag = !this.ShouldForceScreenToQueue();

            if (flag)
            {
                flag = (!screen.HasQueueBehavior() || !this.IsModalDialogActive());
            }
            return(flag);
        }
예제 #6
0
 public ScreenController()
 {
     Service.Set <ScreenController>(this);
     this.screens       = new List <ScreenInfo>();
     this.cache         = new Dictionary <string, GameObjectContainer>();
     this.loadQueue     = new List <AssetRequest>();
     this.queuedScreens = new Queue <ScreenInfo>();
     this.scrim         = null;
     Service.Get <EventManager>().RegisterObserver(this, EventId.UpdateScrim, EventPriority.Default);
 }
예제 #7
0
        private void AddScreenInfoToQueue(ScreenInfo screen)
        {
            screen.OnEnqueued();
            this.queuedScreens.Enqueue(screen);
            ScreenBase screenBase = screen.Screen as ScreenBase;

            if (screenBase != null)
            {
                screenBase.OnScreenAddedToQueue();
            }
        }
예제 #8
0
        public void RestoreVisibilityToAll()
        {
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                ScreenInfo screenInfo = this.screens[i];
                screenInfo.Screen.Visible = screenInfo.WasVisible;
                i++;
            }
            this.scrim.Screen.Visible = this.scrim.WasVisible;
        }
예제 #9
0
        private void RestoreDepths(int i)
        {
            int        num        = 0;
            int        num2       = 0;
            ScreenInfo screenInfo = this.screens[i];
            UXElement  screen     = screenInfo.Screen;

            if (screen.Root != null)
            {
                int depth = screenInfo.Depth;
                this.AddDepthRecursively(screen.Root, num, depth, ref num2);
                screenInfo.Depth = num;
            }
        }
예제 #10
0
        public void HideAll()
        {
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                ScreenInfo screenInfo = this.screens[i];
                screenInfo.WasVisible     = screenInfo.Screen.Visible;
                screenInfo.Screen.Visible = false;
                i++;
            }
            if (this.scrim != null)
            {
                this.scrim.WasVisible     = this.scrim.Screen.Visible;
                this.scrim.Screen.Visible = false;
            }
        }
예제 #11
0
        private bool RemoveScreenHelper(UXElement screen)
        {
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                ScreenInfo screenInfo = this.screens[i];
                if (screenInfo.Screen == screen)
                {
                    this.RestoreDepths(i);
                    this.screens.RemoveAt(i);
                    return(true);
                }
                i++;
            }
            return(false);
        }
예제 #12
0
        private bool HandleScreenQueue(ScreenInfo screen)
        {
            bool flag = false;

            if ((screen.QueueBehavior == QueueScreenBehavior.Queue || screen.QueueBehavior == QueueScreenBehavior.QueueAndDeferTillClosed) && (this.queuedScreens.Count > 1 || this.IsModalDialogActive()))
            {
                flag = true;
            }
            if (!flag)
            {
                flag = this.ShouldForceScreenToQueue();
            }
            if (flag)
            {
                this.AddScreenInfoToQueue(screen);
            }
            return(flag);
        }
예제 #13
0
        public ScreenInfo AddScreen(UXElement screen, bool modal, bool visibleScrim, QueueScreenBehavior subType)
        {
            ScreenBase highestLevelScreen = this.GetHighestLevelScreen <ScreenBase>();

            if (highestLevelScreen != null)
            {
                AlertScreen alertScreen = highestLevelScreen as AlertScreen;
                if (alertScreen != null && alertScreen.IsFatal)
                {
                    screen.Visible = false;
                    return(null);
                }
            }
            ScreenBase  screenBase   = screen as ScreenBase;
            AlertScreen alertScreen2 = screen as AlertScreen;
            ScreenInfo  screenInfo   = new ScreenInfo(screen, modal, visibleScrim, subType);

            if (!this.HandleScreenQueue(screenInfo))
            {
                if (highestLevelScreen != null && highestLevelScreen.IsAlwaysOnTop && this.screens.Count > 0)
                {
                    if ((screenBase != null && screenBase.IsAlwaysOnTop) || (alertScreen2 != null && alertScreen2.IsFatal))
                    {
                        this.screens.Add(screenInfo);
                        Service.EventManager.SendEvent(EventId.NewTopScreen, null);
                    }
                    else
                    {
                        this.screens.Insert(this.screens.Count - 1, screenInfo);
                    }
                }
                else
                {
                    this.screens.Add(screenInfo);
                    Service.EventManager.SendEvent(EventId.NewTopScreen, null);
                }
                screen.Visible = true;
                this.UpdateScrimAndDepths();
                Service.UserInputManager.ResetLastScreenPosition();
            }
            return(screenInfo);
        }
예제 #14
0
 private void PopAndShowNextQueuedScreen()
 {
     if (this.queuedScreens.Count >= 1 && this.ShouldDequeueScreen(this.queuedScreens.Peek()))
     {
         ScreenInfo screenInfo = this.queuedScreens.Dequeue();
         screenInfo.OnDequeued();
         screenInfo = this.AddScreen(screenInfo.Screen, screenInfo.IsModal, screenInfo.VisibleScrim, screenInfo.QueueBehavior);
         if (screenInfo != null)
         {
             ScreenBase screenBase = screenInfo.Screen as ScreenBase;
             if (screenBase != null)
             {
                 screenBase.OnScreeenPoppedFromQueue();
             }
             if (screenInfo.QueueBehavior == QueueScreenBehavior.Default && !screenInfo.IsModal)
             {
                 this.PopAndShowNextQueuedScreen();
             }
         }
     }
 }
예제 #15
0
        private bool RemoveScreenHelper(UXElement screen)
        {
            int i     = 0;
            int count = this.screens.Count;

            while (i < count)
            {
                ScreenInfo screenInfo = this.screens[i];
                if (screenInfo.Screen == screen)
                {
                    this.RestoreDepths(i);
                    this.screens.RemoveAt(i);
                    if (i == this.screens.Count)
                    {
                        Service.EventManager.SendEvent(EventId.NewTopScreen, null);
                    }
                    return(true);
                }
                i++;
            }
            return(false);
        }