Exemple #1
0
        private void AddGroupBox(string text, ModDebugScreenComponent screenType, List <MyGuiControlBase> controlGroup)
        {
            var box = AddCheckBox(text, true, null, controlGroup: controlGroup);

            box.IsChecked = false;

            box.OnCheckedChanged += sender =>
            {
                if (sender.IsChecked)
                {
                    foreach (var myGuiControlBase in controlGroup)
                    {
                        if (myGuiControlBase != sender && myGuiControlBase is MyGuiControlCheckbox chb)
                        {
                            chb.IsChecked = false;
                        }
                    }

                    var newScreen = screenType.Construct();
                    newScreen.Closed += source => box.IsChecked = false;
                    _activeScreen?.CloseScreen();
                    _container.AddScreen(newScreen);
                    _activeScreen = newScreen;
                }
                else if (_activeScreen != null && _activeScreen.GetType() == screenType.ScreenType)
                {
                    _container.RemoveScreen(_activeScreen);
                    _activeScreen = null;
                }
            };
        }
 public static void SwitchModDebugScreen()
 {
     if (MyInput.Static.ENABLE_DEVELOPER_KEYS || !Sync.MultiplayerActive)
     {
         if (m_currentDebugScreen != null)
         {
             if (m_currentDebugScreen is MyGuiScreenDebugOfficial)
             {
                 m_currentDebugScreen.CloseScreen();
                 m_currentDebugScreen = null;
             }
         }
         else
         {
             ShowModDebugScreen();
         }
     }
 }