/// <summary> /// Creates the menu to spawn asteroid objects /// </summary> /// <param name="table">Table to add elements to</param> private void CreateAsteroidSpawnMenu(MyGuiControlParentTableLayout table) { m_asteroidTypeCombo = new MyGuiControlCombobox(); foreach (var provider in m_asteroidProviders) { m_asteroidTypeCombo.AddItem(m_asteroidProviders.IndexOf(provider), provider.GetTypeName()); } m_asteroidTypeCombo.SelectItemByKey(m_asteroidType); m_asteroidTypeCombo.ItemSelected += delegate { if (m_asteroidType != m_asteroidTypeCombo.GetSelectedKey()) { m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().Close(); } m_asteroidType = m_asteroidTypeCombo.GetSelectedKey(); RecreateControls(false); }; m_asteroidTypeCombo.Size = new Vector2(m_usableWidth * 0.9f, m_asteroidTypeCombo.Size.Y); m_asteroidTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_ROID_TYPE); table.AddTableRow(m_asteroidTypeCombo); m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().CreateSpawnMenu(m_usableWidth, table, this); }
/// <summary> /// Builds the spawn menu /// </summary> private void BuildSpawnMenu() { MyPluginLog.Debug("Create Spawn Menu"); var topCombo = GetCombo(); Vector2 start = topCombo.Position + new Vector2(0, MARGIN_VERT * 2 + GetCombo().Size.Y); Vector2 end = start + new Vector2(topCombo.Size.X, 0.8f - MARGIN_VERT); MyGuiControlParentTableLayout table = new MyGuiControlParentTableLayout(1, false, Vector2.Zero); table.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_spawnTypeCombo = new MyGuiControlCombobox(); m_spawnTypeCombo.AddItem(0L, "Planet"); m_spawnTypeCombo.AddItem(1L, "Asteroid object"); m_spawnTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_spawnTypeCombo.SelectItemByKey(m_spawnType); m_spawnTypeCombo.ItemSelected += OnSpawnTypeChange; m_spawnTypeCombo.Size = new Vector2(m_usableWidth * 0.9f, m_spawnTypeCombo.Size.Y); m_spawnTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_SPAWN_TYPE); table.AddTableRow(m_spawnTypeCombo); table.AddTableSeparator(); switch (m_spawnType) { case 0L: CreatePlanetSpawnMenu(table); break; case 1L: CreateAsteroidSpawnMenu(table); break; } table.AddTableSeparator(); table.ApplyRows(); MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(table); scrollPane.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP; scrollPane.ScrollbarVEnabled = true; scrollPane.Size = end - start; scrollPane.Size = new Vector2(0.315f, scrollPane.Size.Y); scrollPane.Position = new Vector2(0, start.Y); Controls.Add(scrollPane); MyGuiControlSeparatorList sep = new MyGuiControlSeparatorList(); sep.AddHorizontal(new Vector2(scrollPane.Position.X - scrollPane.Size.X / 2, scrollPane.Position.Y + scrollPane.Size.Y), m_usableWidth); Controls.Add(sep); MyPluginLog.Debug("Added spawn menu"); }
public bool OnEditMenuSelectItem(float usableWidth, MyGuiControlParentTableLayout parentTable, MyPluginAdminMenu adminScreen, MySystemAsteroids asteroidObject, MyObjectBuilder_SystemData starSystem) { m_parentScreen = adminScreen; m_currentSelectedAsteroid = asteroidObject; MyGuiControlButton teleportToRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Teleport to sphere", OnTeleportToSphere); parentTable.AddTableRow(teleportToRingButton); MyGuiControlButton deleteRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Remove sphere", OnRemoveSphere); parentTable.AddTableRow(deleteRingButton); parentTable.AddTableSeparator(); var data = MyAsteroidSphereProvider.Static.GetInstanceData(asteroidObject); var sphere = data as MyAsteroidSphereData; m_parentScreen.CameraLookAt(asteroidObject.CenterPosition, (float)sphere.OuterRadius * 2f); RenderSpherePreview(sphere); return(true); }
public bool OnEditMenuSelectItem(float usableWidth, MyGuiControlParentTableLayout parentTable, MyPluginAdminMenu adminScreen, MySystemAsteroids asteroidObject, MyObjectBuilder_SystemData starSystem) { m_parentScreen = adminScreen; m_currentSelectedAsteroid = asteroidObject; m_offset = Vector3D.Zero; m_fetchedStarSytem = starSystem; GenerateRingSettingElements(usableWidth, parentTable); SetSliderValues(m_currentSelectedAsteroid); MyGuiControlButton teleportToRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Teleport to ring", OnTeleportToRing); parentTable.AddTableRow(teleportToRingButton); MyGuiControlButton deleteRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Remove ring", OnRemoveRing); parentTable.AddTableRow(deleteRingButton); MyGuiControlButton editRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Edit ring", OnEditRing); parentTable.AddTableRow(editRingButton); parentTable.AddTableSeparator(); var data = MyAsteroidRingProvider.Static.GetInstanceData(asteroidObject); var ring = data as MyAsteroidRingData; m_parentScreen.CameraLookAt(asteroidObject.CenterPosition, (float)ring.Radius * 1.5f); UpdateRingVisual(ring); return(true); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var caption = AddCaption("SEWorldGenPlugin world 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, null, VRage.MyTexts.Get(MyCommonTexts.Ok), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, OkButtonClicked); 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); parent.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; //Generate rows for parent layout containing settings var systemGenLabel = new MyGuiControlLabel(null, null, "Generator mode"); var asteroidGenLabel = new MyGuiControlLabel(null, null, "Asteroid generator mode"); var enableVanillaLabel = new MyGuiControlLabel(null, null, "Use vanilla planets"); var planetCountLabel = new MyGuiControlLabel(null, null, "Planet count"); var asteroidCountLabel = new MyGuiControlLabel(null, null, "Asteroid object count"); var oribtDistanceLabel = new MyGuiControlLabel(null, null, "Orbit distances"); var asteroidDensityLabel = new MyGuiControlLabel(null, null, "Asteroid density"); var worldSizeLabel = new MyGuiControlLabel(null, null, "World size"); var planetSizeCapLabel = new MyGuiControlLabel(null, null, "Planet size cap"); var planetSizeMultLabel = new MyGuiControlLabel(null, null, "Planet size multiplier"); var planetMoonPropLabel = new MyGuiControlLabel(null, null, "Planet moon probability"); var planetRingPropLabel = new MyGuiControlLabel(null, null, "Planet ring probability"); var planetMoonCountLabel = new MyGuiControlLabel(null, null, "Planet moon count"); var planetGpsModeLabel = new MyGuiControlLabel(null, null, "Planet gps mode"); var moonGpsModeLabel = new MyGuiControlLabel(null, null, "Moon gps mode"); var asteroidGpsModeLabel = new MyGuiControlLabel(null, null, "Asteroid gps mode"); m_systemGeneratorCombo = new MyGuiControlCombobox(null, null); m_systemGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.SYS_GEN_MODE_COMBO); m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.FULL_RANDOM, "Full random"); m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.UNIQUE, "Unique"); m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.MANDATORY_FIRST, "Mandatory first"); m_systemGeneratorCombo.AddItem((long)SystemGenerationMethod.MANDATORY_ONLY, "Mandatory only"); m_systemGeneratorCombo.Size = new Vector2(0.25f, m_systemGeneratorCombo.Size.Y); parent.AddTableRow(systemGenLabel, m_systemGeneratorCombo); m_asteroidGeneratorCombo = new MyGuiControlCombobox(); m_asteroidGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_GEN_MODE_COMBO); m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.PLUGIN, "Plugin"); m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.VANILLA, "Vanilla"); m_asteroidGeneratorCombo.AddItem((long)AsteroidGenerationMethod.BOTH, "Combined"); m_asteroidGeneratorCombo.ItemSelected += delegate { m_asteroidGPSModeCombo.Enabled = m_asteroidGPSModeCombo.GetSelectedIndex() != (long)AsteroidGenerationMethod.VANILLA; m_asteroidDensitySlider.Enabled = m_asteroidGPSModeCombo.GetSelectedIndex() != (long)AsteroidGenerationMethod.VANILLA; }; m_asteroidGeneratorCombo.Size = new Vector2(0.25f, m_asteroidGeneratorCombo.Size.Y); parent.AddTableRow(asteroidGenLabel, m_asteroidGeneratorCombo); m_enableVanillaPlanetsCheckbox = new MyGuiControlCheckbox(); m_enableVanillaPlanetsCheckbox.SetToolTip(MyPluginTexts.TOOLTIPS.VANILLA_PLANETS_CHECK); parent.AddTableRow(enableVanillaLabel, m_enableVanillaPlanetsCheckbox); m_planetCountSlider = new MyGuiControlRangedSlider(0, 50, 5, 15, true, width: 0.25f); m_planetCountSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_COUNT_SLIDER); parent.AddTableRow(planetCountLabel, m_planetCountSlider); m_asteroidCountSlider = new MyGuiControlRangedSlider(0, 50, 5, 15, true, width: 0.25f); m_asteroidCountSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_COUNT_SLIDER); parent.AddTableRow(asteroidCountLabel, m_asteroidCountSlider); m_orbitDistancesSlider = new MyGuiControlRangedSlider(100, 10000000, 40000, 1000000, width: 0.25f, useLogScale: true); m_orbitDistancesSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ORBIT_DISTANCE_SLIDER); parent.AddTableRow(oribtDistanceLabel, m_orbitDistancesSlider); m_asteroidDensitySlider = new MyGuiControlClickableSlider(minValue: 0, maxValue: 1, defaultValue: 0.6f, width: 0.25f, showLabel: true); m_asteroidDensitySlider.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_DENS_SLIDER); parent.AddTableRow(asteroidDensityLabel, m_asteroidDensitySlider); m_worldSizeSlider = new MyGuiControlClickableSlider(minValue: -1, maxValue: 1000000000, defaultValue: -1, width: 0.25f, showLabel: true, labelSuffix: " Km"); m_worldSizeSlider.SetToolTip(MyPluginTexts.TOOLTIPS.WORLD_SIZE_SLIDER); m_worldSizeSlider.OnLabelUpdate += delegate(MyGuiControlLabel l) { if (m_worldSizeSlider.Value < 0) { l.Text = "Infinite"; } }; parent.AddTableRow(worldSizeLabel, m_worldSizeSlider); m_planetSizeCapSlider = new MyGuiControlClickableSlider(minValue: 1, maxValue: 2400000, defaultValue: 1200000, intValue: true, width: 0.25f, showLabel: true, labelSuffix: " m"); m_planetSizeCapSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_SIZE_CAP_SLIDER); parent.AddTableRow(planetSizeCapLabel, m_planetSizeCapSlider); m_planetSizeMultSlider = new MyGuiControlClickableSlider(minValue: 0.1f, maxValue: 10, defaultValue: 2, width: 0.25f, showLabel: true); m_planetSizeMultSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_SIZE_MULT); parent.AddTableRow(planetSizeMultLabel, m_planetSizeMultSlider); m_planetMoonBasePropSlider = new MyGuiControlClickableSlider(minValue: 0f, maxValue: 1f, defaultValue: 0.5f, width: 0.25f, showLabel: true); m_planetMoonBasePropSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_MOON_PROP); parent.AddTableRow(planetMoonPropLabel, m_planetMoonBasePropSlider); m_planetRingBasePropSlider = new MyGuiControlClickableSlider(minValue: 0f, maxValue: 1f, defaultValue: 0.5f, width: 0.25f, showLabel: true); m_planetRingBasePropSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_RING_PROP); parent.AddTableRow(planetRingPropLabel, m_planetRingBasePropSlider); m_planetMoonMinMaxSlider = new MyGuiControlRangedSlider(1, 50, 1, 25, true, showLabel: true, width: 0.25f); m_planetMoonMinMaxSlider.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_MOON_COUNT); parent.AddTableRow(planetMoonCountLabel, m_planetMoonMinMaxSlider); m_planetGPSModeCombo = new MyGuiControlCombobox(); m_planetGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_GPS_COMBO); m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery"); m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent"); m_planetGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None"); m_planetGPSModeCombo.Size = new Vector2(0.25f, m_planetGPSModeCombo.Size.Y); parent.AddTableRow(planetGpsModeLabel, m_planetGPSModeCombo); m_moonGPSModeCombo = new MyGuiControlCombobox(); m_moonGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.MOON_GPS_COMBO); m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery"); m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent"); m_moonGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None"); m_moonGPSModeCombo.Size = new Vector2(0.25f, m_moonGPSModeCombo.Size.Y); parent.AddTableRow(moonGpsModeLabel, m_moonGPSModeCombo); m_asteroidGPSModeCombo = new MyGuiControlCombobox(); m_asteroidGPSModeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ASTEROID_GPS_COMBO); m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.DISCOVERY, "Discovery"); m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.PERSISTENT, "Persistent"); m_asteroidGPSModeCombo.AddItem((long)MyGPSGenerationMode.NONE, "None"); m_asteroidGPSModeCombo.Size = new Vector2(0.25f, m_asteroidGPSModeCombo.Size.Y); parent.AddTableRow(asteroidGpsModeLabel, m_asteroidGPSModeCombo); 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); }
public bool CreateSpawnMenu(float usableWidth, MyGuiControlParentTableLayout parentTable, MyPluginAdminMenu adminScreen) { m_parentScreen = adminScreen; if (m_fetchedStarSytem == null) { MyGuiControlRotatingWheel loadingWheel = new MyGuiControlRotatingWheel(position: Vector2.Zero); loadingWheel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; adminScreen.Controls.Add(loadingWheel); MyStarSystemGenerator.Static.GetStarSystem(delegate(MyObjectBuilder_SystemData starSystem) { m_fetchedStarSytem = starSystem; adminScreen.ShouldRecreate = true; }); return(true); } MyGuiControlLabel label = new MyGuiControlLabel(null, null, "Parent objects"); parentTable.AddTableRow(label); m_parentObjectListBox = new MyGuiControlListbox(); m_parentObjectListBox.Add(new MyGuiControlListbox.Item(new System.Text.StringBuilder("System center"), userData: m_fetchedStarSytem.CenterObject)); m_parentObjectListBox.VisibleRowsCount = 8; m_parentObjectListBox.Size = new Vector2(usableWidth, m_parentObjectListBox.Size.Y); m_parentObjectListBox.SelectAllVisible(); m_parentObjectListBox.ItemsSelected += OnParentItemClicked; foreach (var obj in m_fetchedStarSytem.CenterObject.GetAllChildren()) { if (obj.Type == MySystemObjectType.PLANET || obj.Type == MySystemObjectType.MOON) { m_parentObjectListBox.Add(new MyGuiControlListbox.Item(new System.Text.StringBuilder(obj.DisplayName), userData: obj)); } } parentTable.AddTableRow(m_parentObjectListBox); parentTable.AddTableSeparator(); m_radiusSlider = new MyGuiControlClickableSlider(width: usableWidth - 0.1f, minValue: 0, maxValue: 1, labelSuffix: " km", showLabel: true); m_radiusSlider.Enabled = false; m_radiusSlider.ValueChanged += delegate { RenderSpherePreview(GetDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Radius")); parentTable.AddTableRow(m_radiusSlider); m_widthSlider = new MyGuiControlClickableSlider(null, 0, 1, usableWidth - 0.1f, 0.5f, showLabel: true, labelSuffix: " km"); m_widthSlider.Enabled = false; m_widthSlider.ValueChanged += delegate { RenderSpherePreview(GetDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Width")); parentTable.AddTableRow(m_widthSlider); m_asteroidSizesSlider = new MyGuiControlRangedSlider(32, 1024, 32, 1024, true, width: usableWidth - 0.1f, showLabel: true); m_asteroidSizesSlider.Enabled = false; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Asteroid size range")); parentTable.AddTableRow(m_asteroidSizesSlider); m_nameBox = new MyGuiControlTextbox(); m_nameBox.Size = new Vector2(usableWidth, m_nameBox.Size.Y); parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Name")); parentTable.AddTableRow(m_nameBox); m_spawnButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Spawn sphere", delegate { StringBuilder name = new StringBuilder(); m_nameBox.GetText(name); if (name.Length < 4) { MyPluginGuiHelper.DisplayError("Name must be at least 4 letters long", "Error"); return; } MySystemAsteroids instance; MyAsteroidSphereData data; GenerateData(out instance, out data); if (instance == null || data == null) { MyPluginGuiHelper.DisplayError("Could not generate asteroid sphere. No data found.", "Error"); return; } MyAsteroidSphereProvider.Static.AddInstance(instance, data, delegate(bool success) { if (!success) { MyPluginGuiHelper.DisplayError("Sphere could not be added, because an object with the same id already exists. This error should not occour, so please try again.", "Error"); } else { MyPluginGuiHelper.DisplayMessage("Sphere was created successfully.", "Success"); m_parentScreen.ForceFetchStarSystem = true; m_parentScreen.ShouldRecreate = true; } }); }); parentTable.AddTableSeparator(); parentTable.AddTableRow(m_spawnButton); return(true); }
/// <summary> /// Builds all elements to edit planets /// </summary> /// <param name="table">Table to add the elements to</param> /// <param name="planet">Planet item to build the edit menu for</param> private void BuildPlanetEditingMenu(MyGuiControlParentTableLayout table, MySystemPlanet planet) { table.AddTableRow(new MyGuiControlLabel(null, null, "This object cant be edited.", font: "Red")); }
/// <summary> /// Creates the sub menu for the currently selected system object, that contains the /// elements to edit it. /// </summary> private void BuildEditingSubMenu() { if (m_scrollTable != null) { Controls.Remove(m_scrollPane); } m_scrollTable = new MyGuiControlParentTableLayout(1, false, Vector2.Zero, m_usableWidth); m_scrollTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_scrollTable.AddTableSeparator(); if (m_scrollTable == null) { m_scrollTable = new MyGuiControlParentTableLayout(1, false, Vector2.Zero, m_usableWidth); } else { m_scrollTable.ClearTable(); } m_currentAsteroidAdminMenu = null; if (m_selectedObject != null) { if (m_selectedObject.Type == MySystemObjectType.PLANET || m_selectedObject.Type == MySystemObjectType.MOON) { BuildPlanetEditingMenu(m_scrollTable, m_selectedObject as MySystemPlanet); m_scrollTable.AddTableSeparator(); CameraLookAt(m_selectedObject.CenterPosition, (float)(m_selectedObject as MySystemPlanet).Diameter * 1.5f); } else if (m_selectedObject.Type == MySystemObjectType.ASTEROIDS) { var asteroidObject = m_selectedObject as MySystemAsteroids; if (!MyAsteroidObjectsManager.Static.AsteroidObjectProviders.ContainsKey(asteroidObject.AsteroidTypeName)) { return; } var provider = MyAsteroidObjectsManager.Static.AsteroidObjectProviders[asteroidObject.AsteroidTypeName]; var creator = provider.GetAdminMenuCreator(); if (creator != null) { if (!creator.OnEditMenuSelectItem(m_usableWidth, m_scrollTable, this, asteroidObject, m_fetchedStarSytem)) { m_scrollTable.AddTableRow(new MyGuiControlLabel(null, null, "This object cant be edited.", font: "Red")); m_scrollTable.AddTableSeparator(); } m_currentAsteroidAdminMenu = creator; } } } m_scrollTable.ApplyRows(); var topCombo = GetCombo(); Vector2 start = m_systemObjectsBox.Position + new Vector2(-0.001f, MARGIN_VERT * 2 + m_systemObjectsBox.Size.Y); Vector2 end = new Vector2(topCombo.Size.X, 0.5f - MARGIN_VERT); m_scrollPane = new MyGuiControlScrollablePanel(m_scrollTable); m_scrollPane.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP; m_scrollPane.ScrollbarVEnabled = true; m_scrollPane.Size = end - start; m_scrollPane.Size = new Vector2(0.315f, m_scrollPane.Size.Y); m_scrollPane.Position = new Vector2(0, start.Y); Controls.Add(m_scrollPane); }
/// <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); }
/// <summary> /// Generates the specific gui elements to set ring data and puts them into the parent table /// </summary> /// <param name="usableWidth">Usable width for gui elements</param> /// <param name="parentTable">Parent table</param> private void GenerateRingSettingElements(float usableWidth, MyGuiControlParentTableLayout parentTable) { m_radiusSlider = new MyGuiControlClickableSlider(width: usableWidth - 0.1f, minValue: 0, maxValue: 1, labelSuffix: " km", showLabel: true); m_radiusSlider.Enabled = false; m_radiusSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Radius")); parentTable.AddTableRow(m_radiusSlider); m_widthSlider = new MyGuiControlClickableSlider(null, 0, 1, usableWidth - 0.1f, 0.5f, showLabel: true, labelSuffix: " km"); m_widthSlider.Enabled = false; m_widthSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Width")); parentTable.AddTableRow(m_widthSlider); m_heightSlider = new MyGuiControlClickableSlider(null, 0, 1, usableWidth - 0.1f, 0.5f, showLabel: true, labelSuffix: " km"); m_heightSlider.Enabled = false; m_heightSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Height")); parentTable.AddTableRow(m_heightSlider); m_asteroidSizesSlider = new MyGuiControlRangedSlider(32, 1024, 32, 1024, true, width: usableWidth - 0.1f, showLabel: true); m_asteroidSizesSlider.Enabled = false; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Asteroid size range")); parentTable.AddTableRow(m_asteroidSizesSlider); m_angleXSlider = new MyGuiControlClickableSlider(null, -90, 90, usableWidth - 0.1f, defaultValue: 0, intValue: true, showLabel: true, labelSuffix: "°"); m_angleXSlider.Enabled = false; m_angleXSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; m_angleYSlider = new MyGuiControlClickableSlider(null, -90, 90, usableWidth - 0.1f, defaultValue: 0, intValue: true, showLabel: true, labelSuffix: "°"); m_angleYSlider.Enabled = false; m_angleYSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; m_angleZSlider = new MyGuiControlClickableSlider(null, -90, 90, usableWidth - 0.1f, defaultValue: 0, intValue: true, showLabel: true, labelSuffix: "°"); m_angleZSlider.Enabled = false; m_angleZSlider.ValueChanged += delegate { UpdateRingVisual(GetAsteroidDataFromGui()); }; parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Angle X Axis")); parentTable.AddTableRow(m_angleXSlider); parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Angle Y Axis")); parentTable.AddTableRow(m_angleYSlider); parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Angle Z Axis")); parentTable.AddTableRow(m_angleZSlider); }
public bool CreateSpawnMenu(float usableWidth, MyGuiControlParentTableLayout parentTable, MyPluginAdminMenu adminScreen) { m_parentScreen = adminScreen; m_offset = Vector3D.Zero; m_currentSelectedAsteroid = null; if (m_fetchedStarSytem == null) { MyGuiControlRotatingWheel m_loadingWheel = new MyGuiControlRotatingWheel(position: Vector2.Zero); m_loadingWheel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; adminScreen.Controls.Add(m_loadingWheel); MyStarSystemGenerator.Static.GetStarSystem(delegate(MyObjectBuilder_SystemData starSystem) { m_fetchedStarSytem = starSystem; adminScreen.ShouldRecreate = true; }); return(true); } MyGuiControlLabel label = new MyGuiControlLabel(null, null, "Parent objects"); parentTable.AddTableRow(label); m_parentObjectListBox = new MyGuiControlListbox(); m_parentObjectListBox.Add(new MyGuiControlListbox.Item(new System.Text.StringBuilder("System center"), userData: m_fetchedStarSytem.CenterObject)); m_parentObjectListBox.VisibleRowsCount = 8; m_parentObjectListBox.Size = new Vector2(usableWidth, m_parentObjectListBox.Size.Y); m_parentObjectListBox.SelectAllVisible(); m_parentObjectListBox.ItemsSelected += OnParentItemClicked; foreach (var obj in m_fetchedStarSytem.CenterObject.GetAllChildren()) { if (obj.Type == MySystemObjectType.PLANET || obj.Type == MySystemObjectType.MOON) { m_parentObjectListBox.Add(new MyGuiControlListbox.Item(new System.Text.StringBuilder(obj.DisplayName), userData: obj)); } } parentTable.AddTableRow(m_parentObjectListBox); var row = new MyGuiControlParentTableLayout(2, false, Vector2.Zero); m_snapToParentCheck = new MyGuiControlCheckbox(); m_snapToParentCheck.IsChecked = m_snapToParent; m_snapToParentCheck.IsCheckedChanged += delegate { m_snapToParent = m_snapToParentCheck.IsChecked; m_zoomInButton.Enabled = m_snapToParent; }; row.AddTableRow(m_snapToParentCheck, new MyGuiControlLabel(null, null, "Snap camera to parent")); row.ApplyRows(); parentTable.AddTableRow(row); parentTable.AddTableSeparator(); GenerateRingSettingElements(usableWidth, parentTable); m_nameBox = new MyGuiControlTextbox(); m_nameBox.Size = new Vector2(usableWidth, m_nameBox.Size.Y); parentTable.AddTableRow(new MyGuiControlLabel(null, null, "Name")); parentTable.AddTableRow(m_nameBox); m_zoomInButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Zoom to ring", delegate { if (m_snapToParent) { m_parentScreen.CameraLookAt(GenerateAsteroidRing().CenterPosition, new Vector3D(0, 0, (m_radiusSlider.Value + m_widthSlider.Value) * 2000)); } }); parentTable.AddTableRow(m_zoomInButton); m_offsetToCoordButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Offset to coordinate", delegate { var coordMessage = new MyGuiScreenDialogCoordinate("Enter coordinate to offset the center of the ring from its parent"); coordMessage.OnConfirmed += delegate(Vector3D coord) { m_offset = coord; UpdateRingVisual(GenerateAsteroidRing()); }; MyGuiSandbox.AddScreen(coordMessage); }); parentTable.AddTableRow(m_offsetToCoordButton); m_spawnRingButton = MyPluginGuiHelper.CreateDebugButton(usableWidth, "Add ring", delegate { StringBuilder name = new StringBuilder(); m_nameBox.GetText(name); if (name.Length < 4) { MyPluginGuiHelper.DisplayError("Name must be at least 4 letters long", "Error"); return; } MySystemAsteroids instance; MyAsteroidRingData ring; GenerateAsteroidData(out ring, out instance); if (ring == null || instance == null) { MyPluginGuiHelper.DisplayError("Could not generate asteroid ring. No data found.", "Error"); return; } MyAsteroidRingProvider.Static.AddInstance(instance, ring, delegate(bool success) { if (!success) { MyPluginGuiHelper.DisplayError("Ring could not be added, because an object with the same id already exists. This error should not occour, so please try again.", "Error"); } else { MyPluginGuiHelper.DisplayMessage("Ring was created successfully.", "Success"); m_parentScreen.ForceFetchStarSystem = true; m_parentScreen.ShouldRecreate = true; } }); }); parentTable.AddTableRow(m_spawnRingButton); return(true); }
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); }