/// <summary> /// Recreates the gui controls and replaces the new game button to insert its own new game menu. /// Also shows a message, if a new version of the plugin is available /// </summary> /// <param name="constructor"></param> public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); if (!m_pauseGame) { m_elemtents = new MyGuiControlElementGroup(); m_elemtents.HighlightChanged += OnHighlightChange; MyGuiControlButton button = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonCampaign)) { button = (MyGuiControlButton)c; } } } if (button != null) { int index = Controls.IndexOf(button); MyGuiControlButton newGameButton = MakeButton(button.Position, MyCommonTexts.ScreenMenuButtonCampaign, OnNewGameClick); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button.Tooltips); } if (!VersionCheck.Static.IsNewest() && !OPENED_VERSION_NOTIFICATION) { OPENED_VERSION_NOTIFICATION = true; MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info, MyMessageBoxButtonsType.YES_NO, new StringBuilder(MyPluginTexts.MESSAGES.UPDATE_AVAILABLE_BOX), new StringBuilder(MyPluginTexts.MESSAGES.UPDATE_AVAILABLE_TITLE), null, null, null, null, OnUpdateNotifiactionMessageClose)); } } MyGuiControlLabel pluginVersionLabel = new MyGuiControlLabel(); pluginVersionLabel.Text = string.Format(PLUGIN_LOADED.ToString(), VersionCheck.Static.GetVersion()); pluginVersionLabel.Position = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, 8, 8); pluginVersionLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; pluginVersionLabel.PositionY -= pluginVersionLabel.Size.Y / 2; MyGuiControlButton pluginSettingsBtn = MyPluginGuiHelper.CreateDebugButton("Settings", OnPluginSettingsClick); pluginSettingsBtn.Position = pluginVersionLabel.Position; pluginSettingsBtn.PositionX += pluginVersionLabel.Size.X + (8 / MyGuiConstants.GUI_OPTIMAL_SIZE.X); pluginSettingsBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; Controls.Add(pluginVersionLabel); Controls.Add(pluginSettingsBtn); }
/// <summary> /// Spawns a planet in the system /// </summary> /// <param name="planet">Planet to spawn</param> /// <param name="position">Position to spawn at</param> private void SpawnPlanet(MySystemObject planet, Vector3D position) { if (planet.Type == MySystemObjectType.PLANET) { MySystemPlanet p = planet as MySystemPlanet; p.CenterPosition = position; MyStarSystemGenerator.Static.AddObjectToSystem(p, callback : delegate(bool success) { if (!success) { MyPluginGuiHelper.DisplayError("Planet could not be spawned, because an object with the same id already exists. This error should not occour, so please try again.", "Error"); } }); } }
/// <summary> /// Action to spawn a planet /// </summary> /// <param name="coordSpawn">If the planet should be spawned at coordinates instead of direct placement</param> private void OnSpawnPlanet(bool coordSpawn = false) { StringBuilder name = new StringBuilder(); m_nameBox.GetText(name); if (name.ToString().Trim().Length <= 3) { MyPluginGuiHelper.DisplayError("The name must be at least 4 letters long", "Error"); return; } if (coordSpawn) { MyGuiScreenDialogCoordinate coordinateInput = new MyGuiScreenDialogCoordinate("Planet coordinate"); coordinateInput.OnConfirmed += delegate(Vector3D coord) { MySystemPlanet p = new MySystemPlanet() { CenterPosition = coord, SubtypeId = ((MyPlanetGeneratorDefinition)m_planetDefList.GetLastSelected().UserData).Id.SubtypeId.ToString(), Generated = false, DisplayName = name.ToString().Trim(), Diameter = m_planetSizeSlider.Value }; SpawnPlanet(p, coord); }; MyGuiSandbox.AddScreen(coordinateInput); return; } float size = m_planetSizeSlider.Value; MySystemPlanet planet = new MySystemPlanet() { CenterPosition = Vector3D.Zero, SubtypeId = ((MyPlanetGeneratorDefinition)m_planetDefList.GetLastSelected().UserData).Id.SubtypeId.ToString(), Generated = false, DisplayName = name.ToString().Trim(), Diameter = size }; MyPluginItemsClipboard.Static.Activate(planet, SpawnPlanet, size); CloseScreenNow(); }
/// <summary> /// Opens the dialog to add a subtype id to the given table /// </summary> /// <param name="table">Table to add item to</param> /// <param name="addAction">Action, which should add the id to the settings file</param> private void OpenEnterIdDialog(MyGuiControlTable table, Action <string> addAction) { MyGuiScreenDialogText inputBox = new MyGuiScreenDialogText(); inputBox.OnConfirmed += delegate(string text) { if (Regex.Match(text, ILLEGAL_XML).Success) { MyPluginGuiHelper.DisplayError("The entered subtype id contains invalid characters (& < >).", "Error, invalid character"); return; } var row = new MyGuiControlTable.Row(text); row.AddCell(new MyGuiControlTable.Cell(text)); table.Add(row); addAction(text); }; MyGuiSandbox.AddScreen(inputBox); }
/// <summary> /// Builds the menu to spawn planets /// </summary> /// <param name="table">Tablet to add editing elements to</param> private void CreatePlanetSpawnMenu(MyGuiControlParentTableLayout table) { var settings = MySettingsSession.Static.Settings.GeneratorSettings; MyGuiControlLabel defLabel = new MyGuiControlLabel(null, null, "Planet"); table.AddTableRow(defLabel); m_planetDefList = new MyGuiControlListbox(); m_planetDefList.VisibleRowsCount = 8; m_planetDefList.MultiSelect = false; table.AddTableRow(m_planetDefList); table.AddTableSeparator(); MyGuiControlLabel sizeLabel = new MyGuiControlLabel(null, null, "Planet size"); table.AddTableRow(sizeLabel); m_planetSizeSlider = new MyGuiControlClickableSlider(null, 1f, settings.PlanetSettings.PlanetSizeCap, m_usableWidth - 0.1f, intValue: true, showLabel: true, labelSuffix: " m"); m_planetSizeSlider.DefaultValue = Math.Min(120000, settings.PlanetSettings.PlanetSizeCap); m_planetSizeSlider.Value = m_planetSizeSlider.DefaultValue.Value; m_planetSizeSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_DIAM); table.AddTableRow(m_planetSizeSlider); table.AddTableSeparator(); MyGuiControlLabel nameLabel = new MyGuiControlLabel(null, null, "Name"); table.AddTableRow(nameLabel); m_nameBox = new MyGuiControlTextbox(); m_nameBox.Size = new Vector2(m_usableWidth, m_nameBox.Size.Y); m_nameBox.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_NAME); table.AddTableRow(m_nameBox); table.AddTableSeparator(); m_spawnPlanetButton = MyPluginGuiHelper.CreateDebugButton(m_usableWidth, "Spawn planet", delegate(MyGuiControlButton button) { OnSpawnPlanet(); }); m_spawnPlanetButton.Enabled = false; m_spawnPlanetButton.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SPAWN); table.AddTableRow(m_spawnPlanetButton); m_spawnPlanetCoordsButton = MyPluginGuiHelper.CreateDebugButton(m_usableWidth, "Spawn planet at coordinates", delegate(MyGuiControlButton button) { OnSpawnPlanet(true); }); m_spawnPlanetCoordsButton.Enabled = false; m_spawnPlanetCoordsButton.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SPAWN_COORD); table.AddTableRow(m_spawnPlanetCoordsButton); m_planetDefList.ItemClicked += delegate(MyGuiControlListbox box) { if (box.SelectedItems[box.SelectedItems.Count - 1] != null) { m_spawnPlanetButton.Enabled = true; m_spawnPlanetCoordsButton.Enabled = true; } else { m_spawnPlanetButton.Enabled = false; m_spawnPlanetCoordsButton.Enabled = false; } }; LoadPlanetDefs(m_planetDefList); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var caption = AddCaption("SEWorldGenPlugin global settings"); caption.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP; caption.Position = new Vector2(0, SIZE.Y / -2 + PADDING.Y); MyGuiControlButton OkButton = new MyGuiControlButton(null, VRage.Game.MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, "Saves the global settings file now and exits this menu", VRage.MyTexts.Get(MyCommonTexts.Ok), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, OnOkButtonClicked); OkButton.Position = new Vector2(0, SIZE.Y / 2 - PADDING.Y); Controls.Add(OkButton); MyGuiControlSeparatorList separators = new MyGuiControlSeparatorList(); separators.AddHorizontal(SIZE / -2 + PADDING + new Vector2(0, caption.Size.Y) + CHILD_MARGINS_VERT, SIZE.X - 2 * PADDING.X); separators.AddHorizontal(new Vector2(SIZE.X / -2 + PADDING.X, SIZE.Y / 2 - PADDING.Y - OkButton.Size.Y) - CHILD_MARGINS_VERT, SIZE.X - 2 * PADDING.X); Controls.Add(separators); MyGuiControlParentTableLayout parent = new MyGuiControlParentTableLayout(2, overflowColumns: true, minWidth: WIDTH); parent.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; var moonsLabel = new MyGuiControlLabel(null, null, "Moons"); var gasGiantLabel = new MyGuiControlLabel(null, null, "Gas giants"); var sunLabel = new MyGuiControlLabel(null, null, "Suns"); var mandatoryLabel = new MyGuiControlLabel(null, null, "Mandatory planets and moons"); var blacklistLabel = new MyGuiControlLabel(null, null, "Blacklisted planets and moons"); var planetNameLabel = new MyGuiControlLabel(null, null, "Planet name format"); var moonNameLabel = new MyGuiControlLabel(null, null, "Moon name format"); var beltNameLabel = new MyGuiControlLabel(null, null, "Belt name format"); #region Tables ///Moons table m_moonDefsTable = new MyGuiControlTable(); m_moonDefsTable.VisibleRowsCount = 8; m_moonDefsTable.Size = new Vector2(WIDTH, m_moonDefsTable.Size.Y); m_moonDefsTable.ColumnsCount = 1; m_moonDefsTable.SetCustomColumnWidths(new float[] { WIDTH }); m_moonDefsTable.SetColumnName(0, new System.Text.StringBuilder("Subtype ID")); var addMoonBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Moon", delegate { OpenEnterIdDialog(m_moonDefsTable, delegate(string name) { MySettings.Static.Settings.MoonDefinitions.Add(name); }); }); var remMoonBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Remove Moon", delegate { MySettings.Static.Settings.MoonDefinitions.Remove(m_moonDefsTable.SelectedRow.UserData as string); m_moonDefsTable.RemoveSelectedRow(); }); remMoonBtn.Enabled = false; m_moonDefsTable.FocusChanged += delegate { remMoonBtn.Enabled = m_moonDefsTable.HasFocus && m_moonDefsTable.SelectedRow != null; }; m_moonDefsTable.ItemSelected += delegate(MyGuiControlTable table, MyGuiControlTable.EventArgs args) { remMoonBtn.Enabled = m_moonDefsTable.HasFocus && m_moonDefsTable.SelectedRow != null; }; parent.AddTableRow(moonsLabel); parent.AddTableRow(m_moonDefsTable); parent.AddTableRow(addMoonBtn, remMoonBtn); parent.AddTableSeparator(); ///Gas giant table m_gasGiantsDefsTable = new MyGuiControlTable(); m_gasGiantsDefsTable.VisibleRowsCount = 8; m_gasGiantsDefsTable.Size = new Vector2(WIDTH, m_gasGiantsDefsTable.Size.Y); m_gasGiantsDefsTable.ColumnsCount = 1; m_gasGiantsDefsTable.SetCustomColumnWidths(new float[] { WIDTH }); m_gasGiantsDefsTable.SetColumnName(0, new System.Text.StringBuilder("Subtype ID")); MyGuiControlParentTableLayout gasGiantBtns = new MyGuiControlParentTableLayout(2, padding: new Vector2(0)); var addGasGiantBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Gas Giant", delegate { OpenEnterIdDialog(m_gasGiantsDefsTable, delegate(string name) { MySettings.Static.Settings.GasGiantDefinitions.Add(name); }); }); var remGasGiantBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Remove Gas Giant", delegate { MySettings.Static.Settings.GasGiantDefinitions.Remove(m_gasGiantsDefsTable.SelectedRow.UserData as string); m_gasGiantsDefsTable.RemoveSelectedRow(); }); remGasGiantBtn.Enabled = false; m_gasGiantsDefsTable.FocusChanged += delegate { remGasGiantBtn.Enabled = m_gasGiantsDefsTable.HasFocus && m_gasGiantsDefsTable.SelectedRow != null; }; m_gasGiantsDefsTable.ItemSelected += delegate(MyGuiControlTable table, MyGuiControlTable.EventArgs args) { remGasGiantBtn.Enabled = table.SelectedRow != null; }; parent.AddTableRow(gasGiantLabel); parent.AddTableRow(m_gasGiantsDefsTable); parent.AddTableRow(addGasGiantBtn, remGasGiantBtn); parent.AddTableSeparator(); ///Suns table m_sunDefsTable = new MyGuiControlTable(); m_sunDefsTable.VisibleRowsCount = 8; m_sunDefsTable.Size = new Vector2(WIDTH, m_sunDefsTable.Size.Y); m_sunDefsTable.ColumnsCount = 1; m_sunDefsTable.SetCustomColumnWidths(new float[] { WIDTH }); m_sunDefsTable.SetColumnName(0, new System.Text.StringBuilder("Subtype ID")); var addSunBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Sun", delegate { OpenEnterIdDialog(m_sunDefsTable, delegate(string name) { MySettings.Static.Settings.SunDefinitions.Add(name); }); }); var remSunBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Remove Sun", delegate { MySettings.Static.Settings.SunDefinitions.Remove(m_sunDefsTable.SelectedRow.UserData as string); m_sunDefsTable.RemoveSelectedRow(); }); remSunBtn.Enabled = false; m_sunDefsTable.FocusChanged += delegate { remSunBtn.Enabled = m_sunDefsTable.HasFocus && m_sunDefsTable.SelectedRow != null; }; m_sunDefsTable.ItemSelected += delegate(MyGuiControlTable table, MyGuiControlTable.EventArgs args) { remSunBtn.Enabled = table.SelectedRow != null; }; parent.AddTableRow(sunLabel); parent.AddTableRow(m_sunDefsTable); parent.AddTableRow(addSunBtn, remSunBtn); parent.AddTableSeparator(); ///Mandatory table m_mandatoryDefsTable = new MyGuiControlTable(); m_mandatoryDefsTable.VisibleRowsCount = 8; m_mandatoryDefsTable.Size = new Vector2(WIDTH, m_mandatoryDefsTable.Size.Y); m_mandatoryDefsTable.ColumnsCount = 1; m_mandatoryDefsTable.SetCustomColumnWidths(new float[] { WIDTH }); m_mandatoryDefsTable.SetColumnName(0, new System.Text.StringBuilder("Subtype ID")); var addMandatoryBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Mandatory", delegate { OpenEnterIdDialog(m_mandatoryDefsTable, delegate(string name) { MySettings.Static.Settings.MandatoryPlanetDefinitions.Add(name); }); }); var remMandatoryBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Remove Mandatory", delegate { MySettings.Static.Settings.MandatoryPlanetDefinitions.Remove(m_mandatoryDefsTable.SelectedRow.UserData as string); m_mandatoryDefsTable.RemoveSelectedRow(); }); remMandatoryBtn.Enabled = false; m_mandatoryDefsTable.FocusChanged += delegate { remMandatoryBtn.Enabled = m_mandatoryDefsTable.HasFocus && m_mandatoryDefsTable.SelectedRow != null; }; m_mandatoryDefsTable.ItemSelected += delegate(MyGuiControlTable table, MyGuiControlTable.EventArgs args) { remMandatoryBtn.Enabled = table.SelectedRow != null; }; parent.AddTableRow(mandatoryLabel); parent.AddTableRow(m_mandatoryDefsTable); parent.AddTableRow(addMandatoryBtn, remMandatoryBtn); parent.AddTableSeparator(); ///Blacklist table m_blacklistDefsTable = new MyGuiControlTable(); m_blacklistDefsTable.VisibleRowsCount = 8; m_blacklistDefsTable.Size = new Vector2(WIDTH, m_blacklistDefsTable.Size.Y); m_blacklistDefsTable.ColumnsCount = 1; m_blacklistDefsTable.SetCustomColumnWidths(new float[] { WIDTH }); m_blacklistDefsTable.SetColumnName(0, new System.Text.StringBuilder("Subtype ID")); var addBlacklistBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add to Blacklist", delegate { OpenEnterIdDialog(m_blacklistDefsTable, delegate(string name) { MySettings.Static.Settings.BlacklistedPlanetDefinitions.Add(name); }); }); var remBlacklistBtn = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Remove from Blacklist", delegate { MySettings.Static.Settings.BlacklistedPlanetDefinitions.Remove(m_blacklistDefsTable.SelectedRow.UserData as string); m_blacklistDefsTable.RemoveSelectedRow(); }); remBlacklistBtn.Enabled = false; m_blacklistDefsTable.FocusChanged += delegate { remBlacklistBtn.Enabled = m_blacklistDefsTable.HasFocus && m_blacklistDefsTable.SelectedRow != null; }; m_blacklistDefsTable.ItemSelected += delegate(MyGuiControlTable table, MyGuiControlTable.EventArgs args) { remBlacklistBtn.Enabled = table.SelectedRow != null; }; parent.AddTableRow(blacklistLabel); parent.AddTableRow(m_blacklistDefsTable); parent.AddTableRow(addBlacklistBtn, remBlacklistBtn); #endregion parent.AddTableSeparator(); #region NameFormats ///Planet name box m_planetNameBox = new MyGuiControlTextbox(); m_planetNameBox.Size = new Vector2(WIDTH, m_planetNameBox.Size.Y); m_planetNameBox.TextChanged += delegate { StringBuilder s = new StringBuilder(); m_planetNameBox.GetText(s); MySettings.Static.Settings.PlanetNameFormat = s.ToString(); }; MyGuiControlParentTableLayout formatButtons = new MyGuiControlParentTableLayout(3, padding: new Vector2(0)); var planetNameButtons1 = new MyGuiControlButton[3]; var planetNameButtons2 = new MyGuiControlButton[3]; planetNameButtons1[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Object Number", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_NUMBER); }); planetNameButtons1[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Roman number", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_NUMBER_ROMAN); }); planetNameButtons1[2] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Greek number", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_NUMBER_GREEK); }); planetNameButtons2[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add lower letter", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_LETTER_LOWER); }); planetNameButtons2[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add upper letter", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_LETTER_UPPER); }); planetNameButtons2[2] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add id", delegate { MySettings.Static.Settings.PlanetNameFormat = AddNameProperty(m_planetNameBox, MyNamingUtils.PROP_OBJ_ID); }); m_planetNameBox.TextChanged += delegate(MyGuiControlTextbox t) { var sb = new StringBuilder(); t.GetText(sb); MySettings.Static.Settings.PlanetNameFormat = sb.ToString(); }; formatButtons.AddTableRow(planetNameButtons1); formatButtons.AddTableRow(planetNameButtons2); formatButtons.ApplyRows(); parent.AddTableRow(planetNameLabel); parent.AddTableRow(m_planetNameBox); parent.AddTableRow(formatButtons); parent.AddTableSeparator(); ///Moon name box m_moonNameBox = new MyGuiControlTextbox(); m_moonNameBox.Size = new Vector2(WIDTH, m_moonNameBox.Size.Y); m_moonNameBox.TextChanged += delegate { StringBuilder s = new StringBuilder(); m_moonNameBox.GetText(s); MySettings.Static.Settings.MoonNameFormat = s.ToString(); }; MyGuiControlParentTableLayout formatButtonsMoon = new MyGuiControlParentTableLayout(3, padding: new Vector2(0)); var moonNameButtons1 = new MyGuiControlButton[3]; var moonNameButtons2 = new MyGuiControlButton[3]; moonNameButtons1[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Object Number", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_NUMBER); }); moonNameButtons1[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Roman number", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_NUMBER_ROMAN); }); moonNameButtons1[2] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Greek number", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_NUMBER_GREEK); }); moonNameButtons2[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add lower letter", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_LETTER_LOWER); }); moonNameButtons2[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add upper letter", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_LETTER_UPPER); }); moonNameButtons2[2] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add id", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_ID); }); var btnExtra = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add parent name", delegate { MySettings.Static.Settings.MoonNameFormat = AddNameProperty(m_moonNameBox, MyNamingUtils.PROP_OBJ_PARENT); }); m_moonNameBox.TextChanged += delegate(MyGuiControlTextbox t) { var sb = new StringBuilder(); t.GetText(sb); MySettings.Static.Settings.MoonNameFormat = sb.ToString(); }; formatButtonsMoon.AddTableRow(moonNameButtons1); formatButtonsMoon.AddTableRow(moonNameButtons2); formatButtonsMoon.AddTableRow(btnExtra); formatButtonsMoon.ApplyRows(); parent.AddTableRow(moonNameLabel); parent.AddTableRow(m_moonNameBox); parent.AddTableRow(formatButtonsMoon); parent.AddTableSeparator(); ///Belt name box m_beltNameBox = new MyGuiControlTextbox(); m_beltNameBox.Size = new Vector2(WIDTH, m_beltNameBox.Size.Y); m_beltNameBox.TextChanged += delegate { StringBuilder s = new StringBuilder(); m_beltNameBox.GetText(s); MySettings.Static.Settings.BeltNameFormat = s.ToString(); }; MyGuiControlParentTableLayout formatButtonsBelt = new MyGuiControlParentTableLayout(3, padding: new Vector2(0)); var beltNameButtons1 = new MyGuiControlButton[3]; var beltNameButtons2 = new MyGuiControlButton[2]; beltNameButtons1[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Object Number", delegate { MySettings.Static.Settings.BeltNameFormat = AddNameProperty(m_beltNameBox, MyNamingUtils.PROP_OBJ_NUMBER); }); beltNameButtons1[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Roman number", delegate { MySettings.Static.Settings.BeltNameFormat = AddNameProperty(m_beltNameBox, MyNamingUtils.PROP_OBJ_NUMBER_ROMAN); }); beltNameButtons1[2] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add Greek number", delegate { MySettings.Static.Settings.BeltNameFormat = AddNameProperty(m_beltNameBox, MyNamingUtils.PROP_OBJ_NUMBER_GREEK); }); beltNameButtons2[0] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add lower letter", delegate { MySettings.Static.Settings.BeltNameFormat = AddNameProperty(m_beltNameBox, MyNamingUtils.PROP_OBJ_LETTER_LOWER); }); beltNameButtons2[1] = MyPluginGuiHelper.CreateDebugButton(DBG_BTN_WIDTH, "Add upper letter", delegate { MySettings.Static.Settings.BeltNameFormat = AddNameProperty(m_beltNameBox, MyNamingUtils.PROP_OBJ_LETTER_UPPER); }); m_beltNameBox.TextChanged += delegate(MyGuiControlTextbox t) { var sb = new StringBuilder(); t.GetText(sb); MySettings.Static.Settings.BeltNameFormat = sb.ToString(); }; formatButtonsBelt.AddTableRow(beltNameButtons1); formatButtonsBelt.AddTableRow(beltNameButtons2); formatButtonsBelt.ApplyRows(); parent.AddTableRow(beltNameLabel); parent.AddTableRow(m_beltNameBox); parent.AddTableRow(formatButtonsBelt); #endregion parent.ApplyRows(); Vector2 start = SIZE / -2 + PADDING + new Vector2(0, caption.Size.Y) + CHILD_MARGINS_VERT * 2; Vector2 end = new Vector2(SIZE.X / 2 - PADDING.X, SIZE.Y / 2 - PADDING.Y - OkButton.Size.Y) - CHILD_MARGINS_VERT * 2; MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(parent); scrollPane.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; scrollPane.ScrollbarVEnabled = true; scrollPane.Size = end - start; scrollPane.Position = start; Controls.Add(scrollPane); }