Beispiel #1
0
        //  Only for displaying list of active GUI screens in debug console
        public static StringBuilder GetGuiScreensForDebug()
        {
            m_sb.Clear();
            m_sb.ConcatFormat("{0}{1}{2}", "GUI screens: [", m_screens.Count, "]: ");
            var screenWithFocus = GetScreenWithFocus();

            for (int i = 0; i < m_screens.Count; i++)
            {
                MyGuiScreenBase screen = m_screens[i];
                if (screenWithFocus == screen)
                {
                    m_sb.Append("[F]");
                }
                m_sb.Append(screen.GetFriendlyName());
                //m_sb.Replace("MyGuiScreen", ""); //This is doing allocations
                m_sb.Append(i < (m_screens.Count - 1) ? ", " : "");
                //                string[] stateString = { "o", "O", "c", "C", "h", "u", "H" };  // debug: show opening/closing state of screens
                //                sb.Append(screen.GetFriendlyName().Replace("MyGuiScreen", "") + "(" + stateString[(int)(screen.GetState())] + ")" + (i < (m_screens.Count - 1) ? ", " : ""));
            }
            return(m_sb);
        }
Beispiel #2
0
        //  Update all screens
        public static void Update(int totalTimeInMS)
        {
            TotalGamePlayTimeInMilliseconds = totalTimeInMS;

            //  We remove, add, remove because sometimes in ADD when calling LoadContent some screen can be marked for remove, so we
            //  need to make sure it's really removed before we enter UPDATE or DRAW loop
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("GuiManager-RemoveScreens");
            RemoveScreens();
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("GuiManager-AddScreens");
            AddScreens();
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("GuiManager-RemoveScreens2");
            RemoveScreens();
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

            MyGuiScreenBase screenWithFocus = GetScreenWithFocus();

            //  Update screens
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("GuiManager-Update screens");

            for (int i = 0; i < m_screens.Count; i++)
            {
                MyGuiScreenBase screen = m_screens[i];

                VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("Update : " + screen.GetFriendlyName());
                screen.Update(screen == screenWithFocus);
                VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
            }

            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }