コード例 #1
0
        private void DrawControls()
        {
            //  Then draw all screen controls, except opened combobox and drag and drop - must be drawn as last
            // foreach (MyGuiControlBase control in Controls.GetVisibleControls())  //dont use this - allocations
            List <MyGuiControlBase> visibleControls = Controls.GetVisibleControls();

            for (int i = 0; i < visibleControls.Count; i++)
            {
                MyGuiControlBase control = visibleControls[i];
                if (control != m_comboboxHandlingNow && control != m_listboxDragAndDropHandlingNow)
                {
                    if (MyMinerGame.IsPaused() && !control.DrawWhilePaused)
                    {
                        continue;
                    }
                    control.Draw();
                }
            }

            //  Finaly draw opened combobox and dragAndDrop, so it will overdraw all other controls

            if (m_comboboxHandlingNow != null)
            {
                m_comboboxHandlingNow.Draw();
            }

            if (m_listboxDragAndDropHandlingNow != null)
            {
                m_listboxDragAndDropHandlingNow.Draw();
            }

            // draw tooltips only when screen has focus
            if (this == MyGuiManager.GetScreenWithFocus())
            {
                //  Draw tooltips
                for (int i = 0; i < m_controlsVisible.Count; i++)
                {
                    MyGuiControlBase control = m_controlsVisible[i];
                    control.ShowToolTip();
                    if (MyFakes.CONTROLS_MOVE_ENABLED && MyGuiManager.GetInput().IsKeyPress(Keys.M))
                    {
                        DrawControlDebugPosition(control);
                    }
                }
            }
        }