public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_elementGroup = new MyGuiControlElementGroup(); AddCaption(MyCustomTexts.OldButtonsAndMenus, null, new Vector2(0f, 0.003f)); m_backgroundTransition = MySandboxGame.Config.UIBkOpacity; m_guiTransition = MySandboxGame.Config.UIOpacity; MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList(); myGuiControlSeparatorList.AddHorizontal(-new Vector2(m_size.Value.X * 0.83f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.83f); Controls.Add(myGuiControlSeparatorList); MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList(); Vector2 start = -new Vector2(m_size.Value.X * 0.83f / 2f, (0f - m_size.Value.Y) / 2f + 0.05f); myGuiControlSeparatorList2.AddHorizontal(start, m_size.Value.X * 0.83f); Controls.Add(myGuiControlSeparatorList2); if (MyGuiScreenGamePlay.Static == null) { CreateMainMenuControls(); } else { CreateInGameMenuControls(); } Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui; MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(new Vector2(0f, start.Y + minSizeGui.Y / 2f), null, null, null, 0.8f, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME; Controls.Add(myGuiControlLabel); base.GamepadHelpTextId = MySpaceTexts.Gamepad_Help_Back; base.CloseButtonEnabled = true; }
public WarningLine(MySimpleProfiler.PerformanceWarning warning, MyGuiScreenPerformanceWarnings screen) { Parent = new MyGuiControlParent(); m_name = new MyGuiControlLabel(text: Truncate(warning.Block.DisplayName), position: new Vector2(-0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, font: VRage.Game.MyFontEnum.Red); m_description = new MyGuiControlLabel ( text: String.IsNullOrEmpty(warning.Block.Description.String) ? MyTexts.GetString(MyCommonTexts.PerformanceWarningTooManyBlocks) : MyTexts.GetString(warning.Block.Description), position: new Vector2(-0.24f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER ); m_separator = new MyGuiControlSeparatorList(); Parent.Size = new Vector2(Parent.Size.X, m_description.Size.Y); m_separator.AddVertical(new Vector2(-0.25f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f); m_separator.AddVertical(new Vector2(0.35f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f); m_time = new MyGuiControlLabel(position: new Vector2(0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER); switch (warning.Block.type) { case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.GRAPHICS: screen.m_areaTitleGraphics.Warnings.Add(this); break; case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.BLOCK: screen.m_areaTitleBlocks.Warnings.Add(this); break; case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.OTHER: screen.m_areaTitleOther.Warnings.Add(this); break; } this.Warning = warning; }
private void InitCampaignList() { Vector2 originL = -m_size.Value / 2 + new Vector2(0.07f, MARGIN_TOP); m_campaignTypesGroup = new MyGuiControlRadioButtonGroup(); m_campaignTypesGroup.SelectedChanged += CampaignSelectionChanged; m_campaignList = new MyGuiControlList { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = originL, Size = new Vector2(0.19f, m_size.Value.Y - 0.03f - MARGIN_TOP), }; var separator = new MyGuiControlSeparatorList() { Size = new Vector2(0.03f, m_campaignList.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = m_campaignList.Position + new Vector2(m_campaignList.Size.X + 0.015f, 0f) }; separator.AddVertical(new Vector2(0f, -m_campaignList.Size.Y / 2), separator.Size.Y); Controls.Add(separator); Controls.Add(m_campaignList); }
/// <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"); }
protected override MyGuiControlBase CreateGui() { var control = new MyGuiControlSeparatorList(); control.Size = new Vector2(1, 0.01f); control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP; control.AddHorizontal(Vector2.Zero, 1); return(control); }
private void AddSeparator() { var separator = new MyGuiControlSeparatorList(); separator.Size = new Vector2(1, 0.01f); separator.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP; separator.AddHorizontal(Vector2.Zero, 1); Controls.Add(separator); }
public WarningArea(string name, bool graphicsButton) { Warnings = new List <WarningLine>(); m_header = new MyGuiControlParent(); m_titleBackground = new MyGuiControlPanel(texture: @"Textures\GUI\Controls\item_highlight_dark.dds"); m_title = new MyGuiControlLabel(text: name); m_lastOccurence = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.PerformanceWarningLastOccurrence), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER); m_separator = new MyGuiControlSeparatorList(); m_separator.AddHorizontal(new Vector2(-0.45f, 0.018f), 0.9f); m_title.Position = new Vector2(-0.43f, 0f); m_lastOccurence.Position = new Vector2(0.43f, 0f); m_titleBackground.Size = new Vector2(m_titleBackground.Size.X, 0.035f); m_header.Size = new Vector2(m_header.Size.X, m_titleBackground.Size.Y); if (graphicsButton) { m_graphicsButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.ScreenCaptionGraphicsOptions), onButtonClick: (sender) => { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGraphics()); }); } }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); AddCaption(caption, Color.White.ToVector4(), new Vector2(0.0f, 0.003f)); var controlSeparatorList1 = new MyGuiControlSeparatorList(); controlSeparatorList1.AddHorizontal(new Vector2(-0.39f * DialogSize.X, -0.5f * DialogSize.Y + 0.075f), DialogSize.X * 0.78f); Controls.Add(controlSeparatorList1); var controlSeparatorList2 = new MyGuiControlSeparatorList(); controlSeparatorList2.AddHorizontal(new Vector2(-0.39f * DialogSize.X, +0.5f * DialogSize.Y - 0.123f), DialogSize.X * 0.78f); Controls.Add(controlSeparatorList2); nameBox = new MyGuiControlTextbox(new Vector2(0.0f, -0.027f), maxLength: maxLength) { Text = defaultName, Size = new Vector2(0.385f, 1f) }; nameBox.SelectAll(); Controls.Add(nameBox); okButton = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOk); cancelButton = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancel); var okPosition = new Vector2(0.001f, 0.5f * DialogSize.Y - 0.071f); var halfDistance = new Vector2(0.018f, 0.0f); okButton.Position = okPosition - halfDistance; cancelButton.Position = okPosition + halfDistance; okButton.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipNewsletter_Ok)); cancelButton.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipOptionsSpace_Cancel)); Controls.Add(okButton); Controls.Add(cancelButton); }
private void BuildRingMenu() { ClearControls(); Vector2 controlPadding = new Vector2(0.02f, 0.02f); float num = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2f; BuildPluginMenuHeader(); MyGuiControlLabel listBoxLabel = new MyGuiControlLabel { Position = new Vector2(-0.153f, -0.334f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "List of Planets" }; MyGuiControlPanel listBoxLabelBg = new MyGuiControlPanel(new Vector2(listBoxLabel.PositionX - 0.0085f, listBoxLabel.Position.Y - 0.005f), new Vector2(0.2865f, 0.035f), null, null, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK_BORDER }; Controls.Add(listBoxLabelBg); Controls.Add(listBoxLabel); m_currentPosition.Y += 0.020f; m_planetListBox = new MyGuiControlListbox(Vector2.Zero, VRage.Game.MyGuiControlListboxStyleEnum.Blueprints); m_planetListBox.Size = new Vector2(num, 0f); m_planetListBox.Enabled = true; m_planetListBox.VisibleRowsCount = 8; m_planetListBox.Position = m_planetListBox.Size / 2f + m_currentPosition; m_planetListBox.ItemClicked += PlanetListItemClicked; m_planetListBox.MultiSelect = false; MyGuiControlSeparatorList separator = new MyGuiControlSeparatorList(); separator.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f); Controls.Add(separator); m_currentPosition = m_planetListBox.GetPositionAbsoluteBottomLeft(); m_currentPosition.Y += 0.045f; MyGuiControlParent myGuiControlParent = new MyGuiControlParent { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = Vector2.Zero, Size = new Vector2(0.32f, 0.56f) }; MyGuiControlScrollablePanel m_optionsGroup = new MyGuiControlScrollablePanel(myGuiControlParent) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = m_currentPosition, Size = new Vector2(0.32f, 0.32f) }; m_optionsGroup.ScrollbarVEnabled = true; m_optionsGroup.ScrollBarOffset = new Vector2(-0.01f, 0f); Controls.Add(m_optionsGroup); Vector2 vector = -myGuiControlParent.Size * 0.5f; MyGuiControlLabel ringDistLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Ring distance" }; myGuiControlParent.Controls.Add(ringDistLabel); m_ringDistanceValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0" }; myGuiControlParent.Controls.Add(m_ringDistanceValue); vector.Y += 0.025f; m_ringDistanceSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 5000f, 1000000f, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_DISTANCE, showLabel: false);//Make dynamic m_ringDistanceSlider.Size = new Vector2(0.285f, 1f); m_ringDistanceSlider.DefaultValue = 100000; m_ringDistanceSlider.Value = m_ringDistanceSlider.DefaultValue.Value; m_ringDistanceSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringDistanceSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringDistanceSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { UpdateRingVisual(); m_ringDistanceValue.Text = s.Value.ToString(); }); m_ringDistanceValue.Text = m_ringDistanceSlider.Value.ToString(); myGuiControlParent.Controls.Add(m_ringDistanceSlider); vector.Y += 0.055f; MyGuiControlLabel ringWidthLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Ring width" }; myGuiControlParent.Controls.Add(ringWidthLabel); m_ringWidthValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0" }; myGuiControlParent.Controls.Add(m_ringWidthValue); vector.Y += 0.025f; m_ringWidthSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth, SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_WIDTH, showLabel: false); m_ringWidthSlider.Size = new Vector2(0.285f, 1f); m_ringWidthSlider.DefaultValue = (SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth + SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth) / 2; m_ringWidthSlider.Value = m_ringWidthSlider.DefaultValue.Value; m_ringWidthSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringWidthSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringWidthSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { UpdateRingVisual(); m_ringWidthValue.Text = s.Value.ToString(); }); m_ringWidthValue.Text = m_ringWidthSlider.Value.ToString(); myGuiControlParent.Controls.Add(m_ringWidthSlider); vector.Y += 0.055f; MyGuiControlLabel ringAngleXLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Ring angle X" }; myGuiControlParent.Controls.Add(ringAngleXLabel); m_ringAngleXValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0.00" }; myGuiControlParent.Controls.Add(m_ringAngleXValue); vector.Y += 0.025f; m_ringAngleXSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE); m_ringAngleXSlider.Size = new Vector2(0.285f, 1f); m_ringAngleXSlider.DefaultValue = 0; m_ringAngleXSlider.Value = m_ringAngleXSlider.DefaultValue.Value; m_ringAngleXSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringAngleXSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleXSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { UpdateRingVisual(); m_ringAngleXValue.Text = String.Format("{0:0.00}", s.Value); }); m_ringAngleXValue.Text = String.Format("{0:0.00}", m_ringAngleXSlider.Value); myGuiControlParent.Controls.Add(m_ringAngleXSlider); vector.Y += 0.055f; MyGuiControlLabel ringAngleYLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Ring angle Y" }; myGuiControlParent.Controls.Add(ringAngleYLabel); m_ringAngleYValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0.00" }; myGuiControlParent.Controls.Add(m_ringAngleYValue); vector.Y += 0.025f; m_ringAngleYSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE); m_ringAngleYSlider.Size = new Vector2(0.285f, 1f); m_ringAngleYSlider.DefaultValue = 0; m_ringAngleYSlider.Value = m_ringAngleYSlider.DefaultValue.Value; m_ringAngleYSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringAngleYSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleYSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { UpdateRingVisual(); m_ringAngleYValue.Text = String.Format("{0:0.00}", s.Value); }); m_ringAngleYValue.Text = String.Format("{0:0.00}", m_ringAngleYSlider.Value); myGuiControlParent.Controls.Add(m_ringAngleYSlider); vector.Y += 0.055f; MyGuiControlLabel ringAngleZLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Ring angle Z" }; myGuiControlParent.Controls.Add(ringAngleZLabel); m_ringAngleZValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0.00" }; myGuiControlParent.Controls.Add(m_ringAngleZValue); vector.Y += 0.025f; m_ringAngleZSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), -90, 90, intValue: false, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ANGLE); m_ringAngleZSlider.Size = new Vector2(0.285f, 1f); m_ringAngleZSlider.DefaultValue = 0; m_ringAngleZSlider.Value = m_ringAngleZSlider.DefaultValue.Value; m_ringAngleZSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringAngleZSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringAngleZSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { UpdateRingVisual(); m_ringAngleZValue.Text = String.Format("{0:0.00}", s.Value); }); m_ringAngleZValue.Text = String.Format("{0:0.00}", m_ringAngleZSlider.Value); myGuiControlParent.Controls.Add(m_ringAngleZSlider); vector.Y += 0.055f; MyGuiControlLabel ringRoidSizeLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Asteroid min size" }; myGuiControlParent.Controls.Add(ringRoidSizeLabel); m_ringRoidSizeValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0" }; myGuiControlParent.Controls.Add(m_ringRoidSizeValue); vector.Y += 0.025f; m_ringRoidSizeSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 128, 1024, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ROID_SIZE); m_ringRoidSizeSlider.Size = new Vector2(0.285f, 1f); m_ringRoidSizeSlider.DefaultValue = 128; m_ringRoidSizeSlider.Value = m_ringRoidSizeSlider.DefaultValue.Value; m_ringRoidSizeSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringRoidSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringRoidSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_ringRoidSizeValue.Text = s.Value.ToString(); if (s.Value > m_ringRoidSizeMaxSlider.Value) { m_ringRoidSizeSlider.Value = m_ringRoidSizeMaxSlider.Value; } }); m_ringRoidSizeValue.Text = m_ringRoidSizeSlider.Value.ToString(); myGuiControlParent.Controls.Add(m_ringRoidSizeSlider); vector.Y += 0.055f; MyGuiControlLabel ringRoidSizeMaxLabel = new MyGuiControlLabel { Position = vector + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "Asteroid max size" }; myGuiControlParent.Controls.Add(ringRoidSizeMaxLabel); m_ringRoidSizeMaxValue = new MyGuiControlLabel { Position = vector + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0" }; myGuiControlParent.Controls.Add(m_ringRoidSizeMaxValue); vector.Y += 0.025f; m_ringRoidSizeMaxSlider = new MyGuiControlClickableSlider(vector + new Vector2(0.001f, 0f), 128, 1024, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_RING_ROID_SIZE_MAX); m_ringRoidSizeMaxSlider.Size = new Vector2(0.285f, 1f); m_ringRoidSizeMaxSlider.DefaultValue = 1028; m_ringRoidSizeMaxSlider.Value = m_ringRoidSizeSlider.DefaultValue.Value; m_ringRoidSizeMaxSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_ringRoidSizeMaxSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringRoidSizeMaxSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_ringRoidSizeMaxValue.Text = s.Value.ToString(); if (s.Value < m_ringRoidSizeSlider.Value) { m_ringRoidSizeMaxSlider.Value = m_ringRoidSizeSlider.Value; } }); m_ringRoidSizeMaxValue.Text = m_ringRoidSizeMaxSlider.Value.ToString(); myGuiControlParent.Controls.Add(m_ringRoidSizeMaxSlider); m_optionsGroup.RefreshInternals(); m_currentPosition.Y += m_optionsGroup.Size.Y; MyGuiControlSeparatorList separator2 = new MyGuiControlSeparatorList(); separator2.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f); Controls.Add(separator2); m_addRingButton = CreateDebugButton(0.284f, "Add ring to planet", OnAddRingToPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_ADD_RING_BUTTON); m_currentPosition.Y += 0.003f; m_removeRingButton = CreateDebugButton(0.284f, "Remove ring from planet", OnRemoveRingFromPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_REMOVE_RING_BUTTON); m_currentPosition.Y += 0.003f; m_teleportToRingButton = CreateDebugButton(0.284f, "Teleport to ring", OnTeleportToRingButton, true, MyPluginTexts.TOOLTIPS.ADMIN_TP_RING_BUTTON); m_teleportToRingButton.Enabled = false; Controls.Add(m_planetListBox); m_ringAngleXSlider.Enabled = false; m_ringAngleYSlider.Enabled = false; m_ringAngleZSlider.Enabled = false; m_ringDistanceSlider.Enabled = false; m_ringWidthSlider.Enabled = false; m_ringRoidSizeSlider.Enabled = false; m_addRingButton.Enabled = false; m_removeRingButton.Enabled = false; m_teleportToRingButton.Enabled = false; LoadPlanetsInWorld(); }
private void BuildPlanetMenu() { ClearControls(); Vector2 controlPadding = new Vector2(0.02f, 0.02f); float num = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2f; float num2 = (SCREEN_SIZE.Y - 1f) / 2f; BuildPluginMenuHeader(); MyGuiControlLabel listBoxLabel = new MyGuiControlLabel { Position = new Vector2(-0.153f, -0.334f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "List of Planet definitions" }; MyGuiControlPanel listBoxLabelBg = new MyGuiControlPanel(new Vector2(listBoxLabel.PositionX - 0.0085f, listBoxLabel.Position.Y - 0.005f), new Vector2(0.2865f, 0.035f), null, null, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK_BORDER }; Controls.Add(listBoxLabelBg); Controls.Add(listBoxLabel); m_currentPosition.Y += 0.020f; m_planetDefListBox = new MyGuiControlListbox(Vector2.Zero, VRage.Game.MyGuiControlListboxStyleEnum.Blueprints); m_planetDefListBox.Size = new Vector2(num, 0f); m_planetDefListBox.Enabled = true; m_planetDefListBox.VisibleRowsCount = 8; m_planetDefListBox.Position = m_planetDefListBox.Size / 2f + m_currentPosition; m_planetDefListBox.ItemClicked += PlanetDefListItemClicked; m_planetDefListBox.MultiSelect = false; MyGuiControlSeparatorList separator = new MyGuiControlSeparatorList(); separator.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.83f / 2f, -0.00f), m_size.Value.X * 0.73f); Controls.Add(separator); m_currentPosition = m_planetDefListBox.GetPositionAbsoluteBottomLeft(); m_currentPosition.Y += 0.045f; MyGuiControlLabel planetSizeLabel = new MyGuiControlLabel { Position = m_currentPosition + new Vector2(0.001f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = "PlanetSize" }; Controls.Add(planetSizeLabel); m_planetSizeValue = new MyGuiControlLabel { Position = m_currentPosition + new Vector2(0.285f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Text = "0" }; Controls.Add(m_planetSizeValue); m_currentPosition.Y += 0.025f; m_planetSizeSlider = new MyGuiControlClickableSlider(m_currentPosition + new Vector2(0.001f, 0f), 120f, 2400f, intValue: true, toolTip: MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SIZE); m_planetSizeSlider.Size = new Vector2(0.285f, 1f); m_planetSizeSlider.DefaultValue = 1200f; m_planetSizeSlider.Value = m_planetSizeSlider.DefaultValue.Value; m_planetSizeSlider.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_planetSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_planetSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_planetSizeValue.Text = s.Value.ToString(); }); m_planetSizeValue.Text = m_planetSizeSlider.Value.ToString(); Controls.Add(m_planetSizeSlider); m_currentPosition.Y += 0.055f + 0.035f; m_spawnPlanetButton = CreateDebugButton(0.284f, "Spawn planet", OnSpawnPlanetButton, true, MyPluginTexts.TOOLTIPS.ADMIN_ADD_RING_BUTTON); m_spawnPlanetButton.Enabled = false; Controls.Add(m_planetDefListBox); LoadPlanetDefinitions(); }
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 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); }
private void RecreateServerLimitInfo(MyGuiControlList list) { var identity = MySession.Static.Players.TryGetIdentity(MySession.Static.LocalPlayerId); int built; if (MySession.Static.MaxBlocksPerPlayer > 0 || MySession.Static.BlockTypeLimits.Keys.Count > 0) { MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Overview), textScale: 1.3f); list.Controls.Add(totalBlocksLabel); } if (MySession.Static.MaxBlocksPerPlayer > 0) { MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), identity.BlocksBuilt, MySession.Static.MaxBlocksPerPlayer + identity.BlockLimitModifier, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower))); list.Controls.Add(totalBlocksLabel); } foreach (var blockType in MySession.Static.BlockTypeLimits) { identity.BlockTypeBuilt.TryGetValue(blockType.Key, out built); var definition = Sandbox.Definitions.MyDefinitionManager.Static.TryGetDefinitionGroup(blockType.Key); if (built == null || definition == null) { continue; } MyGuiControlLabel blockTypeLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), built, MySession.Static.GetBlockTypeLimit(blockType.Key), definition.Any.DisplayNameText)); list.Controls.Add(blockTypeLabel); } foreach (var grid in m_infoGrids) { grid.OnAuthorshipChanged -= grid_OnAuthorshipChanged; } m_infoGrids.Clear(); foreach (var grid in identity.BlocksBuiltByGrid) { MyGuiControlParent panel = new MyGuiControlParent(); if (m_infoGrids.Count == 0) { MyGuiControlSeparatorList infoSeparator = new MyGuiControlSeparatorList(); infoSeparator.AddHorizontal(new Vector2(-0.2f, -0.052f), 0.4f, width: 0.004f); panel.Controls.Add(infoSeparator); } MyGuiControlLabel gridNameLabel = new MyGuiControlLabel(text: grid.Key.DisplayName, textScale: 0.9f); MyGuiControlLabel gridBlockCountLabel = new MyGuiControlLabel(text: String.Format("{0} {1}", grid.Value, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower)), textScale: 0.9f); MyGuiControlLabel assignLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Assign), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, textScale: 0.9f); MyGuiControlCombobox assignCombobox = new MyGuiControlCombobox(originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, size: new Vector2(0.11f, 0.008f)); MyGuiControlSeparatorList lineSeparator = new MyGuiControlSeparatorList(); gridNameLabel.Position = new Vector2(-0.15f, -0.025f); gridBlockCountLabel.Position = new Vector2(-0.15f, 0.000f); assignLabel.Position = new Vector2(0.035f, 0.025f); assignCombobox.Position = new Vector2(0.15f, 0.025f); assignCombobox.ItemSelected += delegate() { assignCombobox_ItemSelected(grid.Key, m_playerIds[(int)assignCombobox.GetSelectedKey()]); }; m_playerIds.Clear(); foreach (var player in MySession.Static.Players.GetOnlinePlayers()) { if (MySession.Static.LocalHumanPlayer != player) { assignCombobox.AddItem(m_playerIds.Count, player.DisplayName); m_playerIds.Add(player.Id); } } lineSeparator.AddHorizontal(new Vector2(-0.15f, 0.05f), 0.3f, width: 0.002f); panel.Controls.Add(gridNameLabel); panel.Controls.Add(gridBlockCountLabel); panel.Controls.Add(assignLabel); panel.Controls.Add(assignCombobox); panel.Controls.Add(lineSeparator); if (MySession.Static.EnableRemoteBlockRemoval) { MyGuiControlLabel deleteOwnedBlocksLabel = new MyGuiControlLabel( text: MyTexts.GetString(MySpaceTexts.buttonRemove), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, textScale: 0.9f); MyGuiControlButton deleteOwnedBlocksButton = new MyGuiControlButton( text: new StringBuilder("X"), onButtonClick: deleteOwnedBlocksButton_ButtonClicked, buttonIndex: m_infoGrids.Count, visualStyle: MyGuiControlButtonStyleEnum.SquareSmall, originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER); deleteOwnedBlocksLabel.Position = new Vector2(0.11f, -0.02f); deleteOwnedBlocksButton.Position = new Vector2(0.15f, -0.02f); panel.Controls.Add(deleteOwnedBlocksLabel); panel.Controls.Add(deleteOwnedBlocksButton); } grid.Key.OnAuthorshipChanged += grid_OnAuthorshipChanged; m_infoGrids.Add(grid.Key); panel.Size = new Vector2(panel.Size.X, 0.09f); list.Controls.Add(panel); } }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var lbl = new MyGuiControlLabel(new Vector2(-.13f, -.32f), null, "More PP Settings - By: Math0424"); Controls.Add(lbl); MyGuiControlSeparatorList seperator = new MyGuiControlSeparatorList(); seperator.Position = new Vector2(0, 0); seperator.AddHorizontal(new Vector2(-.3f, -.14f), .6f, .002f); Elements.Add(seperator); //bloom bloomSlidr = AddSliderLabel("Bloom Scale", new Vector2(.08f, -.25f), 0, 400, PPSettings.Static.BloomScale); bloomDirt = AddSliderLabel("Bloom Dirt", new Vector2(.08f, -.18f), 0, 1, PPSettings.Static.BloomDirtRatio); bloomMulti = AddSliderLabel("Bloom Mult", new Vector2(-.17f, -.25f), 0, 1, PPSettings.Static.BloomMult); bloomSize = AddSliderLabel("Bloom Size", new Vector2(-.17f, -.18f), 0, 10, PPSettings.Static.BloomSize, true); bloom = AddCheckbox("Bloom", new Vector2(.22f, -.215f), PPSettings.Static.EnableBloom); //misc slider brightness = AddSliderLabel("Brightness", new Vector2(-.23f, .04f), 0, 10, PPSettings.Static.Brightness); saturation = AddSliderLabel("Saturation", new Vector2(-.23f, .11f), 0, 10, PPSettings.Static.Saturation); //chromatic chromatic = AddCheckbox("Chromatic Ab.", new Vector2(.24f, .09f), PPSettings.Static.EnableChromaticAberration); chromaticFactor = AddSlider(new Vector2(.1f, .09f), -1.5f, 1.5f, PPSettings.Static.ChromaticFactor); //vignette vignette = AddCheckbox("Vignette", new Vector2(.24f, -.025f), PPSettings.Static.EnableVignette); vignetteLength = AddSliderLabel("Length", new Vector2(.1f, .01f), 0, 10, PPSettings.Static.VignetteLength); vignetteStart = AddSliderLabel("Start", new Vector2(.1f, -.07f), 0, 10, PPSettings.Static.VignetteStart); //Coloring headlamp = AddColorSlider("Headlamp Color", new Vector2(-.2f, -.08f), PPSettings.Static.HeadlampColor); headlamp.Color.Alpha(255); //ambient ambient = AddCheckbox("Ambient Occlusion", new Vector2(-.31f, .17f), PPSettings.Static.EnableAmbientOcclusion); eyeadaption = AddCheckbox("Eye Adaptation", new Vector2(-.31f, .22f), PPSettings.Static.EnableEyeAdaption); //misc playerShake = AddCheckbox("Player shake", new Vector2(-.1f, .17f), PPSettings.Static.EnablePlayerShake); fullbright = AddCheckbox("Fullbright", new Vector2(-.1f, .22f), PPSettings.Static.EnableFullbright); glare = AddCheckbox("Sun glare", new Vector2(.05f, .17f), PPSettings.Static.EnableSunGlare); var button = new MyGuiControlButton() { Position = new Vector2(-0.23f, .3f), Text = "Save & Exit", }; Controls.Add(button); button.ButtonClicked += (e) => { ApplySettings(); PPSettings.Save(); CloseScreen(); }; var button3 = new MyGuiControlButton() { Position = new Vector2(0f, .3f), Text = "Save", }; Controls.Add(button3); button3.ButtonClicked += (e) => { ApplySettings(); PPSettings.Save(); }; var button2 = new MyGuiControlButton() { Position = new Vector2(0.23f, .3f), Text = "Exit", }; Controls.Add(button2); button2.ButtonClicked += (e) => { CloseScreen(); }; }
public void RecreateControls() { if (QuestInfo == null || Elements == null) { return; } Elements.Clear(); Vector2 topleft = -this.Size / 2; Vector2 textOffset = new Vector2(0.015f, 0.015f); // Title MyGuiControlLabel title = new MyGuiControlLabel(); title.Text = QuestInfo.QuestTitle; title.Position = topleft + textOffset; title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; title.Visible = true; Elements.Add(title); // Pages if (QuestInfo.MaxPages != 0) { MyGuiControlLabel numbers = new MyGuiControlLabel(); numbers.Text = QuestInfo.Page + "/" + QuestInfo.MaxPages; numbers.Position = topleft + Vector2.UnitX * this.Size - textOffset * new Vector2(1, -1); numbers.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP; Elements.Add(numbers); } // Separator MyGuiControlSeparatorList m_separator; m_separator = new MyGuiControlSeparatorList(); m_separator.AddHorizontal(topleft + textOffset + new Vector2(0, 0.03f), this.Size.X - 2 * textOffset.X, 0.003f); // Title separator m_separator.Visible = true; Elements.Add(m_separator); // Details var rowOffset = new Vector2(0, 0.025f); string[] details = QuestInfo.GetQuestGetails(); int idx = 0; for (int i = 0; i < details.Length; i++) { if (details[i] == null) { continue; } MyGuiControlMultilineText textBox = new MyGuiControlMultilineText( size: new Vector2(Size.X * 0.92f, rowOffset.Y * 5), position: topleft + textOffset + new Vector2(0, 0.04f) + rowOffset * idx, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, //Debug purpose //backgroundColor: Vector4.One, //backgroundTexture: BackgroundTexture, drawScrollbar: false ); textBox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; textBox.TextScale = 0.9f; textBox.AppendText(details[i]); textBox.Visible = true; idx += textBox.NumberOfRows; Elements.Add(textBox); } }
/// <summary> /// Builds the edit menu /// </summary> private void BuildEditMenu() { MyPluginLog.Debug("Adding edit menu"); if (m_fetchedStarSytem == null || ForceFetchStarSystem) { MyPluginLog.Debug("Fetching system data"); MyGuiControlRotatingWheel m_loadingWheel = new MyGuiControlRotatingWheel(position: Vector2.Zero); m_loadingWheel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; Controls.Add(m_loadingWheel); MyStarSystemGenerator.Static.GetStarSystem(delegate(MyObjectBuilder_SystemData starSystem) { m_fetchedStarSytem = starSystem; m_selectedObject = null; ShouldRecreate = true; ForceFetchStarSystem = false; }); return; } 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); MyGuiControlLabel systemObjsLabel = new MyGuiControlLabel(null, null, "System Objects"); systemObjsLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; systemObjsLabel.Position = start; Controls.Add(systemObjsLabel); m_systemObjectsBox = new MyGuiControlListbox(); m_systemObjectsBox.VisibleRowsCount = 8; m_systemObjectsBox.Size = new Vector2(m_usableWidth, m_systemObjectsBox.Size.Y); m_systemObjectsBox.Position = start; m_systemObjectsBox.PositionY += systemObjsLabel.Size.Y + MARGIN_VERT; m_systemObjectsBox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; foreach (var obj in m_fetchedStarSytem.GetAllObjects()) { if (obj.Type == MySystemObjectType.EMPTY) { continue; } m_systemObjectsBox.Add(new MyGuiControlListbox.Item(new System.Text.StringBuilder(obj.DisplayName), userData: obj)); } if (m_selectedObject != null) { m_systemObjectsBox.SelectByUserData(m_selectedObject); } m_systemObjectsBox.ItemsSelected += OnSystemObjectSelect; Controls.Add(m_systemObjectsBox); MyGuiControlSeparatorList sep = new MyGuiControlSeparatorList(); sep.AddHorizontal(new Vector2(m_systemObjectsBox.Position.X, m_systemObjectsBox.Position.Y + m_systemObjectsBox.Size.Y + MARGIN_VERT), m_usableWidth); BuildEditingSubMenu(); sep.AddHorizontal(new Vector2(m_scrollPane.Position.X - m_scrollPane.Size.X / 2, m_scrollPane.Position.Y + m_scrollPane.Size.Y), m_usableWidth); Controls.Add(sep); MyPluginLog.Debug("Added edit menu"); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_elementGroup = new MyGuiControlElementGroup(); AddCaption(MyCommonTexts.ScreenCaptionOptions, null, new Vector2(0f, 0.003f)); m_backgroundTransition = MySandboxGame.Config.UIBkOpacity; m_guiTransition = MySandboxGame.Config.UIOpacity; MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList(); myGuiControlSeparatorList.AddHorizontal(-new Vector2(m_size.Value.X * 0.83f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.83f); Controls.Add(myGuiControlSeparatorList); MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList(); Vector2 start = -new Vector2(m_size.Value.X * 0.83f / 2f, (0f - m_size.Value.Y) / 2f + 0.05f); myGuiControlSeparatorList2.AddHorizontal(start, m_size.Value.X * 0.83f); Controls.Add(myGuiControlSeparatorList2); MyStringId optionsScreen_Help_Menu = MySpaceTexts.OptionsScreen_Help_Menu; Vector2 vector = new Vector2(0.001f, (0f - m_size.Value.Y) / 2f + 0.126f); int num = 0; MyGuiControlButton myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGame(m_isLimitedMenu)); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); if (!m_isLimitedMenu) { myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonDisplay), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsDisplay()); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonGraphics), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsGraphics()); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); } myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonAudio), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsAudio(m_isLimitedMenu)); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonControls), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsControls()); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); myGuiControlButton = new MyGuiControlButton(vector + num ++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonCredits), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate(MyGuiControlButton sender) { OnClickCredits(sender); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui; MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(new Vector2(0f, start.Y + minSizeGui.Y / 2f), null, null, null, 0.8f, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME; Controls.Add(myGuiControlLabel); base.GamepadHelpTextId = MySpaceTexts.Gamepad_Help_Back; base.CloseButtonEnabled = true; }
public MyGuiControlScreenSwitchPanel(MyGuiScreenBase owner, StringBuilder ownerDescription) { var currentPosition = Vector2.Zero; var descriptingText = new MyGuiControlMultilineText { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, Position = new Vector2(owner.Size.Value.X / 2 - 0.015f, 0.113f), Size = new Vector2(owner.Size.Value.X - 0.1f, 0.03f), TextAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Text = ownerDescription, Font = "DarkBlue" }; var campaignButton = new MyGuiControlButton( position: currentPosition, textScale: MyGuiConstants.MAIN_MENU_BUTTON_TEXT_SCALE, text: MyTexts.Get(MyCommonTexts.ScreenCaptionNewGame), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, onButtonClick: OnCampaignButtonClick ); currentPosition.X += campaignButton.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X; var customWorldButton = new MyGuiControlButton( position: currentPosition, textScale: MyGuiConstants.MAIN_MENU_BUTTON_TEXT_SCALE, text: MyTexts.Get(MyCommonTexts.ScreenCaptionCustomWorld), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, onButtonClick: OnCustomWorldButtonClick ); currentPosition.X += customWorldButton.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X; var worshopWorldsButton = new MyGuiControlButton( position: currentPosition, textScale: MyGuiConstants.MAIN_MENU_BUTTON_TEXT_SCALE, text: MyTexts.Get(MyCommonTexts.ScreenCaptionWorkshop), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, onButtonClick: OnWorshopButtonClick ); var separator = new MyGuiControlSeparatorList(); separator.AddHorizontal(new Vector2(0.02f, 0.083f), owner.Size.Value.X - 0.07f); separator.AddHorizontal(new Vector2(0.02f, 0.14f), owner.Size.Value.X - 0.07f); if (owner is MyGuiScreenNewGame) { owner.FocusedControl = campaignButton; } else if (owner is MyGuiScreenWorldSettings) { owner.FocusedControl = customWorldButton; } else if (owner is MyGuiScreenLoadSubscribedWorld) { owner.FocusedControl = worshopWorldsButton; } Controls.Add(descriptingText); Controls.Add(separator); Controls.Add(campaignButton); Controls.Add(customWorldButton); Controls.Add(worshopWorldsButton); var offset = new Vector2(0.013f, 0.02f); Position = -owner.Size.Value / 2 + offset; owner.Controls.Add(this); }
/// <summary> /// Builds the plugin settings controls from top to bottom. /// </summary> public void BuildControls() { Vector2 vector = new Vector2(50f) / MyGuiConstants.GUI_OPTIMAL_SIZE; float x2 = 0.209375018f; int mod = m_isNewGame ? 6 : 0; AddCaption("SEWorldGenPlugin Settings", null, new Vector2(0f, 0.003f)); MyGuiControlParent parent = new MyGuiControlParent(null, new Vector2(base.Size.Value.X - vector.X * 2f, 0.052f * (15 + mod))); parent.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; MyGuiControlSeparatorList myGuiControlSeparatorList = new MyGuiControlSeparatorList(); myGuiControlSeparatorList.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.835f / 2f, m_size.Value.Y / 2f - 0.075f), m_size.Value.X * 0.835f); Controls.Add(myGuiControlSeparatorList); MyGuiControlSeparatorList myGuiControlSeparatorList2 = new MyGuiControlSeparatorList(); myGuiControlSeparatorList2.AddHorizontal(new Vector2(0f, 0f) - new Vector2(m_size.Value.X * 0.835f / 2f, (0f - m_size.Value.Y) / 2f + 0.123f), m_size.Value.X * 0.835f); Controls.Add(myGuiControlSeparatorList2); m_useGlobalSettignsLabel = MakeLabel("Use global Config"); m_useSemiRandomGenerationLabel = MakeLabel("Use all planets"); m_useVanillaPlanetsLabel = MakeLabel("Use vanilla planets"); m_planetsOnlyOnceLabel = MakeLabel("Generate Planets Once"); m_moonsOnlyOnceLabel = MakeLabel("Generate Moons Once"); m_planetGpsLabel = MakeLabel("Create GPS for Planets"); m_moonGpsLabel = MakeLabel("Create GPS for Moons"); m_beltGpsLabel = MakeLabel("Create GPS for Belts"); m_ringGpsLabel = MakeLabel("Create GPS for Rings"); m_asteroidGeneratorLabel = MakeLabel("Asteroid generator"); m_asteroidDensityLabel = MakeLabel("Asteroid density"); m_objAmountLabel = MakeLabel("Objects in System"); m_orbDistanceLabel = MakeLabel("Average Orbit distance"); m_sizeMultiplierLabel = MakeLabel("Planet size multiplier"); m_sizeCapLabel = MakeLabel("Planet size cap"); m_moonProbLabel = MakeLabel("Moon spawn probability"); m_ringWidthLabel = MakeLabel("Average ring width"); m_ringProbLabel = MakeLabel("Ring spawn probability"); m_beltHeightLabel = MakeLabel("Average belt height"); m_beltProbLabel = MakeLabel("Belt spawn probability"); m_worldSizeLabel = MakeLabel("World Size"); m_useGlobalCheck = new MyGuiControlCheckbox(); m_useSemiRandomGenerationCheck = new MyGuiControlCheckbox(); m_useVanillaPlanetsCheck = new MyGuiControlCheckbox(); m_planetsOnlyOnceCheck = new MyGuiControlCheckbox(); m_moonsOnlyOnceCheck = new MyGuiControlCheckbox(); m_planetGpsCheck = new MyGuiControlCheckbox(); m_moonGpsCheck = new MyGuiControlCheckbox(); m_beltGpsCheck = new MyGuiControlCheckbox(); m_ringGpsCheck = new MyGuiControlCheckbox(); m_asteroidGeneratorCombo = new MyGuiControlCombobox(null, new Vector2(x2, 0.04f)); x2 += 0.05f; m_asteroidDensitySlider = new MyGuiControlClickableSlider(Vector2.Zero, 0.1f, 1f, x2, 0.6f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.ROID_DENS_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false); m_objAmountSlider = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 100f, x2, 15f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SYS_OBJ_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_orbDistanceSlider = new MyGuiControlClickableSlider(Vector2.Zero, 500f, 100000f, x2, 50500f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.ORB_DIST_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_sizeMultiplierSlider = new MyGuiControlClickableSlider(Vector2.Zero, 1f, 10f, x2, 2f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SIZE_MUL_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_sizeCapSlider = new MyGuiControlClickableSlider(Vector2.Zero, 120f, 2400f, x2, 1200f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.SIZE_CAP_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_moonProbSlider = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.5f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.MOON_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false); m_ringWidthSlider = new MyGuiControlClickableSlider(Vector2.Zero, 10000f, 100000f, x2, 15000f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.RING_WIDTH_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_ringProbSlider = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.5f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.RING_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false); m_beltHeightSlider = new MyGuiControlClickableSlider(Vector2.Zero, 4000f, 40000f, x2, 22000f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.BELT_HEIGHT_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_beltProbSlider = new MyGuiControlClickableSlider(Vector2.Zero, 0f, 1f, x2, 0.4f, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.BELT_PROB_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: false); m_worldSizeSlider = new MyGuiControlClickableSlider(Vector2.Zero, -1f, 1000000 - 1, x2, -1, null, null, 0, 0.8f, 0.05f, "White", MyPluginTexts.TOOLTIPS.WORLD_SIZE_SLIDER, MyGuiControlSliderStyleEnum.Default, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, intValue: true); m_asteroidDensityValue = MakeLabel(String.Format("{0:0.00}", m_asteroidDensitySlider.Value)); m_asteroidDensityValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_objAmountValue = MakeLabel(m_objAmountSlider.Value.ToString()); m_objAmountValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_orbDistanceValue = MakeLabel(m_orbDistanceSlider.Value.ToString()); m_orbDistanceValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_sizeMultiplierValue = MakeLabel(m_sizeMultiplierSlider.Value.ToString()); m_sizeMultiplierValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_sizeCapValue = MakeLabel(m_sizeCapSlider.Value.ToString()); m_sizeCapValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_moonProbValue = MakeLabel(String.Format("{0:0.00}", m_moonProbSlider.Value)); m_moonProbValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_ringWidthValue = MakeLabel(m_ringWidthSlider.Value.ToString()); m_ringWidthValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_ringProbValue = MakeLabel(m_ringProbSlider.Value.ToString()); m_ringProbValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_beltHeightValue = MakeLabel(m_beltHeightSlider.Value.ToString()); m_beltHeightValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_beltProbValue = MakeLabel(String.Format("{0:0.00}", m_beltProbSlider.Value)); m_beltProbValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_useGlobalCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_GLOBAL_CHECK); m_useGlobalCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_useSemiRandomGenerationCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_SEMI_RAND_GEN_CHECK); m_useSemiRandomGenerationCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_useVanillaPlanetsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.USE_VANILLA_PLANETS); m_useVanillaPlanetsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_planetsOnlyOnceCheck.SetToolTip(MyPluginTexts.TOOLTIPS.PLANETS_ONLY_ONCE); m_planetsOnlyOnceCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_moonsOnlyOnceCheck.SetToolTip(MyPluginTexts.TOOLTIPS.MOONS_ONLY_ONCE); m_moonsOnlyOnceCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_planetGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.PLANET_GPSL_CHECK); m_planetGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_moonGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.MOON_GPS_CHECK); m_moonGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_beltGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.BELT_GPS_CHECK); m_beltGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_ringGpsCheck.SetToolTip(MyPluginTexts.TOOLTIPS.RING_GPS_CHECK); m_ringGpsCheck.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_asteroidGeneratorCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ROID_GEN_COMBO); m_asteroidGeneratorCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; m_worldSizeValue = MakeLabel(m_worldSizeSlider.Value.ToString()); m_worldSizeValue.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_asteroidGeneratorCombo.AddItem(0L, "Plugin"); m_asteroidGeneratorCombo.AddItem(1L, "Vanilla"); m_asteroidGeneratorCombo.AddItem(2L, "Mixed"); m_asteroidGeneratorCombo.SelectItemByIndex(0); m_asteroidGeneratorCombo.ItemSelected += delegate { bool val = m_asteroidGeneratorCombo.GetSelectedKey() == 01L; m_beltGpsCheck.Enabled = !val; m_ringProbSlider.Enabled = !val; m_ringWidthSlider.Enabled = !val; m_beltHeightSlider.Enabled = !val; m_beltProbSlider.Enabled = !val; m_asteroidDensitySlider.Enabled = !val; }; m_asteroidDensitySlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_asteroidDensitySlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_asteroidDensityValue.Text = String.Format("{0:0.00}", s.Value); }); m_objAmountSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_objAmountSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_objAmountValue.Text = s.Value.ToString(); }); m_orbDistanceSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_orbDistanceSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_orbDistanceValue.Text = s.Value.ToString(); }); m_sizeMultiplierSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_sizeMultiplierSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_sizeMultiplierValue.Text = s.Value.ToString(); }); m_sizeCapSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_sizeCapSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_sizeCapValue.Text = s.Value.ToString(); }); m_moonProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_moonProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_moonProbValue.Text = String.Format("{0:0.00}", s.Value); }); m_ringWidthSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringWidthSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_ringWidthValue.Text = s.Value.ToString(); }); m_ringProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_ringProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_ringProbValue.Text = String.Format("{0:0.00}", s.Value); }); m_beltHeightSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_beltHeightSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_beltHeightValue.Text = s.Value.ToString(); }); m_beltProbSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_beltProbSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { m_beltProbValue.Text = String.Format("{0:0.000}", s.Value); }); m_worldSizeSlider.ValueChanged = (Action <MyGuiControlSlider>) Delegate.Combine(m_worldSizeSlider.ValueChanged, (Action <MyGuiControlSlider>) delegate(MyGuiControlSlider s) { if (s.Value < 0) { m_worldSizeValue.Text = "Infinite"; } else { m_worldSizeValue.Text = s.Value.ToString(); } }); m_useGlobalCheck.IsCheckedChanged = (Action <MyGuiControlCheckbox>) Delegate.Combine(m_useGlobalCheck.IsCheckedChanged, (Action <MyGuiControlCheckbox>) delegate(MyGuiControlCheckbox s) { m_useSemiRandomGenerationCheck.Enabled = !s.IsChecked; m_useVanillaPlanetsCheck.Enabled = !s.IsChecked; m_planetsOnlyOnceCheck.Enabled = !s.IsChecked; m_moonsOnlyOnceCheck.Enabled = !s.IsChecked; m_objAmountSlider.Enabled = !s.IsChecked; m_asteroidDensitySlider.Enabled = !s.IsChecked; m_asteroidGeneratorCombo.Enabled = !s.IsChecked; m_orbDistanceSlider.Enabled = !s.IsChecked; m_sizeMultiplierSlider.Enabled = !s.IsChecked; m_sizeCapSlider.Enabled = !s.IsChecked; m_moonProbSlider.Enabled = !s.IsChecked; m_ringWidthSlider.Enabled = !s.IsChecked; m_ringProbSlider.Enabled = !s.IsChecked; m_beltHeightSlider.Enabled = !s.IsChecked; m_beltProbSlider.Enabled = !s.IsChecked; m_planetGpsCheck.Enabled = !s.IsChecked; m_moonGpsCheck.Enabled = !s.IsChecked; m_beltGpsCheck.Enabled = !s.IsChecked; m_ringGpsCheck.Enabled = !s.IsChecked; m_worldSizeSlider.Enabled = !s.IsChecked && m_isNewGame; }); parent.Controls.Add(m_useGlobalSettignsLabel); parent.Controls.Add(m_useGlobalCheck); if (m_isNewGame) { parent.Controls.Add(m_useSemiRandomGenerationLabel); parent.Controls.Add(m_useSemiRandomGenerationCheck); parent.Controls.Add(m_useVanillaPlanetsLabel); parent.Controls.Add(m_useVanillaPlanetsCheck); parent.Controls.Add(m_planetsOnlyOnceLabel); parent.Controls.Add(m_planetsOnlyOnceCheck); parent.Controls.Add(m_moonsOnlyOnceLabel); parent.Controls.Add(m_moonsOnlyOnceCheck); parent.Controls.Add(m_planetGpsLabel); parent.Controls.Add(m_planetGpsCheck); parent.Controls.Add(m_moonGpsLabel); parent.Controls.Add(m_moonGpsCheck); } parent.Controls.Add(m_beltGpsLabel); parent.Controls.Add(m_beltGpsCheck); parent.Controls.Add(m_ringGpsLabel); parent.Controls.Add(m_ringGpsCheck); parent.Controls.Add(m_asteroidGeneratorLabel); parent.Controls.Add(m_asteroidGeneratorCombo); parent.Controls.Add(m_asteroidDensityLabel); parent.Controls.Add(m_asteroidDensitySlider); parent.Controls.Add(m_asteroidDensityValue); parent.Controls.Add(m_objAmountLabel); parent.Controls.Add(m_objAmountSlider); parent.Controls.Add(m_objAmountValue); parent.Controls.Add(m_orbDistanceLabel); parent.Controls.Add(m_orbDistanceSlider); parent.Controls.Add(m_orbDistanceValue); parent.Controls.Add(m_sizeMultiplierLabel); parent.Controls.Add(m_sizeMultiplierSlider); parent.Controls.Add(m_sizeMultiplierValue); parent.Controls.Add(m_sizeCapLabel); parent.Controls.Add(m_sizeCapSlider); parent.Controls.Add(m_sizeCapValue); parent.Controls.Add(m_moonProbLabel); parent.Controls.Add(m_moonProbSlider); parent.Controls.Add(m_moonProbValue); parent.Controls.Add(m_ringWidthLabel); parent.Controls.Add(m_ringWidthSlider); parent.Controls.Add(m_ringWidthValue); parent.Controls.Add(m_ringProbLabel); parent.Controls.Add(m_ringProbSlider); parent.Controls.Add(m_ringProbValue); parent.Controls.Add(m_beltHeightLabel); parent.Controls.Add(m_beltHeightSlider); parent.Controls.Add(m_beltHeightValue); parent.Controls.Add(m_beltProbLabel); parent.Controls.Add(m_beltProbSlider); parent.Controls.Add(m_beltProbValue); parent.Controls.Add(m_worldSizeLabel); parent.Controls.Add(m_worldSizeSlider); parent.Controls.Add(m_worldSizeValue); //Vector2 start = (new Vector2(0f, (!m_isNewGame) ? 0.052f : 0.026f) - new Vector2(m_size.Value.X * 0.835f / 2f, m_size.Value.Y / 2f - 0.075f)) + (new Vector2(0f, m_useGlobalSettignsLabel.Size.Y)); Vector2 start = Vector2.Zero - new Vector2(parent.Size.X / 2f, parent.Size.Y / 2f - 0.028f); Vector2 offset = new Vector2(0f, 0.050f);//0.028f Vector2 offset2 = new Vector2(m_orbDistanceLabel.Size.X * 1.5f, 0f); Vector2 offset3 = new Vector2(0.4973214f, 0f); int m = 0; m_useGlobalSettignsLabel.Position = start + offset * m++; m_useGlobalCheck.Position = m_useGlobalSettignsLabel.Position + offset2; if (m_isNewGame) { m_useSemiRandomGenerationLabel.Position = start + offset * m++; m_useSemiRandomGenerationCheck.Position = m_useSemiRandomGenerationLabel.Position + offset2; m_useVanillaPlanetsLabel.Position = start + offset * m++; m_useVanillaPlanetsCheck.Position = m_useVanillaPlanetsLabel.Position + offset2; m_planetsOnlyOnceLabel.Position = start + offset * m++; m_planetsOnlyOnceCheck.Position = m_planetsOnlyOnceLabel.Position + offset2; m_moonsOnlyOnceLabel.Position = start + offset * m++; m_moonsOnlyOnceCheck.Position = m_moonsOnlyOnceLabel.Position + offset2; m_planetGpsLabel.Position = start + offset * m++; m_planetGpsCheck.Position = m_planetGpsLabel.Position + offset2; m_moonGpsLabel.Position = start + offset * m++; m_moonGpsCheck.Position = m_moonGpsLabel.Position + offset2; } m_beltGpsLabel.Position = start + offset * m++; m_beltGpsCheck.Position = m_beltGpsLabel.Position + offset2; m_ringGpsLabel.Position = start + offset * m++; m_ringGpsCheck.Position = m_ringGpsLabel.Position + offset2; m_asteroidGeneratorLabel.Position = start + offset * m++; m_asteroidGeneratorCombo.Position = m_asteroidGeneratorLabel.Position + offset2; m_asteroidDensityLabel.Position = start + offset * m++; m_asteroidDensitySlider.Position = m_asteroidDensityLabel.Position + offset2; m_asteroidDensityValue.Position = m_asteroidDensityLabel.Position + offset3; m_objAmountLabel.Position = start + offset * m++; m_objAmountSlider.Position = m_objAmountLabel.Position + offset2; m_objAmountValue.Position = m_objAmountLabel.Position + offset3; m_orbDistanceLabel.Position = start + offset * m++; m_orbDistanceSlider.Position = m_orbDistanceLabel.Position + offset2; m_orbDistanceValue.Position = m_orbDistanceLabel.Position + offset3; m_sizeMultiplierLabel.Position = start + offset * m++; m_sizeMultiplierSlider.Position = m_sizeMultiplierLabel.Position + offset2; m_sizeMultiplierValue.Position = m_sizeMultiplierLabel.Position + offset3; m_sizeCapLabel.Position = start + offset * m++; m_sizeCapSlider.Position = m_sizeCapLabel.Position + offset2; m_sizeCapValue.Position = m_sizeCapLabel.Position + offset3; m_moonProbLabel.Position = start + offset * m++; m_moonProbSlider.Position = m_moonProbLabel.Position + offset2; m_moonProbValue.Position = m_moonProbLabel.Position + offset3; m_ringWidthLabel.Position = start + offset * m++; m_ringWidthSlider.Position = m_ringWidthLabel.Position + offset2; m_ringWidthValue.Position = m_ringWidthLabel.Position + offset3; m_ringProbLabel.Position = start + offset * m++; m_ringProbSlider.Position = m_ringProbLabel.Position + offset2; m_ringProbValue.Position = m_ringProbLabel.Position + offset3; m_beltHeightLabel.Position = start + offset * m++; m_beltHeightSlider.Position = m_beltHeightLabel.Position + offset2; m_beltHeightValue.Position = m_beltHeightLabel.Position + offset3; m_beltProbLabel.Position = start + offset * m++; m_beltProbSlider.Position = m_beltProbLabel.Position + offset2; m_beltProbValue.Position = m_beltProbLabel.Position + offset3; m_worldSizeLabel.Position = start + offset * m++; m_worldSizeSlider.Position = m_worldSizeLabel.Position + offset2; m_worldSizeValue.Position = m_worldSizeLabel.Position + offset3; m_okButton = new MyGuiControlButton(null, VRage.Game.MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, VRage.MyTexts.Get(MyCommonTexts.Ok), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, OkButtonClicked); m_okButton.SetToolTip(VRage.MyTexts.GetString(MySpaceTexts.ToolTipOptionsSpace_Ok)); m_okButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM; m_okButton.Position = (m_size.Value / 2f - vector) * new Vector2(0f, 1f) + new Vector2(0f - 25f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE; MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(parent); scrollPane.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; scrollPane.ScrollbarVEnabled = true; scrollPane.Size = new Vector2(base.Size.Value.X - vector.X * 2f - 0.035f, 0.74f); scrollPane.Position = new Vector2(-0.27f, -0.394f); if (!m_isNewGame) { m_worldSizeSlider.Enabled = false; } Controls.Add(m_okButton); Controls.Add(scrollPane); }
protected virtual void BuildControls() { Vector2 buttonSize = MyGuiConstants.BACK_BUTTON_SIZE; Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f); if (m_isNewGame) { AddCaption(MyCommonTexts.ScreenCaptionCustomWorld); } else { AddCaption(MyCommonTexts.ScreenCaptionEditSettings); } int numControls = 0; var nameLabel = MakeLabel(MyCommonTexts.Name); var descriptionLabel = MakeLabel(MyCommonTexts.Description); var gameModeLabel = MakeLabel(MyCommonTexts.WorldSettings_GameMode); var onlineModeLabel = MakeLabel(MyCommonTexts.WorldSettings_OnlineMode); m_maxPlayersLabel = MakeLabel(MyCommonTexts.MaxPlayers); var environmentLabel = MakeLabel(MySpaceTexts.WorldSettings_EnvironmentHostility); var scenarioLabel = MakeLabel(MySpaceTexts.WorldSettings_Scenario); float width = 0.284375f + 0.025f; m_nameTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH); m_descriptionTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH); m_onlineMode = new MyGuiControlCombobox(size: new Vector2(width, 0.04f)); m_environment = new MyGuiControlCombobox(size: new Vector2(width, 0.04f)); m_maxPlayersSlider = new MyGuiControlSlider( position: Vector2.Zero, width: m_onlineMode.Size.X, minValue: 2, maxValue: 16, labelText: new StringBuilder("{0}").ToString(), labelDecimalPlaces: 0, labelSpaceWidth: 0.05f, intValue: true ); m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount); m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f)); m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected; m_scenarioTypesList = new MyGuiControlList(); // Ok/Cancel m_okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeCreative), onButtonClick: OnCreativeClick); m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative); m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeSurvival), onButtonClick: OnSurvivalClick); m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival); m_onlineMode.ItemSelected += OnOnlineModeSelect; m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MyCommonTexts.WorldSettings_OnlineModeOffline); m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MyCommonTexts.WorldSettings_OnlineModePrivate); m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MyCommonTexts.WorldSettings_OnlineModeFriends); m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MyCommonTexts.WorldSettings_OnlineModePublic); m_environment.AddItem((int)MyEnvironmentHostilityEnum.SAFE, MySpaceTexts.WorldSettings_EnvironmentHostilitySafe); m_environment.AddItem((int)MyEnvironmentHostilityEnum.NORMAL, MySpaceTexts.WorldSettings_EnvironmentHostilityNormal); m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysm); m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM_UNREAL, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysmUnreal); m_environment.ItemSelected += HostilityChanged; if (m_isNewGame) { m_scenarioTypesGroup = new MyGuiControlRadioButtonGroup(); m_scenarioTypesGroup.SelectedChanged += scenario_SelectedChanged; foreach (var scenario in MyDefinitionManager.Static.GetScenarioDefinitions()) { if (!scenario.Public && !MyFakes.ENABLE_NON_PUBLIC_SCENARIOS) { continue; } var button = new MyGuiControlScenarioButton(scenario); m_scenarioTypesGroup.Add(button); m_scenarioTypesList.Controls.Add(button); } } m_nameTextbox.SetToolTip(string.Format(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsName), MySession.MIN_NAME_LENGTH, MySession.MAX_NAME_LENGTH)); m_descriptionTextbox.SetToolTip(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsDescription)); m_environment.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsEnvironment)); m_onlineMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsOnlineMode)); m_maxPlayersSlider.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsMaxPlayer)); m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount)); m_nameTextbox.TextChanged += m_nameTextbox_TextChanged; var advanced = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Advanced), onButtonClick: OnAdvancedClick); var mods = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_Mods), onButtonClick: OnModsClick); m_worldGeneratorButton = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_WorldGenerator), onButtonClick: OnWorldGeneratorClick); // Add controls in pairs; label first, control second. They will be laid out automatically this way. Controls.Add(nameLabel); Controls.Add(m_nameTextbox); Controls.Add(descriptionLabel); Controls.Add(m_descriptionTextbox); Controls.Add(gameModeLabel); Controls.Add(m_creativeModeButton); Controls.Add(onlineModeLabel); Controls.Add(m_onlineMode); Controls.Add(m_maxPlayersLabel); Controls.Add(m_maxPlayersSlider); if (MyFakes.ENABLE_METEOR_SHOWERS) { Controls.Add(environmentLabel); Controls.Add(m_environment); } if (m_isNewGame && MyFakes.ENABLE_PLANETS == false) { Controls.Add(m_asteroidAmountLabel); Controls.Add(m_asteroidAmountCombo); } var autoSaveLabel = MakeLabel(MyCommonTexts.WorldSettings_AutoSave); m_autoSave = new MyGuiControlCheckbox(); m_autoSave.SetToolTip(new StringBuilder().AppendFormat(MyCommonTexts.ToolTipWorldSettingsAutoSave, MyObjectBuilder_SessionSettings.DEFAULT_AUTOSAVE_IN_MINUTES).ToString()); Controls.Add(autoSaveLabel); Controls.Add(m_autoSave); var scenarioEditModeLabel = MakeLabel(MySpaceTexts.WorldSettings_ScenarioEditMode); m_scenarioEditMode = new MyGuiControlCheckbox(); m_scenarioEditMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettings_ScenarioEditMode)); Controls.Add(scenarioEditModeLabel); Controls.Add(m_scenarioEditMode); if (MyFakes.ENABLE_WORKSHOP_MODS) { Controls.Add(mods); } Controls.Add(advanced); if (m_isNewGame && MyFakes.ENABLE_PLANETS == true) { Controls.Add(m_worldGeneratorButton); } float labelSize = 0.20f; float MARGIN_TOP = 0.12f; float MARGIN_BOTTOM = 0.12f; float MARGIN_LEFT = m_isNewGame ? 0.315f : 0.08f; float MARGIN_RIGHT = m_isNewGame ? 0.075f : 0.045f; // Automatic layout. Vector2 originL, originC; Vector2 controlsDelta = new Vector2(0f, 0.052f); float rightColumnOffset; originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP); originC = originL + new Vector2(labelSize, 0f); rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f; foreach (var control in Controls) { control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; if (control is MyGuiControlLabel) { control.Position = originL + controlsDelta * numControls; } else { control.Position = originC + controlsDelta * numControls++; } } Controls.Add(m_survivalModeButton); m_survivalModeButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; m_survivalModeButton.Position = m_creativeModeButton.Position + new Vector2(m_onlineMode.Size.X, 0); if (m_isNewGame) { Vector2 scenarioPosition = new Vector2(-0.375f, nameLabel.Position.Y); m_nameTextbox.Size = m_onlineMode.Size; m_descriptionTextbox.Size = m_nameTextbox.Size; scenarioLabel.Position = scenarioPosition; m_scenarioTypesList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_scenarioTypesList.Position = scenarioLabel.Position + new Vector2(0, 0.02f); m_scenarioTypesList.Size = new Vector2(0.19f, m_size.Value.Y - MARGIN_BOTTOM - MARGIN_TOP); Controls.Add(scenarioLabel); Controls.Add(m_scenarioTypesList); MyGuiControlSeparatorList m_verticalLine = new MyGuiControlSeparatorList(); Vector2 position = nameLabel.Position + new Vector2(-0.025f, -0.02f); m_verticalLine.AddVertical(position, m_size.Value.Y - MARGIN_BOTTOM - MARGIN_TOP + 0.04f); Controls.Add(m_verticalLine); } var pos2 = advanced.Position; //pos2.X = m_isNewGame ? 0.160f : 0.0f; pos2.X = Size.HasValue ? Size.Value.X / 2.0f - advanced.Size.X - MARGIN_RIGHT : 0.0f; advanced.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; advanced.Position = pos2; mods.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; mods.Position = advanced.Position - new Vector2(advanced.Size.X + 0.017f, 0); m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; m_worldGeneratorButton.Position = advanced.Position - new Vector2(advanced.Size.X + 0.017f, -0.06f); Controls.Add(m_okButton); Controls.Add(m_cancelButton); CloseButtonEnabled = true; }
public MyGuiControlNews() : base(isActiveControl: true, canHaveFocus: false, allowFocusingElements: true) { m_news = new List <MyNewsEntry>(); m_labelTitle = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "Title" }; m_labelDate = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP) { Name = "Date" }; m_separator = new MyGuiControlSeparatorList() { Name = "Separator", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER }; m_textNewsEntry = new MyGuiControlMultilineText( textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f, drawScrollbar: true) { Name = "NewsEntry", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, }; m_textNewsEntry.OnLinkClicked += OnLinkClicked; m_bottomPanel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_PAGING_BACKGROUND, Name = "BottomPanel", }; m_labelPages = new MyGuiControlLabel( text: new StringBuilder("{0}/{1} ").ToString(), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) { Name = "Pages" }; m_buttonPrev = new MyGuiControlButton( visualStyle: MyGuiControlButtonStyleEnum.ArrowLeft, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, onButtonClick: (b) => UpdateCurrentEntryIndex(-1)) { Name = "Previous" }; m_buttonNext = new MyGuiControlButton( visualStyle: MyGuiControlButtonStyleEnum.ArrowRight, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, onButtonClick: (b) => UpdateCurrentEntryIndex(+1)) { Name = "Next" }; m_textError = new MyGuiControlMultilineText( textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, font: MyFontEnum.Red) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, Name = "Error" }; m_backgroundPanel = new MyGuiControlCompositePanel() { ColorMask = new Vector4(1f, 1f, 1f, 0.69f), BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_BACKGROUND }; m_wheelLoading = new MyGuiControlRotatingWheel(multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels); Elements.Add(m_backgroundPanel); Elements.Add(m_labelTitle); Elements.Add(m_labelDate); Elements.Add(m_separator); Elements.Add(m_textNewsEntry); Elements.Add(m_bottomPanel); Elements.Add(m_labelPages); Elements.Add(m_buttonPrev); Elements.Add(m_buttonNext); Elements.Add(m_textError); Elements.Add(m_wheelLoading); if (false) { m_textNewsEntry.BorderEnabled = true; m_labelPages.BorderEnabled = true; m_bottomPanel.BorderEnabled = true; m_buttonPrev.BorderEnabled = true; m_buttonNext.BorderEnabled = true; m_textError.BorderEnabled = true; m_wheelLoading.BorderEnabled = true; } RefreshState(); UpdatePositionsAndSizes(); RefreshShownEntry(); }
/// <summary> /// This applies all rows that are currently added and /// sets the size of this parent and the positions of the children. /// Only run, when all rows were added. /// </summary> public void ApplyRows() { Controls.Clear(); float tableWidth = 0; foreach (var columnWidth in m_columnWidths) { tableWidth += columnWidth + MARGIN_COLUMNS; } if (MinSize.X > tableWidth) { tableWidth = MinSize.X; } Size = new Vector2(tableWidth, m_tableHeight - MARGIN_ROWS + m_padding.Y); Vector2 currentRowTopLeft = new Vector2(Size.X / -2 + m_padding.X, Size.Y / -2 + m_padding.Y); foreach (var row in m_tableRows) { if (row == null) { MyGuiControlSeparatorList sep = new MyGuiControlSeparatorList(); sep.AddHorizontal(currentRowTopLeft, tableWidth - MARGIN_COLUMNS); Controls.Add(sep); currentRowTopLeft += new Vector2(0, MARGIN_ROWS); continue; } float currentColumnOffset = 0; float rowHeight = 0; foreach (var col in row) { if (col == null) { continue; } rowHeight = Math.Max(rowHeight, col.Size.Y); } for (int i = 0; i < row.Length; i++) { var control = row[i]; if (control != null) { control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; control.Position = currentRowTopLeft + new Vector2(currentColumnOffset, rowHeight / 2); Controls.Add(control); } currentColumnOffset += m_columnWidths[i] + MARGIN_COLUMNS; } currentRowTopLeft += new Vector2(0, rowHeight + MARGIN_ROWS); } }