public void Init(IMyGuiControlsParent controlsParent, MyPlayer controller, MyCubeGrid grid, MyTerminalBlock currentBlock, MyGridColorHelper colorHelper) { m_controlsParent = controlsParent; m_controller = controller; m_colorHelper = colorHelper; if (grid == null) { foreach (var control in controlsParent.Controls) { control.Visible = false; } var label = MyGuiScreenTerminal.CreateErrorLabel(MySpaceTexts.ScreenTerminalError_ShipNotConnected, "ErrorMessage"); controlsParent.Controls.Add(label); return; } m_terminalSystem = grid.GridSystems.TerminalSystem; m_tmpGroup = new MyBlockGroup(grid); m_blockSearch = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearch"); m_blockSearch.TextChanged += blockSearch_TextChanged; m_blockSearchClear = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearchClear"); m_blockSearchClear.ButtonClicked += blockSearchClear_ButtonClicked; m_blockListbox = (MyGuiControlListbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockListbox"); m_blockNameLabel = (MyGuiControlLabel)m_controlsParent.Controls.GetControlByName("BlockNameLabel"); m_blockNameLabel.Text = ""; m_groupName = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("GroupName"); m_groupName.TextChanged += m_groupName_TextChanged; m_showAll = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("ShowAll"); m_showAll.Selected = m_showAllTerminalBlocks; m_showAll.ButtonClicked += showAll_Clicked; m_showAll.SetToolTip(MySpaceTexts.Terminal_ShowAllInTerminal); m_showAll.IconRotation = 0f; m_showAll.Icon = new MyGuiHighlightTexture { Normal = @"Textures\GUI\Controls\button_hide.dds", Highlight = @"Textures\GUI\Controls\button_unhide.dds", SizePx = new Vector2(40f, 40f), }; m_showAll.Size = new Vector2(0, 0); m_showAll.HighlightType = MyGuiControlHighlightType.FORCED; m_showAll.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_groupSave = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupSave"); m_groupSave.TextEnum = MySpaceTexts.TerminalButton_GroupSave; m_groupSave.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER; m_groupSave.ButtonClicked += groupSave_ButtonClicked; m_groupDelete = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupDelete"); m_groupDelete.ButtonClicked += groupDelete_ButtonClicked; m_groupDelete.Enabled = false; m_blockListbox.ItemsSelected += blockListbox_ItemSelected; RefreshBlockList(); m_terminalSystem.BlockAdded += TerminalSystem_BlockAdded; m_terminalSystem.BlockRemoved += TerminalSystem_BlockRemoved; m_terminalSystem.GroupAdded += TerminalSystem_GroupAdded; m_terminalSystem.GroupRemoved += TerminalSystem_GroupRemoved; if (currentBlock != null) { SelectBlocks(new MyTerminalBlock[] { currentBlock }); } }
public void Init(IMyGuiControlsParent controlsParent) { m_controlsParent = controlsParent; RefreshUserInfo(); m_tableFactions = (MyGuiControlTable)controlsParent.Controls.GetControlByName("FactionsTable"); m_tableFactions.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData)); m_tableFactions.SetColumnComparison(1, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData)); m_tableFactions.ItemSelected += OnFactionsTableItemSelected; RefreshTableFactions(); m_tableFactions.SortByColumn(1); m_buttonCreate = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCreate"); m_buttonJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonJoin"); m_buttonCancelJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelJoin"); m_buttonLeave = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonLeave"); m_buttonSendPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonSendPeace"); m_buttonCancelPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelPeace"); m_buttonAcceptPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptPeace"); m_buttonMakeEnemy = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEnemy"); m_buttonCreate.ShowTooltipWhenDisabled = true; m_buttonCreate.TextEnum = MySpaceTexts.TerminalTab_Factions_Create; m_buttonJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_Join; m_buttonCancelJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelJoin; m_buttonLeave.TextEnum = MySpaceTexts.TerminalTab_Factions_Leave; m_buttonSendPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_Friend; m_buttonCancelPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelPeaceRequest; m_buttonAcceptPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_AcceptPeaceRequest; m_buttonMakeEnemy.TextEnum = MySpaceTexts.TerminalTab_Factions_Enemy; m_buttonJoin.SetToolTip(MySpaceTexts.TerminalTab_Factions_JoinToolTip); m_buttonSendPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_FriendToolTip); m_buttonCreate.ButtonClicked += OnCreateClicked; m_buttonJoin.ButtonClicked += OnJoinClicked; m_buttonCancelJoin.ButtonClicked += OnCancelJoinClicked; m_buttonLeave.ButtonClicked += OnLeaveClicked; m_buttonSendPeace.ButtonClicked += OnFriendClicked; m_buttonCancelPeace.ButtonClicked += OnCancelPeaceRequestClicked; m_buttonAcceptPeace.ButtonClicked += OnAcceptFriendClicked; m_buttonMakeEnemy.ButtonClicked += OnEnemyClicked; // RIGHT SIDE m_labelFactionName = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionName"); m_labelFactionDesc = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionDesc"); m_labelFactionPriv = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionPrivate"); m_labelMembers = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembers"); m_labelAutoAcceptMember = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptEveryone"); m_labelAutoAcceptPeace = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptPeace"); m_labelFactionDesc.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription).ToString(); m_labelFactionPriv.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Private).ToString(); m_labelMembers.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Members).ToString(); m_labelAutoAcceptMember.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAccept).ToString(); m_labelAutoAcceptPeace.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequest).ToString(); m_labelAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip); m_labelAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip); m_textFactionDesc = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionDesc"); m_textFactionPriv = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionPrivate"); m_textFactionDesc.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK; m_textFactionPriv.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK; m_tableMembers = (MyGuiControlTable)controlsParent.Controls.GetControlByName("tableMembers"); m_tableMembers.SetColumnComparison(1, (a, b) => ((int)((MyMemberComparerEnum)a.UserData)).CompareTo((int)((MyMemberComparerEnum)b.UserData))); m_tableMembers.ItemSelected += OnTableItemSelected; m_checkAutoAcceptMember = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptEveryone"); m_checkAutoAcceptPeace = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptPeace"); m_checkAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip); m_checkAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip); m_checkAutoAcceptMember.IsCheckedChanged += OnAutoAcceptChanged; m_checkAutoAcceptPeace.IsCheckedChanged += OnAutoAcceptChanged; m_buttonEdit = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEdit"); m_buttonPromote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonPromote"); m_buttonKick = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonKick"); m_buttonAcceptJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptJoin"); m_buttonDemote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonDemote"); m_buttonAddNpc = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAddNpc"); m_buttonEdit.TextEnum = MySpaceTexts.Edit; m_buttonPromote.TextEnum = MySpaceTexts.Promote; m_buttonKick.TextEnum = MySpaceTexts.Kick; m_buttonAcceptJoin.TextEnum = MySpaceTexts.Accept; m_buttonDemote.TextEnum = MySpaceTexts.Demote; m_buttonAddNpc.TextEnum = MySpaceTexts.AddNpcToFaction; m_buttonAddNpc.SetToolTip(MySpaceTexts.AddNpcToFactionHelp); m_buttonEdit.ButtonClicked += OnCreateClicked; m_buttonPromote.ButtonClicked += OnPromotePlayerClicked; m_buttonKick.ButtonClicked += OnKickPlayerClicked; m_buttonAcceptJoin.ButtonClicked += OnAcceptJoinClicked; m_buttonDemote.ButtonClicked += OnDemoteClicked; m_buttonAddNpc.ButtonClicked += OnNewNpcClicked; MySession.Static.Factions.FactionCreated += OnFactionCreated; MySession.Static.Factions.FactionEdited += OnFactionEdited; MySession.Static.Factions.FactionStateChanged += OnFactionsStateChanged; MySession.Static.Factions.FactionAutoAcceptChanged += OnAutoAcceptChanged; Refresh(); }
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(MySpaceTexts.ScreenCaptionCustomWorld); } else { AddCaption(MySpaceTexts.ScreenCaptionEditSettings); } int numControls = 0; var nameLabel = MakeLabel(MySpaceTexts.Name); var descriptionLabel = MakeLabel(MySpaceTexts.Description); var gameModeLabel = MakeLabel(MySpaceTexts.WorldSettings_GameMode); var onlineModeLabel = MakeLabel(MySpaceTexts.WorldSettings_OnlineMode); m_maxPlayersLabel = MakeLabel(MySpaceTexts.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_scenarioTypesList = new MyGuiControlList(); m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount); m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f)); m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected; // Ok/Cancel m_okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.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(MySpaceTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative), onButtonClick: OnCreativeClick); m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative); m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival), onButtonClick: OnSurvivalClick); m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival); m_onlineMode.ItemSelected += OnOnlineModeSelect; m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MySpaceTexts.WorldSettings_OnlineModeOffline); m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MySpaceTexts.WorldSettings_OnlineModePrivate); m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MySpaceTexts.WorldSettings_OnlineModeFriends); m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MySpaceTexts.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); 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_BLOCKS) { continue; } var button = new MyGuiControlScenarioButton(scenario); m_scenarioTypesGroup.Add(button); m_scenarioTypesList.Controls.Add(button); } } m_nameTextbox.SetToolTip(string.Format(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsName), MySession.MIN_NAME_LENGTH, MySession.MAX_NAME_LENGTH)); m_descriptionTextbox.SetToolTip(MyTexts.GetString(MySpaceTexts.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(MySpaceTexts.WorldSettings_Mods), onButtonClick: OnModsClick); // 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) { Controls.Add(m_asteroidAmountLabel); Controls.Add(m_asteroidAmountCombo); } if (MyFakes.ENABLE_PLANETS && m_isNewGame) { m_floraDensityLabel = MakeLabel(MySpaceTexts.WorldSettings_FloraDensity); m_floraDensityCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f)); m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.NONE, MySpaceTexts.WorldSettings_FloraDensity_None); m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.LOW, MySpaceTexts.WorldSettings_FloraDensity_Low); m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.MEDIUM, MySpaceTexts.WorldSettings_FloraDensity_Medium); m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.HIGH, MySpaceTexts.WorldSettings_FloraDensity_High); m_floraDensityCombo.AddItem((int)MyFloraDensityEnum.EXTREME, MySpaceTexts.WorldSettings_FloraDensity_Extreme); m_floraDensityCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettings_FloraDensity)); Controls.Add(m_floraDensityLabel); Controls.Add(m_floraDensityCombo); } var autoSaveLabel = MakeLabel(MySpaceTexts.WorldSettings_AutoSave); m_autoSave = new MyGuiControlCheckbox(); m_autoSave.SetToolTip(new StringBuilder().AppendFormat(MySpaceTexts.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_PLANETS && m_isNewGame) { var enablePlanetsLabel = MakeLabel(MySpaceTexts.WorldSettings_EnablePlanets); m_enablePlanets = new MyGuiControlCheckbox(); m_enablePlanets.SetToolTip(MySpaceTexts.ToolTipWorldSettings_EnablePlanets); Controls.Add(enablePlanetsLabel); Controls.Add(m_enablePlanets); } if (MyFakes.ENABLE_WORKSHOP_MODS) { Controls.Add(mods); } Controls.Add(advanced); 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); Controls.Add(m_okButton); Controls.Add(m_cancelButton); CloseButtonEnabled = true; }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); AddCaption(MySpaceTexts.ScreenCaptionWorkshop); var origin = new Vector2(-0.4375f, -0.375f); Vector2 tinyButtonsOrigin = new Vector2(-0.0015f, -4.5f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA.Y); m_modsTableDisabled = new MyGuiControlTable(); if (MyFakes.ENABLE_MOD_CATEGORIES) { m_modsTableDisabled.Position = origin + new Vector2(0f, 0.1f); m_modsTableDisabled.VisibleRowsCount = 17; } else { m_modsTableDisabled.Position = origin; m_modsTableDisabled.VisibleRowsCount = 20; } m_modsTableDisabled.Size = new Vector2(m_size.Value.X * 0.4375f, 1.25f); m_modsTableDisabled.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_modsTableDisabled.ColumnsCount = 2; m_modsTableDisabled.ItemSelected += OnTableItemSelected; m_modsTableDisabled.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick; m_modsTableDisabled.ItemConfirmed += OnTableItemConfirmedOrDoubleClick; m_modsTableDisabled.SetCustomColumnWidths(new float[] { 0.085f, 0.905f }); m_modsTableDisabled.SetColumnComparison(1, (a, b) => (a.Text).CompareToIgnoreCase(b.Text)); Controls.Add(m_modsTableDisabled); m_modsTableEnabled = new MyGuiControlTable(); m_modsTableEnabled.Position = origin + new Vector2(m_modsTableDisabled.Size.X + 0.04f, 0f); m_modsTableEnabled.Size = new Vector2(m_size.Value.X * 0.4375f, 1.25f); m_modsTableEnabled.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_modsTableEnabled.ColumnsCount = 2; if (MyFakes.ENABLE_MOD_CATEGORIES) { m_modsTableEnabled.Position = new Vector2(m_modsTableEnabled.Position.X, m_modsTableDisabled.Position.Y - 0.065f); m_modsTableEnabled.VisibleRowsCount = 19; } else { m_modsTableEnabled.VisibleRowsCount = 20; } m_modsTableEnabled.ItemSelected += OnTableItemSelected; m_modsTableEnabled.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick; m_modsTableEnabled.ItemConfirmed += OnTableItemConfirmedOrDoubleClick; m_modsTableEnabled.SetCustomColumnWidths(new float[] { 0.085f, 0.905f }); Controls.Add(m_modsTableEnabled); Controls.Add(m_labelEnabled = MakeLabel(m_modsTableEnabled.Position + new Vector2(m_modsTableEnabled.Size.X / 2f, 0f), MySpaceTexts.ScreenMods_ActiveMods)); Controls.Add(m_labelDisabled = MakeLabel(m_modsTableDisabled.Position + new Vector2(m_modsTableDisabled.Size.X / 2f, 0f), MySpaceTexts.ScreenMods_AvailableMods)); Controls.Add(m_moveUpButton = MakeButtonTiny(tinyButtonsOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, -MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveUp, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveUpClick)); Controls.Add(m_moveTopButton = MakeButtonTiny(tinyButtonsOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, -MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveTop, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveTopClick)); Controls.Add(m_moveBottomButton = MakeButtonTiny(tinyButtonsOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveBottom, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveBottomClick)); Controls.Add(m_moveDownButton = MakeButtonTiny(tinyButtonsOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveDown, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveDownClick)); Controls.Add(m_moveLeftButton = MakeButtonTiny(tinyButtonsOrigin + 5 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.Pi, MySpaceTexts.ToolTipScreenMods_MoveLeft, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveLeftClick)); Controls.Add(m_moveLeftAllButton = MakeButtonTiny(tinyButtonsOrigin + 6 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.Pi, MySpaceTexts.ToolTipScreenMods_MoveLeftAll, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveLeftAllClick)); Controls.Add(m_moveRightAllButton = MakeButtonTiny(tinyButtonsOrigin + 7 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, 0f, MySpaceTexts.ToolTipScreenMods_MoveRightAll, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveRightAllClick)); Controls.Add(m_moveRightButton = MakeButtonTiny(tinyButtonsOrigin + 8 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, 0f, MySpaceTexts.ToolTipScreenMods_MoveRight, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveRightClick)); Controls.Add(m_publishModButton = MakeButton(m_modsTableDisabled.Position + new Vector2(0f, m_modsTableDisabled.Size.Y + 0.01f), MySpaceTexts.LoadScreenButtonPublish, MySpaceTexts.LoadScreenButtonPublish, OnPublishModClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)); Controls.Add(m_openInWorkshopButton = MakeButton(m_publishModButton.Position + new Vector2(m_publishModButton.Size.X + 0.04f, 0f), MySpaceTexts.ScreenLoadSubscribedWorldOpenInWorkshop, MySpaceTexts.ToolTipWorkshopOpenModInWorkshop, OnOpenInWorkshopClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)); Controls.Add(m_refreshButton = MakeButton(m_publishModButton.Position + new Vector2(0f, m_publishModButton.Size.Y + 0.01f), MySpaceTexts.ScreenLoadSubscribedWorldRefresh, MySpaceTexts.ToolTipWorkshopRefreshMod, OnRefreshClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)); Controls.Add(m_browseWorkshopButton = MakeButton(m_openInWorkshopButton.Position + new Vector2(0f, m_publishModButton.Size.Y + 0.01f), MySpaceTexts.ScreenLoadSubscribedWorldBrowseWorkshop, MySpaceTexts.ToolTipWorkshopBrowseWorkshop, OnBrowseWorkshopClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)); Controls.Add(m_cancelButton = MakeButton(m_modsTableEnabled.Position + m_modsTableEnabled.Size + new Vector2(0f, 0.01f), MySpaceTexts.Cancel, MySpaceTexts.Cancel, OnCancelClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)); Controls.Add(m_okButton = MakeButton(m_cancelButton.Position - new Vector2(m_cancelButton.Size.X + 0.04f, 0f), MySpaceTexts.Ok, MySpaceTexts.Ok, OnOkClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)); //category buttons if (MyFakes.ENABLE_MOD_CATEGORIES) { Vector2 buttonPosition = m_modsTableDisabled.Position + new Vector2(0.02f, -0.03f); Vector2 buttonOffset = new Vector2(0.0414f, 0f); var categories = MySteamWorkshop.ModCategories; int i = 0; for (; i < categories.Length; ++i) { Controls.Add(MakeButtonCategory(buttonPosition + buttonOffset * i, categories[i])); } var m_categoryCategorySelectButton = new MyGuiControlButton() { Position = (buttonPosition + buttonOffset * i) + new Vector2(-0.02f, -0.014f), Size = new Vector2(0.05f, 0.05f), Name = "SelectCategory", Text = "...", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, VisualStyle = MyGuiControlButtonStyleEnum.Tiny, }; m_categoryCategorySelectButton.SetToolTip(MySpaceTexts.TooltipScreenMods_SelectCategories); m_categoryCategorySelectButton.ButtonClicked += OnSelectCategoryClicked; Controls.Add(m_categoryCategorySelectButton); Vector2 searchPosition = m_modsTableDisabled.Position + new Vector2(0.1625f, -0.08f); var searchBoxLabel = MakeLabel(searchPosition + new Vector2(-0.135f, 0.01f), MySpaceTexts.ScreenMods_SearchLabel); m_searchBox = new MyGuiControlTextbox(searchPosition); m_searchBox.Size = new Vector2(0.2f, 0.2f); m_searchBox.TextChanged += OnSearchTextChanged; m_searchClear = new MyGuiControlButton() { Position = searchPosition + new Vector2(0.077f, 0f), Size = new Vector2(0.045f, 0.05666667f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; m_searchClear.ButtonClicked += OnSearchClear; Vector2 buttonsOffset = new Vector2(0, 0.05f); m_moveUpButton.Position += buttonsOffset; m_moveTopButton.Position += buttonsOffset; m_moveBottomButton.Position += buttonsOffset; m_moveDownButton.Position += buttonsOffset; m_moveLeftButton.Position += buttonsOffset; m_moveLeftAllButton.Position += buttonsOffset; m_moveRightAllButton.Position += buttonsOffset; m_moveRightButton.Position += buttonsOffset; Controls.Add(searchBoxLabel); Controls.Add(m_searchBox); Controls.Add(m_searchClear); m_labelDisabled.Position += new Vector2(0, -0.1f); } CloseButtonEnabled = true; }
private void CreateInGameMenuControls() { 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.ScreenMenuButtonSave), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { base.CanBeHidden = false; MyGuiScreenMessageBox myGuiScreenMessageBox = ((!MyAsyncSaving.InProgress) ? MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.YES_NO, MyTexts.Get(MyCommonTexts.MessageBoxTextDoYouWantToSaveYourProgress), MyTexts.Get(MyCommonTexts.MessageBoxCaptionPleaseConfirm), null, null, null, null, OnSaveWorldMessageBoxCallback) : MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK, MyTexts.Get(MyCommonTexts.MessageBoxTextSavingInProgress), MyTexts.Get(MyCommonTexts.MessageBoxCaptionError))); myGuiScreenMessageBox.SkipTransition = true; myGuiScreenMessageBox.InstantClose = false; MyGuiSandbox.AddScreen(myGuiScreenMessageBox); }); myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu; MyGuiControlButton myGuiControlButton2 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.LoadScreenButtonSaveAs), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenSaveAs(MySession.Static.Name)); }); myGuiControlButton2.GamepadHelpTextId = optionsScreen_Help_Menu; if (!Sync.IsServer || (MySession.Static != null && !MySession.Static.Settings.EnableSaving)) { MyStringId toolTip = ((!Sync.IsServer) ? MyCommonTexts.NotificationClientCannotSave : MyCommonTexts.NotificationSavingDisabled); myGuiControlButton.Enabled = false; myGuiControlButton.ShowTooltipWhenDisabled = true; myGuiControlButton.SetToolTip(toolTip); myGuiControlButton2.Enabled = false; myGuiControlButton2.ShowTooltipWhenDisabled = true; myGuiControlButton2.SetToolTip(toolTip); } Controls.Add(myGuiControlButton); m_elementGroup.Add(myGuiControlButton); Controls.Add(myGuiControlButton2); m_elementGroup.Add(myGuiControlButton2); MyGuiControlButton myGuiControlButton3; if (Sync.MultiplayerActive) { myGuiControlButton3 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonPlayers), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyGuiScreenPlayers>(Array.Empty <object>())); }); myGuiControlButton3.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton3); m_elementGroup.Add(myGuiControlButton3); } MyGuiControlButton myGuiControlButton4 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonOptions), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { MyGuiSandbox.AddScreen(new MyGuiScreenOptionsAudio(m_isLimitedMenu)); }); myGuiControlButton4.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton4); m_elementGroup.Add(myGuiControlButton4); MyGuiControlButton myGuiControlButton5 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonExitToMainMenu), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate { base.CanBeHidden = false; MyGuiScreenMessageBox myGuiScreenMessageBox = ((!Sync.IsServer) ? MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info, MyMessageBoxButtonsType.YES_NO, MyTexts.Get(MyCommonTexts.MessageBoxTextAnyWorldBeforeExit), MyTexts.Get(MyCommonTexts.MessageBoxCaptionExit), null, null, null, null, OnExitToMainMenuFromCampaignMessageBoxCallback) : ((MySession.Static.Settings.EnableSaving && Sync.IsServer) ? MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.YES_NO_CANCEL, MyTexts.Get(MyCommonTexts.MessageBoxTextSaveChangesBeforeExit), MyTexts.Get(MyCommonTexts.MessageBoxCaptionExit), null, null, null, null, OnExitToMainMenuMessageBoxCallback) : MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info, MyMessageBoxButtonsType.YES_NO, MyTexts.Get(MyCommonTexts.MessageBoxTextCampaignBeforeExit), MyTexts.Get(MyCommonTexts.MessageBoxCaptionExit), null, null, null, null, OnExitToMainMenuFromCampaignMessageBoxCallback))); myGuiScreenMessageBox.SkipTransition = true; myGuiScreenMessageBox.InstantClose = false; MyGuiSandbox.AddScreen(myGuiScreenMessageBox); }); myGuiControlButton4.GamepadHelpTextId = optionsScreen_Help_Menu; Controls.Add(myGuiControlButton5); m_elementGroup.Add(myGuiControlButton5); }
protected virtual void BuildControls() { if (m_isNewGame) { //AddCaption(MyCommonTexts.ScreenCaptionCustomWorld); } else { AddCaption(MyCommonTexts.ScreenCaptionEditSettings); } int numControls = 0; float MARGIN_TOP = m_isNewGame ? 0.18f : 0.1f; float MARGIN_BOTTOM = 0.11f; float MARGIN_LEFT = m_isNewGame ? 0.23f : 0.03f; float MARGIN_RIGHT = m_isNewGame ? 0.03f : 0.03f; float MARGIN_BOTTOM_LISTBOX = 0.015f; // Automatic layout. Vector2 originL, originC, sizeL, sizeC, sizeControls; Vector2 controlsDelta = new Vector2(0f, 0.052f); float rightColumnOffset; originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP) + controlsDelta / 2; sizeControls = m_size.Value / 2 - originL; sizeControls.X -= MARGIN_RIGHT + 0.005f; sizeControls.Y -= MARGIN_BOTTOM; sizeL = sizeControls * (m_isNewGame ? 0.44f : 0.395f); originC = originL + new Vector2(sizeL.X, 0f); sizeC = sizeControls - sizeL; //rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f; // Button positioning Vector2 buttonSize = MyGuiConstants.BACK_BUTTON_SIZE; Vector2 buttonsOrigin = m_size.Value / 2; buttonsOrigin.X -= MARGIN_RIGHT; buttonsOrigin.Y -= 0.03f; 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 soundModeLabel = MakeLabel(MySpaceTexts.WorldSettings_SoundMode); 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(sizeC.X, 0.04f)); m_environment = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 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(sizeC.X, 0.04f)); m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected; m_soundModeCombo = new MyGuiControlCombobox(size: new Vector2(sizeC.X, 0.04f)); m_scenarioTypesList = new MyGuiControlList(); // Ok/Cancel m_cancelButton = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); buttonsOrigin.X -= m_cancelButton.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X; m_okButton = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_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; m_soundModeCombo.AddItem((int)MySoundModeEnum.Arcade, MySpaceTexts.WorldSettings_ArcadeSound); m_soundModeCombo.AddItem((int)MySoundModeEnum.Realistic, MySpaceTexts.WorldSettings_RealisticSound); if (m_isNewGame) { if (MyDefinitionManager.Static.GetScenarioDefinitions().Count == 0) { MyDefinitionManager.Static.LoadScenarios(); } m_scenarioTypesGroup = new MyGuiControlRadioButtonGroup(); m_scenarioTypesGroup.SelectedChanged += scenario_SelectedChanged; RefreshCustomWorldsList(); } 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_soundModeCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsSoundMode)); m_nameTextbox.TextChanged += m_nameTextbox_TextChanged; m_soundModeCombo.ItemSelected += m_soundModeCombo_ItemSelected; var advanced = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Advanced), onButtonClick: OnAdvancedClick); #if !XB1 // XB1_NOWORKSHOP var mods = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_Mods), onButtonClick: OnModsClick); #endif // !XB1 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); if (MyFakes.ENABLE_NEW_SOUNDS) { Controls.Add(soundModeLabel); Controls.Add(m_soundModeCombo); } 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 blockLimitsLabel = MakeLabel(MyCommonTexts.WorldSettings_BlockLimits); m_blockLimits = new MyGuiControlCheckbox(); m_blockLimits.IsCheckedChanged = blockLimits_CheckedChanged; m_blockLimits.SetToolTip(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsBlockLimits)); Controls.Add(blockLimitsLabel); Controls.Add(m_blockLimits); 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); #if !XB1 // XB1_NOWORKSHOP if (!MyFakes.XB1_PREVIEW) { if (MyFakes.ENABLE_WORKSHOP_MODS) { Controls.Add(mods); } } #endif // !XB1 Controls.Add(advanced); // Uncomment to show the World generator button again if (m_isNewGame && MyFakes.ENABLE_PLANETS == true) { Controls.Add(m_worldGeneratorButton); } 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); m_nameTextbox.Size = m_onlineMode.Size; m_descriptionTextbox.Size = m_nameTextbox.Size; if (m_isNewGame) { Vector2 scenarioPosition = -m_size.Value / 2 + new Vector2(0.015f, MARGIN_TOP); m_scenarioTypesList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_scenarioTypesList.Position = scenarioPosition; m_scenarioTypesList.Size = new Vector2(MyGuiConstants.LISTBOX_WIDTH, m_size.Value.Y - 0.02f - MARGIN_TOP); 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; #if !XB1 // XB1_NOWORKSHOP mods.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; mods.Position = advanced.Position - new Vector2(advanced.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X, 0); #endif // !XB1 m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; m_worldGeneratorButton.Position = advanced.Position - new Vector2(advanced.Size.X + MyGuiConstants.GENERIC_BUTTON_SPACING.X, -0.06f); if (MyFakes.XB1_PREVIEW) { var pos2p = m_worldGeneratorButton.Position; pos2p.X = Size.HasValue ? Size.Value.X / 2.0f - m_worldGeneratorButton.Size.X - MARGIN_RIGHT : 0.0f; m_worldGeneratorButton.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; m_worldGeneratorButton.Position = pos2p; advanced.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; if (m_isNewGame) { advanced.Position = m_worldGeneratorButton.Position - new Vector2(m_worldGeneratorButton.Size.X + 0.017f, 0); } else { advanced.Position = m_worldGeneratorButton.Position - new Vector2(m_worldGeneratorButton.Size.X + 0.017f, 0.008f); } } Controls.Add(m_okButton); Controls.Add(m_cancelButton); CloseButtonEnabled = true; }
/// <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); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_elemtents = new MyGuiControlElementGroup(); m_elemtents.HighlightChanged += OnHighlightChange; if (!m_pauseGame) { if (MyGuiScreenGamePlay.Static == null) { MyGuiControlButton button = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonContinueGame)) { button = (MyGuiControlButton)c; } } } if (button != null) { int index = Controls.IndexOf(button); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonContinueGame, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button.Tooltips); } MyGuiControlButton button2 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonCampaign)) { button2 = (MyGuiControlButton)c; } } } if (button2 != null) { int index = Controls.IndexOf(button2); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button2.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button2.Tooltips); } MyGuiControlButton button3 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonLoadGame)) { button3 = (MyGuiControlButton)c; } } } if (button3 != null) { int index = Controls.IndexOf(button3); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button3.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button3.Tooltips); } MyGuiControlButton button4 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonJoinGame)) { button4 = (MyGuiControlButton)c; } } } if (button4 != null) { int index = Controls.IndexOf(button4); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button4.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button4.Tooltips); } MyGuiControlButton button5 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonOptions)) { button5 = (MyGuiControlButton)c; } } } if (button5 != null) { int index = Controls.IndexOf(button5); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button5.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button5.Tooltips); } MyGuiControlButton button6 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonInventory)) { button6 = (MyGuiControlButton)c; } } } if (button6 != null) { int index = Controls.IndexOf(button6); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button6.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button6.Tooltips); } MyGuiControlButton button7 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonExitToWindows)) { button7 = (MyGuiControlButton)c; } } } if (button7 != null) { int index = Controls.IndexOf(button7); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button7.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button7.Tooltips); } } } if (m_pauseGame) { MyGuiControlButton button8 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonSave)) { button8 = (MyGuiControlButton)c; } } } if (button8 != null) { int index = Controls.IndexOf(button8); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonContinueGame, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button8.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button8.Tooltips); } MyGuiControlButton button9 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.LoadScreenButtonSaveAs)) { button9 = (MyGuiControlButton)c; } } } if (button9 != null) { int index = Controls.IndexOf(button9); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button9.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button9.Tooltips); } MyGuiControlButton button10 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonPlayers)) { button10 = (MyGuiControlButton)c; } } } if (button10 != null) { int index = Controls.IndexOf(button10); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button10.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button10.Tooltips); } MyGuiControlButton button11 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonOptions)) { button11 = (MyGuiControlButton)c; } } } if (button11 != null) { int index = Controls.IndexOf(button11); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button11.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button11.Tooltips); } MyGuiControlButton button12 = null; foreach (var c in Controls) { if (c is MyGuiControlButton) { m_elemtents.Add(c); if (((MyGuiControlButton)c).Text == MyTexts.GetString(MyCommonTexts.ScreenMenuButtonExitToMainMenu)) { button12 = (MyGuiControlButton)c; } } } if (button12 != null) { int index = Controls.IndexOf(button12); MyGuiControlButton newGameButton = MakeButton(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, -1000, -1000), MyCommonTexts.ScreenMenuButtonCampaign, NullButtonAction); Controls.Add(newGameButton); m_elemtents.Add(newGameButton); newGameButton.Name = button12.Name; Controls[index] = newGameButton; newGameButton.SetToolTip(button12.Tooltips); } } m_elementGroup = new MyGuiControlElementGroup(); Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui; Vector2 leftButtonPositionOrigin = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) + new Vector2(minSizeGui.X / 2f, 0f) + new Vector2(15f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE; leftButtonPositionOrigin.Y += 0.043f; _ = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM) + new Vector2((0f - minSizeGui.X) / 2f, 0f); Vector2 lastButtonPosition = Vector2.Zero; if (MyGuiScreenGamePlay.Static == null) { CreateMainMenu(); } else { CreateInGameMenu(); } //Draws the controllor hints under the buttons. MyGuiControlLabel myGuiControlLabel = new MyGuiControlLabel(MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, 49, 82)); myGuiControlLabel.Name = MyGuiScreenBase.GAMEPAD_HELP_LABEL_NAME; Controls.Add(myGuiControlLabel); //Refreshes the badges under the game logo. m_myBadgeHelper.RefreshGameLogo(); CheckLowMemSwitchToLow(); if (MyGuiScreenGamePlay.Static == null && !MyPlatformGameSettings.FEEDBACK_ON_EXIT && !string.IsNullOrEmpty(MyPlatformGameSettings.FEEDBACK_URL)) { MyGuiSandbox.OpenUrl(MyPlatformGameSettings.FEEDBACK_URL, UrlOpenMode.ExternalWithConfirm, MyTexts.Get(MyCommonTexts.MessageBoxTextBetaFeedback), MyTexts.Get(MyCommonTexts.MessageBoxCaptionBetaFeedback)); } }
/// <summary> /// Builds the menu to spawn planets /// </summary> /// <param name="table">Tablet to add editing elements to</param> private void CreatePlanetSpawnMenu(MyGuiControlParentTableLayout table) { var settings = MySettingsSession.Static.Settings.GeneratorSettings; MyGuiControlLabel defLabel = new MyGuiControlLabel(null, null, "Planet"); table.AddTableRow(defLabel); m_planetDefList = new MyGuiControlListbox(); m_planetDefList.VisibleRowsCount = 8; m_planetDefList.MultiSelect = false; table.AddTableRow(m_planetDefList); table.AddTableSeparator(); MyGuiControlLabel sizeLabel = new MyGuiControlLabel(null, null, "Planet size"); table.AddTableRow(sizeLabel); m_planetSizeSlider = new MyGuiControlClickableSlider(null, 1f, settings.PlanetSettings.PlanetSizeCap, m_usableWidth - 0.1f, intValue: true, showLabel: true, labelSuffix: " m"); m_planetSizeSlider.DefaultValue = Math.Min(120000, settings.PlanetSettings.PlanetSizeCap); m_planetSizeSlider.Value = m_planetSizeSlider.DefaultValue.Value; m_planetSizeSlider.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_DIAM); table.AddTableRow(m_planetSizeSlider); table.AddTableSeparator(); MyGuiControlLabel nameLabel = new MyGuiControlLabel(null, null, "Name"); table.AddTableRow(nameLabel); m_nameBox = new MyGuiControlTextbox(); m_nameBox.Size = new Vector2(m_usableWidth, m_nameBox.Size.Y); m_nameBox.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_NAME); table.AddTableRow(m_nameBox); table.AddTableSeparator(); m_spawnPlanetButton = MyPluginGuiHelper.CreateDebugButton(m_usableWidth, "Spawn planet", delegate(MyGuiControlButton button) { OnSpawnPlanet(); }); m_spawnPlanetButton.Enabled = false; m_spawnPlanetButton.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SPAWN); table.AddTableRow(m_spawnPlanetButton); m_spawnPlanetCoordsButton = MyPluginGuiHelper.CreateDebugButton(m_usableWidth, "Spawn planet at coordinates", delegate(MyGuiControlButton button) { OnSpawnPlanet(true); }); m_spawnPlanetCoordsButton.Enabled = false; m_spawnPlanetCoordsButton.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_PLANET_SPAWN_COORD); table.AddTableRow(m_spawnPlanetCoordsButton); m_planetDefList.ItemClicked += delegate(MyGuiControlListbox box) { if (box.SelectedItems[box.SelectedItems.Count - 1] != null) { m_spawnPlanetButton.Enabled = true; m_spawnPlanetCoordsButton.Enabled = true; } else { m_spawnPlanetButton.Enabled = false; m_spawnPlanetCoordsButton.Enabled = false; } }; LoadPlanetDefs(m_planetDefList); }