Ejemplo n.º 1
0
        //  Add screens - if during update-loop some screen was marked 'for add'
        static void AddScreens()
        {
            // Changed from foreach to for, to allow add screens during enumeration
            for (int i = 0; i < m_screensToAdd.Count; i++)
            {
                MyGuiScreenBase screenToAdd = m_screensToAdd[i];

                if (screenToAdd.IsLoaded == false)
                {
                    screenToAdd.State = MyGuiScreenState.OPENING;
                    screenToAdd.LoadData();
                    screenToAdd.LoadContent();
                }

                // I have enough of screens hidden behind gui screen gameplay
                if (screenToAdd.IsAlwaysFirst())
                {
                    m_screens.Insert(0, screenToAdd);
                }
                else
                {
                    m_screens.Insert(GetIndexOfLastNonTopScreen(), screenToAdd);
                }
            }
            m_screensToAdd.Clear();
        }
Ejemplo n.º 2
0
        public static void AddScreenNow(MyGuiScreenBase screen)
        {
            Debug.Assert(screen != null);

            screen.Closed +=
                delegate(MyGuiScreenBase sender)
            {
                RemoveScreen(sender);
            };

            // Hide tooltips
            var screenWithFocus = GetScreenWithFocus();

            if (screenWithFocus != null)
            {
                screenWithFocus.HideTooltips();
            }

            //  When adding new screen and previous screen is configured to hide(not close), find it and hide it now
            MyGuiScreenBase previousCanHideScreen = null;

            if (screen.CanHideOthers)
            {
                previousCanHideScreen = GetPreviousScreen(null, x => x.CanBeHidden, x => x.CanHideOthers);
            }

            if (previousCanHideScreen != null && previousCanHideScreen.State != MyGuiScreenState.CLOSING)
            {
                previousCanHideScreen.HideScreen();
            }


            if (screen.IsLoaded == false)
            {
                screen.State = MyGuiScreenState.OPENING;
                screen.LoadData();
                screen.LoadContent();
            }

            if (screen.IsAlwaysFirst())
            {
                m_screens.Insert(0, screen);
            }
            else
            {
                m_screens.Insert(GetIndexOfLastNonTopScreen(), screen);
            }
        }