Ejemplo n.º 1
0
 public void ScreenAdded(MyGuiScreenBase screenBase)
 {
     if (screenBase.GetType() == MyPerGameSettings.GUI.MainMenu && Configuration.Plugin.Get(c => c.ShowMenuPopup))
     {
         //Configuration.Config.Set(c => c.ShowMenuPopup, false);
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info,
                                                              MyMessageBoxButtonsType.OK,
                                                              new StringBuilder(
                                                                  "Welcome to StreamEngineer\nTo get started you need to do some changes to the 'settings.toml' in the plugin folder.\nYou need to restart after changing any service settings,\nyou don't need to restart for settings related to events."),
                                                              new StringBuilder("StreamEngineer")));
     }
 }
        private void AddGroupBox(String text, Type screenType, List <MyGuiControlBase> controlGroup)
        {
            MyGuiControlCheckbox checkBox = AddCheckBox(text, true, null, controlGroup: controlGroup);

            checkBox.IsChecked = s_activeScreen != null && s_activeScreen.GetType() == screenType;
            checkBox.UserData  = screenType;

            s_groupList.Add(checkBox);

            checkBox.IsCheckedChanged += delegate(MyGuiControlCheckbox sender)
            {
                var senderScreenType = sender.UserData as Type;
                if (sender.IsChecked)
                {
                    foreach (MyGuiControlCheckbox chb in s_groupList)
                    {
                        if (chb != sender)
                        {
                            chb.IsChecked = false;
                        }
                    }
                    var newScreen = (MyGuiScreenBase)Activator.CreateInstance(senderScreenType);
                    newScreen.Closed += (source) =>
                    {
                        if (source == s_activeScreen)
                        {
                            s_activeScreen = null;
                        }
                    };
                    MyGuiSandbox.AddScreen(newScreen);
                    s_activeScreen = newScreen;
                }
                else if (s_activeScreen != null && s_activeScreen.GetType() == senderScreenType)
                {
                    s_activeScreen.CloseScreen();
                }
            };
        }
 public static string DisplayName(this MyGuiScreenBase screen)
 {
     return(screen.GetType().Name
            .Replace("MyGuiScreen", "")
            .Replace("My", ""));
 }