internal void Close() { foreach (var grid in m_infoGrids) { grid.OnAuthorshipChanged -= grid_OnAuthorshipChanged; } if (m_grid == null) return; if (m_infoPage == null) return; var convertBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertBtn"); if (convertBtn != null) convertBtn.ButtonClicked -= convertBtn_ButtonClicked; var convertToStationBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertToStationBtn"); if (convertToStationBtn != null) convertToStationBtn.ButtonClicked -= convertToStationBtn_ButtonClicked; m_grid.OnBlockAdded -= grid_OnBlockAdded; m_grid.OnBlockRemoved -= grid_OnBlockRemoved; m_grid.OnPhysicsChanged -= grid_OnPhysicsChanged; m_grid.OnBlockOwnershipChanged -= grid_OnBlockOwnershipChanged; m_grid = null; m_infoPage = null; }
internal void Init(Graphics.GUI.MyGuiControlTabPage infoPage, MyCubeGrid grid) { m_grid = grid; m_infoPage = infoPage; Debug.Assert(m_infoPage != null); RecreateControls(); if (grid == null) return; grid.OnBlockAdded += grid_OnBlockAdded; grid.OnBlockRemoved += grid_OnBlockRemoved; grid.OnPhysicsChanged += grid_OnPhysicsChanged; grid.OnBlockOwnershipChanged += grid_OnBlockOwnershipChanged; if (MyFakes.ENABLE_TERMINAL_PROPERTIES) { var renameShipBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("RenameShipButton"); if (renameShipBtn != null) renameShipBtn.ButtonClicked += renameBtn_ButtonClicked; } var convertBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertBtn"); if (convertBtn != null) { convertBtn.ButtonClicked += convertBtn_ButtonClicked; } }
void InitLobbyPage() { InitLobbyTable(); m_joinButton.ButtonClicked += OnJoinLobby; m_refreshButton.ButtonClicked += OnRefreshLobbiesClick; m_showOnlyCompatibleGames.IsCheckedChanged = OnShowCompatibleCheckChanged; m_showOnlyWithSameMods.IsCheckedChanged = OnShowCompatibleCheckChanged; m_showOnlyFriends.IsCheckedChanged += OnShowOnlyFriendsCheckChanged; m_searchChangedFunc += LoadPublicLobbies; m_lobbyPage = m_selectedPage; m_lobbyPage.SetToolTip(MyTexts.GetString(MyCommonTexts.JoinGame_TabTooltip_Lobbies)); LoadPublicLobbies(); }
public MyGuiControlTabPage GetTabSubControl(int key) { if (!m_pages.ContainsKey(key)) { m_pages[key] = new MyGuiControlTabPage( position: TabPosition, size: TabSize, color: ColorMask, pageKey: key) { Visible = false, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; Controls.Add(m_pages[key]); } return(m_pages[key]); }
void InitHistoryPage() { InitServersTable(); m_joinButton.ButtonClicked += OnJoinServer; m_refreshButton.ButtonClicked += OnRefreshHistoryServersClick; m_showOnlyCompatibleGames.IsCheckedChanged = OnHistoryCheckboxCheckChanged; m_showOnlyWithSameMods.IsCheckedChanged = OnHistoryCheckboxCheckChanged; m_allowedGroups.IsCheckedChanged = OnHistoryCheckboxCheckChanged; m_searchChangedFunc += RefreshHistoryGameList; m_historyPage = m_selectedPage; m_historyPage.SetToolTip(MyTexts.GetString(MyCommonTexts.JoinGame_TabTooltip_History)); RefreshHistoryGameList(); }
void InitServersPage() { InitServersTable(); m_joinButton.ButtonClicked += OnJoinServer; m_refreshButton.ButtonClicked += OnRefreshServersClick; m_showOnlyCompatibleGames.IsCheckedChanged = OnServerCheckboxCheckChanged; m_showOnlyWithSameMods.IsCheckedChanged = OnServerCheckboxCheckChanged; m_showOnlyFriends.IsCheckedChanged = OnServerCheckboxCheckChanged; m_allowedGroups.IsCheckedChanged = OnServerCheckboxCheckChanged; m_searchChangedFunc += RefreshServerGameList; m_serversPage = m_selectedPage; m_serversPage.SetToolTip(MyTexts.GetString(MySpaceTexts.JoinGame_TabTooltip_Servers)); RefreshServerGameList(); }
private void CreateChatPageControls(MyGuiControlTabPage chatPage) { chatPage.Name = "PageComms"; chatPage.TextEnum = MySpaceTexts.TerminalTab_Chat; float left = -0.4625f; float right = -left; float top = -0.34f; int rowCount = 11; float width = 0.35f; //defined based on row count float height = 0; float margin = 0.02f; var playerLabel = new MyGuiControlLabel() { Position = new Vector2(left, top), Name = "PlayerLabel", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = MyTexts.GetString(MyCommonTexts.ScreenCaptionPlayers) }; chatPage.Controls.Add(playerLabel); top += playerLabel.GetTextSize().Y + 0.01f; var playerList = new MyGuiControlListbox() { Position = new Vector2(left, top), Size = new Vector2(width, 0f), Name = "PlayerListbox", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, VisibleRowsCount = rowCount }; chatPage.Controls.Add(playerList); height = playerList.ItemSize.Y * rowCount; top += height + margin; rowCount = 4; var factionLabel = new MyGuiControlLabel() { Position = new Vector2(left, top), Name = "PlayerLabel", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = MyTexts.GetString(MyCommonTexts.Factions) }; chatPage.Controls.Add(factionLabel); top += playerLabel.GetTextSize().Y + 0.01f; var factionsList = new MyGuiControlListbox() { Position = new Vector2(left, top), Size = new Vector2(width, 0f), Name = "FactionListbox", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, VisibleRowsCount = rowCount }; chatPage.Controls.Add(factionsList); top = -0.34f; width = 0.6f; height = 0.515f; margin = 0.038f; var chatboxPanel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Position = new Vector2(right, top), Size = new Vector2(width, height), BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_NEUTRAL, }; chatPage.Controls.Add(chatboxPanel); var chatHistory = new MyGuiControlMultilineText( position: new Vector2(right, top + 0.005f), size: new Vector2(width - 0.01f, height - 0.01f), backgroundColor: null, font: MyFontEnum.Blue, textScale: 0.95f, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, contents: null); chatHistory.Name = "ChatHistory"; chatHistory.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP; chatHistory.TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; chatPage.Controls.Add(chatHistory); top += height + margin; height = 0.05f; var chatbox = new MyGuiControlTextbox() { Position = new Vector2(right, top), Size = new Vector2(width, height), Name = "Chatbox", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER }; chatPage.Controls.Add(chatbox); width = 0.75f; top += height + margin; height = 0.05f; var sendButton = new MyGuiControlButton() { Position = new Vector2(right, top), Text = "Send", Name = "SendButton", Size = new Vector2(width, height), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, }; chatPage.Controls.Add(sendButton); }
private void CreateFactionsPageControls(MyGuiControlTabPage page) { page.Name = "PageFactions"; page.TextEnum = MySpaceTexts.TerminalTab_Factions; var left = -0.462f; var top = -0.34f; var spacingH = 0.0045f; var spacingV = 0.01f; var buttonSize = new Vector2(0.29f, 0.052f); var smallerBtn = new Vector2(0.13f, 0.04f); var factionsComposite = new MyGuiControlCompositePanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(0.4f, 0.69f), Name = "Factions" }; left += spacingH; top += spacingV; var factionsPanel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(factionsComposite.Size.X - 0.01f, 0.035f), BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK }; var factionsLabel = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + spacingH, top), size: factionsPanel.Size - new Vector2(0.01f, 0.01f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions) ); top += factionsLabel.Size.Y + spacingV; var factionsTable = new MyGuiControlTable() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(factionsPanel.Size.X, 0.15f), Name = "FactionsTable", ColumnsCount = 3, VisibleRowsCount = 14, }; factionsTable.SetCustomColumnWidths(new float[] { 0.16f, 0.75f, 0.09f }); factionsTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Tag)); factionsTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Name)); top += factionsTable.Size.Y + spacingV; var createBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top)) { Name = "buttonCreate" }; var joinBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonJoin" }; var joinCancelBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonCancelJoin" }; var leaveBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonLeave" }; var sendPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonSendPeace" }; var cancelPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonCancelPeace" }; var acceptPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonAcceptPeace" }; var enemyBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top + buttonSize.Y + spacingV)) { Name = "buttonEnemy" }; page.Controls.Add(factionsComposite); page.Controls.Add(factionsPanel); page.Controls.Add(factionsLabel); page.Controls.Add(factionsTable); page.Controls.Add(createBtn); page.Controls.Add(joinBtn); page.Controls.Add(joinCancelBtn); page.Controls.Add(leaveBtn); page.Controls.Add(sendPeaceBtn); page.Controls.Add(cancelPeaceBtn); page.Controls.Add(acceptPeaceBtn); page.Controls.Add(enemyBtn); // Do the right side // reset left / top left = -0.0475f; top = -0.34f; var factionComposite = new MyGuiControlCompositePanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(-0.05f, top), Size = new Vector2(0.5f, 0.69f), Name = "compositeFaction" }; left += spacingH; top += spacingV; var factionNamePanel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(factionComposite.Size.X - 0.012f, 0.035f), BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK, Name = "panelFactionName" }; var factionName = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + spacingH, top), size: factionNamePanel.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionName" }; top += factionsLabel.Size.Y + (2f * spacingV); var size = factionNamePanel.Size - new Vector2(0.14f, 0.01f); var factionDescLabel = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top), size: factionNamePanel.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionDesc" }; top += factionDescLabel.Size.Y + spacingV; var factionDesc = new MyGuiControlMultilineText( textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE, position: new Vector2(left, top), size: new Vector2(size.X, 0.08f) ) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Name = "textFactionDesc", }; top += factionDesc.Size.Y + 2f * spacingV; var factionPrivateLabel = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top), size: factionNamePanel.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionPrivate" }; top += factionPrivateLabel.Size.Y + spacingV; var factionPrivate = new MyGuiControlMultilineText( textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE, position: new Vector2(left, top), size: new Vector2(size.X, 0.08f) ) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Name = "textFactionPrivate", }; top += factionDesc.Size.Y + 0.0275f; var labelFactionMembers = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top), size: factionNamePanel.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionMembers" }; var checkAcceptEveryone = new MyGuiControlCheckbox( originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, position: new Vector2(factionNamePanel.Position.X + factionNamePanel.Size.X, top + spacingV) ) { Name = "checkFactionMembersAcceptEveryone" }; var labelAcceptEveryone = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(checkAcceptEveryone.Position.X - checkAcceptEveryone.Size.X - spacingH, top), size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionMembersAcceptEveryone" }; var labelAcceptPeace = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2((17 * spacingH), top), size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelFactionMembersAcceptPeace" }; var checkAcceptPeace = new MyGuiControlCheckbox( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2((47 * spacingH), top + spacingV) ) { Name = "checkFactionMembersAcceptPeace" }; top += factionPrivateLabel.Size.Y + spacingV; var membersTable = new MyGuiControlTable() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(size.X, 0.15f), Name = "tableMembers", ColumnsCount = 2, VisibleRowsCount = 8, HeaderVisible = false }; membersTable.SetCustomColumnWidths(new float[] { 0.7f, 0.3f }); membersTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Name)); membersTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Status)); var btnSpacing = smallerBtn.Y + spacingV; var editBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, factionDesc.Position.Y)) { Name = "buttonEdit" }; var promBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y)) { Name = "buttonPromote" }; var kickBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + btnSpacing)) { Name = "buttonKick" }; var acceptJoin = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptJoin" }; var demote = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 3f * btnSpacing)) { Name = "buttonDemote" }; //var acceptPeace = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptPeace" }; var addNpcToFaction = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 4f * btnSpacing)) { Name = "buttonAddNpc" }; page.Controls.Add(factionComposite); page.Controls.Add(factionNamePanel); page.Controls.Add(factionName); page.Controls.Add(factionDescLabel); page.Controls.Add(factionDesc); page.Controls.Add(factionPrivateLabel); page.Controls.Add(factionPrivate); page.Controls.Add(labelFactionMembers); page.Controls.Add(labelAcceptEveryone); page.Controls.Add(labelAcceptPeace); page.Controls.Add(checkAcceptEveryone); page.Controls.Add(checkAcceptPeace); page.Controls.Add(membersTable); page.Controls.Add(editBtn); page.Controls.Add(promBtn); page.Controls.Add(kickBtn); page.Controls.Add(demote); page.Controls.Add(acceptJoin); page.Controls.Add(addNpcToFaction); }
void InitPageControls(MyGuiControlTabPage page) { page.Controls.Clear(); var origin = new Vector2(-0.64f, -0.35f); Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui; m_gamesTable = new MyGuiControlTable(); m_gamesTable.Position = origin + new Vector2(buttonSize.X, 0f); m_gamesTable.Size = new Vector2(1465f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f); m_gamesTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_gamesTable.VisibleRowsCount = 16; page.Controls.Add(m_gamesTable); Vector2 buttonOrigin = origin + new Vector2(0.28f, 0.66f); Vector2 buttonDelta = new Vector2(0.2f, 0.0f); int numControls = 0; page.Controls.Add(m_joinButton = MakeButton(buttonOrigin + buttonDelta * numControls++, MySpaceTexts.ScreenMenuButtonJoinWorld, MySpaceTexts.ScreenMenuButtonJoinWorld, null)); page.Controls.Add(m_refreshButton = MakeButton(buttonOrigin + buttonDelta * numControls++, MySpaceTexts.ScreenLoadSubscribedWorldRefresh, MySpaceTexts.ScreenLoadSubscribedWorldRefresh, null)); m_joinButton.Enabled = false; var checkboxPos = buttonOrigin + new Vector2(-0.09f, -0.02f) + numControls * buttonDelta; var checkBoxDelta = new Vector2(0.0f, 0.04f); var blockSearchLabel = new MyGuiControlLabel() { Position = checkboxPos + new Vector2(0f, -0.04f), Size = new Vector2(0.05f, 0.02f), TextEnum = MySpaceTexts.JoinGame_SearchLabel }; page.Controls.Add(blockSearchLabel); m_blockSearch = new MyGuiControlTextbox() { Position = blockSearchLabel.Position + new Vector2(0.255f, 0f), Size = new Vector2(0.27f, 0.02f) }; m_blockSearch.SetToolTip(MySpaceTexts.JoinGame_SearchTooltip); m_blockSearch.TextChanged += OnBlockSearchTextChanged; page.Controls.Add(m_blockSearch); m_blockSearchClear = new MyGuiControlButton() { Position = m_blockSearch.Position + new Vector2(0.13f, 0f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; m_blockSearchClear.ButtonClicked += BlockSearchClear_ButtonClicked; page.Controls.Add(m_blockSearchClear); numControls = 0; m_showOnlyCompatibleText = new MyGuiControlButton( position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0), text: MyTexts.Get(MySpaceTexts.MultiplayerCompatibleVersions), toolTip: MyTexts.GetString(MySpaceTexts.MultiplayerCompatibleVersions), onButtonClick: OnShowOnlyCompatibleTextClick, visualStyle: MyGuiControlButtonStyleEnum.ClickableText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); page.Controls.Add(m_showOnlyCompatibleText); bool compatibleChecked = true; if (m_showOnlyCompatibleGames != null) compatibleChecked = m_showOnlyCompatibleGames.IsChecked; m_showOnlyCompatibleGames = new MyGuiControlCheckbox(checkboxPos + checkBoxDelta * numControls++, null, null, MySandboxGame.Config.MultiplayerShowCompatible, MyGuiControlCheckboxStyleEnum.Debug, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_showOnlyCompatibleGames.IsChecked = compatibleChecked; page.Controls.Add(m_showOnlyCompatibleGames); bool showSameMods = true; if (m_showOnlyWithSameMods != null) showSameMods = m_showOnlyWithSameMods.IsChecked; m_showOnlyWithSameMods = new MyGuiControlCheckbox( position: checkboxPos + checkBoxDelta * numControls, visualStyle: MyGuiControlCheckboxStyleEnum.Debug, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_showOnlyWithSameMods.IsChecked = showSameMods; page.Controls.Add(m_showOnlyWithSameMods); m_showOnlyWithSameText = new MyGuiControlButton( position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0), text: MyTexts.Get(MySpaceTexts.MultiplayerJoinSameGameData), toolTip: MyTexts.GetString(MySpaceTexts.MultiplayerJoinSameGameData), onButtonClick: OnShowOnlySameModsClick, visualStyle: MyGuiControlButtonStyleEnum.ClickableText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); page.Controls.Add(m_showOnlyWithSameText); checkboxPos = buttonOrigin + new Vector2(-0.09f, -0.02f) + 3 * buttonDelta; numControls = 0; bool showOnlyFriends = false; if (m_showOnlyFriends != null) showOnlyFriends = m_showOnlyFriends.IsChecked; m_showOnlyFriends = new MyGuiControlCheckbox( position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0), visualStyle: MyGuiControlCheckboxStyleEnum.Debug, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_showOnlyFriends.IsChecked = showOnlyFriends; page.Controls.Add(m_showOnlyFriends); m_showOnlyFriendsText = new MyGuiControlButton( position: checkboxPos + checkBoxDelta * numControls++ + new Vector2(buttonSize.Y, 0), text: MyTexts.Get(MySpaceTexts.MultiplayerJoinFriendsGames), toolTip: MyTexts.GetString(MySpaceTexts.MultiplayerJoinFriendsGames), onButtonClick: OnFriendsOnlyTextClick, visualStyle: MyGuiControlButtonStyleEnum.ClickableText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); page.Controls.Add(m_showOnlyFriendsText); bool allowedGroups = true; if (m_allowedGroups != null) allowedGroups = m_allowedGroups.IsChecked; m_allowedGroups = new MyGuiControlCheckbox( position: checkboxPos + checkBoxDelta * numControls + new Vector2(buttonSize.Y * 0.5f, 0), visualStyle: MyGuiControlCheckboxStyleEnum.Debug, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_allowedGroups.IsChecked = allowedGroups; page.Controls.Add(m_allowedGroups); m_allowedGroupsText = new MyGuiControlButton( position: checkboxPos + checkBoxDelta * numControls++ + new Vector2(buttonSize.Y, 0), text: MyTexts.Get(MySpaceTexts.MultiplayerJoinAllowedGroups), toolTip: MyTexts.GetString(MySpaceTexts.MultiplayerJoinAllowedGroups), onButtonClick: OnAllowedGroupsTextClick, visualStyle: MyGuiControlButtonStyleEnum.ClickableText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); page.Controls.Add(m_allowedGroupsText); }
private void CreateInventoryPageControls(MyGuiControlTabPage page) { page.Name = "PageInventory"; page.TextEnum = MySpaceTexts.Inventory; page.TextScale = 0.9f; #region Left radio buttons var leftRadioCharacter = new MyGuiControlRadioButton() { Position = new Vector2(-0.465f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "LeftSuitButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterCharacter }; var leftRadioGrid = new MyGuiControlRadioButton() { Position = new Vector2(-0.405f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "LeftGridButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterGrid }; var leftRadioStorage = new MyGuiControlRadioButton() { Position = new Vector2(-0.175f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterStorageButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterStorage }; var leftRadioSystem = new MyGuiControlRadioButton() { Position = new Vector2(-0.125f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterSystemButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterSystem }; var leftRadioEnergy = new MyGuiControlRadioButton() { Position = new Vector2(-0.075f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterEnergyButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterEnergy }; var leftRadioAll = new MyGuiControlRadioButton() { Position = new Vector2(-0.025f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterAllButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterAll }; #endregion #region Left search filters var blockSearchLeft = new MyGuiControlTextbox() { Position = new Vector2(-0.465f, -0.283f), Size = new Vector2(0.288f, 0.052f), Name = "BlockSearchLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER }; var blockSearchClearLeft = new MyGuiControlButton() { Position = new Vector2(-0.2f, -0.283f), Size = new Vector2(0.045f, 0.05666667f), Name = "BlockSearchClearLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; var hideEmptyLeft = new MyGuiControlCheckbox() { Position = new Vector2(-0.025f, -0.283f), Name = "CheckboxHideEmptyLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER }; var hideEmptyLeftLabel = new MyGuiControlLabel() { Position = new Vector2(-0.155f, -0.283f), Name = "LabelHideEmptyLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.HideEmpty }; #endregion var leftList = new MyGuiControlList() { Position = new Vector2(-0.465f, -0.26f), Size = new Vector2(0.44f, 0.616f), Name = "LeftInventory", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; page.Controls.Add(leftRadioCharacter); page.Controls.Add(leftRadioGrid); page.Controls.Add(leftRadioStorage); page.Controls.Add(leftRadioSystem); page.Controls.Add(leftRadioEnergy); page.Controls.Add(leftRadioAll); page.Controls.Add(blockSearchLeft); page.Controls.Add(blockSearchClearLeft); page.Controls.Add(hideEmptyLeft); page.Controls.Add(hideEmptyLeftLabel); page.Controls.Add(leftList); #region Right radio buttons var rightRadioCharacter = new MyGuiControlRadioButton() { Position = new Vector2(0.025f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "RightSuitButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterCharacter }; var rightRadioGrid = new MyGuiControlRadioButton() { Position = new Vector2(0.085f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "RightGridButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterGrid }; var rightRadioStorage = new MyGuiControlRadioButton() { Position = new Vector2(0.315f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterStorageButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterStorage }; var rightRadioSystem = new MyGuiControlRadioButton() { Position = new Vector2(0.365f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterSystemButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterSystem }; var rightRadioEnergy = new MyGuiControlRadioButton() { Position = new Vector2(0.415f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterEnergyButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterEnergy }; var rightRadioAll = new MyGuiControlRadioButton() { Position = new Vector2(0.465f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterAllButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterAll }; #endregion #region Right search filters var blockSearchRight = new MyGuiControlTextbox() { Position = new Vector2(0.025f, -0.283f), Size = new Vector2(0.288f, 0.052f), Name = "BlockSearchRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, }; var blockSearchClearRight = new MyGuiControlButton() { Position = new Vector2(0.29f, -0.283f), Size = new Vector2(0.045f, 0.05666667f), Name = "BlockSearchClearRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; var hideEmptyRight = new MyGuiControlCheckbox() { Position = new Vector2(0.465f, -0.283f), Name = "CheckboxHideEmptyRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER }; var hideEmptyRightLabel = new MyGuiControlLabel() { Position = new Vector2(0.335f, -0.283f), Name = "LabelHideEmptyRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.HideEmpty }; #endregion var rightList = new MyGuiControlList() { Position = new Vector2(0.465f, -0.295f), Size = new Vector2(0.44f, 0.65f), Name = "RightInventory", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP }; page.Controls.Add(rightRadioCharacter); page.Controls.Add(rightRadioGrid); page.Controls.Add(rightRadioStorage); page.Controls.Add(rightRadioSystem); page.Controls.Add(rightRadioEnergy); page.Controls.Add(rightRadioAll); page.Controls.Add(blockSearchRight); page.Controls.Add(blockSearchClearRight); page.Controls.Add(hideEmptyRight); page.Controls.Add(hideEmptyRightLabel); page.Controls.Add(rightList); var trash = new MyGuiControlButton() { Position = new Vector2(0f, 0.355f), Size = new Vector2(0.044375f, 0.13666667f), Name = "ThrowOutButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, TextEnum = MySpaceTexts.Afterburner, TextScale = 0f, TextAlignment = 0f, DrawCrossTextureWhenDisabled = true, VisualStyle = MyGuiControlButtonStyleEnum.InventoryTrash, ActivateOnMouseRelease = true }; page.Controls.Add(trash); }
private void CreateGpsPageControls(MyGuiControlTabPage gpsPage) { gpsPage.Name = "PageIns"; gpsPage.TextEnum = MySpaceTexts.TerminalTab_GPS; gpsPage.TextScale = 0.9f; var spacingH = 0.01f; var spacingV = 0.01f; var buttonSize = new Vector2(0.29f, 0.052f); var smallerBtn = new Vector2(0.13f, 0.04f); var left = -0.4625f; var top = -0.325f; var gpsBlockSearch = new MyGuiControlTextbox() { Position = new Vector2(left,top), Size = new Vector2(0.29f, 0.052f), Name = "SearchIns", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var gpsBlockSearchClear = new MyGuiControlButton() { Position = new Vector2(left+gpsBlockSearch.Size.X, top+0.01f), Size = new Vector2(0.045f, 0.05666667f), Name = "SearchInsClear", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; top += gpsBlockSearch.Size.Y + spacingV; var gpsBlockTable = new MyGuiControlTable() { Position = new Vector2(left,top), Size = new Vector2(0.29f, 0.5f), Name = "TableINS", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, ColumnsCount = 1, VisibleRowsCount = 14, HeaderVisible=false }; gpsBlockTable.SetCustomColumnWidths(new float[1]{1}); top += gpsBlockTable.Size.Y + spacingV; //LEFT SIDE BUTTONS: var gpsButtonAdd = new MyGuiControlButton( position: new Vector2(left,top), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(140f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Add), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "buttonAdd" }; var gpsButtonDelete = new MyGuiControlButton( position: new Vector2(left,top +gpsButtonAdd.Size.Y+spacingV), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(140f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Delete), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "buttonDelete" }; var gpsButtonFromCurrent = new MyGuiControlButton( position: new Vector2(left+gpsButtonAdd.Size.X+spacingH,top), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(310f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_NewFromCurrent), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "buttonFromCurrent" }; var gpsButtonFromClipboard = new MyGuiControlButton( position: new Vector2(left + gpsButtonAdd.Size.X + spacingH, top + gpsButtonAdd.Size.Y + spacingV), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(310f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_NewFromClipboard), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "buttonFromClipboard" }; gpsPage.Controls.Add(gpsBlockSearch); gpsPage.Controls.Add(gpsBlockSearchClear); gpsPage.Controls.Add(gpsBlockTable); gpsPage.Controls.Add(gpsButtonAdd); gpsPage.Controls.Add(gpsButtonDelete); gpsPage.Controls.Add(gpsButtonFromCurrent); gpsPage.Controls.Add(gpsButtonFromClipboard); //RIGHT SIDE: left = -0.15f; top = -0.325f; var gpsComposite = new MyGuiControlCompositePanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(0.6f, 0.39f), Name = "compositeIns" }; left += spacingH; top += spacingV+0.05f; var gpsNameLabel = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top), size: new Vector2(0.4f, 0.035f) ) { Name = "labelInsName", Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Name).ToString() }; var gpsNamePanel = new MyGuiControlTextbox(maxLength:32) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Position = new Vector2(left + spacingH + gpsNameLabel.Size.X, top), Size = new Vector2(gpsComposite.Size.X - spacingH - gpsNameLabel.Size.X - spacingH -0.01f, 0.035f), Name = "panelInsName" }; top += gpsNamePanel.Size.Y + (2f * spacingV); var size = gpsNamePanel.Size - new Vector2(0.14f, 0.01f); var gpsDescLabel = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top), //size: insNamePanel.Size - new Vector2(0.01f, 0.01f) size : new Vector2(gpsComposite.Size.X - 0.012f, 0.035f) ){ Name = "labelInsDesc", Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Description).ToString() }; top += gpsDescLabel.Size.Y + spacingV; var gpsDescText = new MyGuiControlTextbox( position: new Vector2(left, top), maxLength:255 ) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Name = "textInsDesc", Size= new Vector2(gpsComposite.Size.X - 2*spacingH, 0.035f) }; top += gpsDescText.Size.Y + 2f * spacingV; //X,Y,Z: var gpsLabelX = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top), size : new Vector2(0.01f, 0.035f), text : MyTexts.Get(MySpaceTexts.TerminalTab_GPS_X).ToString() ) { Name = "labelInsX", }; left += gpsLabelX.Size.X+spacingH; var gpsXCoord = new MyGuiControlTextbox() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Position = new Vector2(left, top), Size = new Vector2((gpsComposite.Size.X - spacingH )/ 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f), Name = "textInsX" }; left += gpsXCoord.Size.X + spacingH; var gpsLabelY = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top), //size: new Vector2(0.01f, 0.035f), size : new Vector2(gpsComposite.Size.X - 0.012f, 0.035f), text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Y).ToString() //size: new Vector2(0.4f, 0.035f) ) { Name = "labelInsY" }; left += gpsLabelX.Size.X + spacingH; var gpsYCoord = new MyGuiControlTextbox() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Position = new Vector2(left, top), Size = new Vector2((gpsComposite.Size.X - spacingH) / 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f), Name = "textInsY" }; left += gpsYCoord.Size.X + spacingH; var gpsLabelZ = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top), size: new Vector2(0.01f, 0.035f), text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Z).ToString() //size: new Vector2(0.4f, 0.035f) ) { Name = "labelInsZ", }; left += gpsLabelX.Size.X + spacingH; var gpsZCoord = new MyGuiControlTextbox() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Position = new Vector2(left, top), Size = new Vector2((gpsComposite.Size.X - spacingH) / 3 - 2 * spacingH - gpsLabelX.Size.X, 0.035f), Name = "textInsZ" }; top += gpsNamePanel.Size.Y + (2f * spacingV); //BUTTONS: left = spacingH-0.15f; //SHOW ON HUD & COPY TO CLIPBOARD: var checkGpsShowOnHud = new MyGuiControlCheckbox( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top) ) { Name = "checkInsShowOnHud" }; var labelGpsShowOnHud = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left+ checkGpsShowOnHud.Size.X + spacingH, top), size: checkGpsShowOnHud.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelInsShowOnHud", Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_ShowOnHud).ToString() }; var toClipboardButton = new MyGuiControlButton( position: new Vector2(gpsComposite.Position.X+gpsComposite.Size.X-spacingH, top), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(300f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_CopyToClipboard), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER) { Name = "buttonToClipboard" }; top += toClipboardButton.Size.Y * 1.1f; var checkGpsAlwaysVisible = new MyGuiControlCheckbox( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left, top) ) { Name = "checkInsAlwaysVisible", }; checkGpsAlwaysVisible.SetToolTip(MySpaceTexts.TerminalTab_GPS_AlwaysVisible_Tooltip); var labelGpsAlwaysVisible = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left + checkGpsShowOnHud.Size.X + spacingH, top), size: checkGpsShowOnHud.Size - new Vector2(0.01f, 0.01f) ) { Name = "labelInsAlwaysVisible", Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_AlwaysVisible).ToString() }; labelGpsAlwaysVisible.SetToolTip(MySpaceTexts.TerminalTab_GPS_AlwaysVisible_Tooltip); top += checkGpsShowOnHud.Size.Y; var labelIllegalDataWarning = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, position: new Vector2(left + spacingH, top), size: new Vector2(gpsComposite.Size.X - 0.012f, 0.035f) ) { Name = "TerminalTab_GPS_SaveWarning", Text = MyTexts.Get(MySpaceTexts.TerminalTab_GPS_SaveWarning).ToString(), ColorMask = Color.Red.ToVector4() }; gpsPage.Controls.Add(gpsComposite); gpsPage.Controls.Add(gpsNamePanel); gpsPage.Controls.Add(gpsNameLabel); gpsPage.Controls.Add(gpsDescLabel); gpsPage.Controls.Add(gpsDescText); gpsPage.Controls.Add(gpsLabelX); gpsPage.Controls.Add(gpsXCoord); gpsPage.Controls.Add(gpsLabelY); gpsPage.Controls.Add(gpsYCoord); gpsPage.Controls.Add(gpsLabelZ); gpsPage.Controls.Add(gpsZCoord); gpsPage.Controls.Add(toClipboardButton); gpsPage.Controls.Add(checkGpsShowOnHud); gpsPage.Controls.Add(labelGpsShowOnHud); gpsPage.Controls.Add(labelIllegalDataWarning); gpsPage.Controls.Add(checkGpsAlwaysVisible); gpsPage.Controls.Add(labelGpsAlwaysVisible); }
private void CreateProductionPageControls(MyGuiControlTabPage productionPage) { productionPage.Name = "PageProduction"; productionPage.TextEnum = MySpaceTexts.TerminalTab_Production; float columnSpacing = 0.03f; float controlSpacing = 0.01f; float smallBackgroundPanelHeight = 0.05f; float largeBackgroundPanelHeight = 0.08f; var assemblersCombobox = new MyGuiControlCombobox( position: -0.5f * productionPage.Size + new Vector2(0f, controlSpacing)) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Name = "AssemblersCombobox" }; var blueprintsBackgroundPanel = new MyGuiControlPanel( position: assemblersCombobox.Position + new Vector2(0f, assemblersCombobox.Size.Y + controlSpacing), size: new Vector2(1f, largeBackgroundPanelHeight), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, Name = "BlueprintsBackgroundPanel", }; var blueprintsLabel = new MyGuiControlLabel( position: blueprintsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Blueprints), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "BlueprintsLabel" }; var blueprintsGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = MyTerminalProductionController.BLUEPRINT_GRID_ROWS, ColumnsCount = 4, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var blueprintsScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: blueprintsGrid) { Name = "BlueprintsScrollableArea", ScrollbarVEnabled = true, Position = blueprintsBackgroundPanel.Position + new Vector2(0f, blueprintsBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, Size = new Vector2(blueprintsBackgroundPanel.Size.X, 0.5f), ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; blueprintsScrollableArea.FitSizeToScrolledControl(); assemblersCombobox.Size = new Vector2(blueprintsScrollableArea.Size.X, assemblersCombobox.Size.Y); blueprintsBackgroundPanel.Size = new Vector2(blueprintsScrollableArea.Size.X, largeBackgroundPanelHeight); blueprintsGrid.RowsCount = 20; productionPage.Controls.Add(assemblersCombobox); productionPage.Controls.Add(blueprintsBackgroundPanel); productionPage.Controls.Add(blueprintsLabel); productionPage.Controls.Add(blueprintsScrollableArea); var materialsBackgroundPanel = new MyGuiControlPanel( position: blueprintsBackgroundPanel.Position + new Vector2(blueprintsBackgroundPanel.Size.X + columnSpacing, 0f), size: new Vector2(blueprintsBackgroundPanel.Size.X, smallBackgroundPanelHeight), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK }; var materialsLabel = new MyGuiControlLabel( position: materialsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_StoredMaterials), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var materialsList = new MyGuiControlComponentList() { Position = materialsBackgroundPanel.Position + new Vector2(0f, materialsBackgroundPanel.Size.Y), Size = new Vector2(materialsBackgroundPanel.Size.X, blueprintsBackgroundPanel.Size.Y + blueprintsScrollableArea.Size.Y - materialsBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_NEUTRAL, Name = "MaterialsList", }; productionPage.Controls.Add(materialsBackgroundPanel); productionPage.Controls.Add(materialsLabel); productionPage.Controls.Add(materialsList); var assemblingButton = new MyGuiControlRadioButton( position: materialsBackgroundPanel.Position + new Vector2(materialsBackgroundPanel.Size.X + columnSpacing, 0f), size: new Vector2(200f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_COMPONENT, IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_AssemblingButton), Name = "AssemblingButton", }; assemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_AssemblingMode); var disassemblingButton = new MyGuiControlRadioButton( position: assemblingButton.Position + new Vector2(assemblingButton.Size.X + controlSpacing, 0f), size: new Vector2(238f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_DISASSEMBLY, IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassemblingButton), Name = "DisassemblingButton", }; disassemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_DisassemblingMode); var queueBackgroundPanel = new MyGuiControlCompositePanel() { Position = assemblingButton.Position + new Vector2(0f, assemblingButton.Size.Y + controlSpacing), Size = new Vector2(0.4f, largeBackgroundPanelHeight), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; var queueLabel = new MyGuiControlLabel( position: queueBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_ProductionQueue), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var queueGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = 2, ColumnsCount = 6, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var queueScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: queueGrid) { Name = "QueueScrollableArea", ScrollbarVEnabled = true, Position = queueBackgroundPanel.Position + new Vector2(0f, queueBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; queueScrollableArea.FitSizeToScrolledControl(); queueGrid.RowsCount = 10; queueBackgroundPanel.Size = new Vector2(queueScrollableArea.Size.X, queueBackgroundPanel.Size.Y); var repeatCheckbox = new MyGuiControlCheckbox( position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - controlSpacing, controlSpacing), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_RepeatMode), visualStyle: MyGuiControlCheckboxStyleEnum.Repeat) { Name = "RepeatCheckbox", }; var slaveCheckbox = new MyGuiControlCheckbox( position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - 0.1f - controlSpacing, controlSpacing), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_SlaveMode), visualStyle: MyGuiControlCheckboxStyleEnum.Slave) { Name = "SlaveCheckbox", }; var inventoryBackgroundPanel = new MyGuiControlCompositePanel() { Position = queueScrollableArea.Position + new Vector2(0f, queueScrollableArea.Size.Y + controlSpacing), Size = new Vector2(0.4f, largeBackgroundPanelHeight), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; var inventoryLabel = new MyGuiControlLabel( position: inventoryBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Inventory), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var inventoryGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = 3, ColumnsCount = 6, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var inventoryScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: inventoryGrid) { Name = "InventoryScrollableArea", ScrollbarVEnabled = true, Position = inventoryBackgroundPanel.Position + new Vector2(0f, inventoryBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; inventoryScrollableArea.FitSizeToScrolledControl(); inventoryGrid.RowsCount = 10; inventoryBackgroundPanel.Size = new Vector2(inventoryScrollableArea.Size.X, inventoryBackgroundPanel.Size.Y); var disassembleAllButton = new MyGuiControlButton( position: inventoryBackgroundPanel.Position + new Vector2(inventoryBackgroundPanel.Size.X - controlSpacing, controlSpacing), size: new Vector2(220f, 40f) / MyGuiConstants.GUI_OPTIMAL_SIZE, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassembleAllButton), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_DisassembleAll)) { Name = "DisassembleAllButton", }; var inventoryButton = new MyGuiControlButton( position: inventoryScrollableArea.Position + new Vector2(0f, inventoryScrollableArea.Size.Y + controlSpacing), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(214f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_InventoryButton)) { Name = "InventoryButton", }; var controlPanelButton = new MyGuiControlButton( position: inventoryButton.Position + new Vector2(inventoryButton.Size.X + controlSpacing, 0f), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: inventoryButton.Size, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_ControlPanelButton)) { Name = "ControlPanelButton", }; productionPage.Controls.Add(assemblingButton); productionPage.Controls.Add(disassemblingButton); productionPage.Controls.Add(queueBackgroundPanel); productionPage.Controls.Add(queueLabel); productionPage.Controls.Add(repeatCheckbox); productionPage.Controls.Add(slaveCheckbox); productionPage.Controls.Add(queueScrollableArea); productionPage.Controls.Add(inventoryBackgroundPanel); productionPage.Controls.Add(inventoryLabel); productionPage.Controls.Add(disassembleAllButton); productionPage.Controls.Add(inventoryScrollableArea); productionPage.Controls.Add(inventoryButton); productionPage.Controls.Add(controlPanelButton); }
private static void CreateAntennaSlider(MyGuiControlTabPage infoPage,string labelText,string name,float startY) { var friendAntennaRangeLabel = new MyGuiControlLabel(new Vector2(0.15f, startY), text: labelText); friendAntennaRangeLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(friendAntennaRangeLabel); var friendAntennaRangeValueLabel = new MyGuiControlLabel(new Vector2(0.15f, startY+0.09f)); friendAntennaRangeValueLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(friendAntennaRangeValueLabel); var friendAntennaRange = new MyGuiControlSlider(new Vector2(0.45f, startY+0.05f)); friendAntennaRange.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; friendAntennaRange.Name = name; friendAntennaRange.MinValue = 0; friendAntennaRange.MaxValue = 1; friendAntennaRange.DefaultValue = friendAntennaRange.MaxValue; friendAntennaRange.ValueChanged += (MyGuiControlSlider s) => { friendAntennaRangeValueLabel.Text = MyValueFormatter.GetFormatedFloat(MyHudMarkerRender.Denormalize(s.Value), 0) + "m"; }; friendAntennaRange.SliderClicked = OnAntennaSliderClicked; infoPage.Controls.Add(friendAntennaRange); }
private void CreateInfoPageControls(MyGuiControlTabPage infoPage) { infoPage.Name = "PageInfo"; infoPage.TextEnum = MySpaceTexts.TerminalTab_Info; var list = new MyGuiControlList(new Vector2(-0.462f, -0.34f), new Vector2(0.35f, 0.69f)); //var list = new MyGuiControlMultilineText( new Vector2(-0.462f, -0.34f), new Vector2(0.35f,0.69f), null, MyFontEnum.White, 1, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder()); list.Name = "InfoList"; list.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; infoPage.Controls.Add(list); var convertBtn = new MyGuiControlButton(); convertBtn.TextEnum = MySpaceTexts.TerminalTab_Info_ConvertButton; convertBtn.Name = "ConvertBtn"; infoPage.Controls.Add(convertBtn); if (MyFakes.ENABLE_CENTER_OF_MASS) { var sep = new MyGuiControlSeparatorList(); sep.AddVertical(new Vector2(0.14f, -0.34f), 0.7f, 0.002f); infoPage.Controls.Add(sep); var centerBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.32f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowMassCenter)); centerBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(centerBtnLabel); var centerBtn = new MyGuiControlCheckbox(new Vector2(0.45f, centerBtnLabel.Position.Y)); centerBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; centerBtn.Name = "CenterBtn"; infoPage.Controls.Add(centerBtn); } var showGravityGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.27f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowGravityGizmo)); showGravityGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(showGravityGizmoBtnLabel); var showGravityGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showGravityGizmoBtnLabel.Position.Y)); showGravityGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; showGravityGizmoBtn.Name = "ShowGravityGizmo"; infoPage.Controls.Add(showGravityGizmoBtn); var showSenzorGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.22f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowSenzorGizmo)); showSenzorGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(showSenzorGizmoBtnLabel); var showSenzorGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showSenzorGizmoBtnLabel.Position.Y)); showSenzorGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; showSenzorGizmoBtn.Name = "ShowSenzorGizmo"; infoPage.Controls.Add(showSenzorGizmoBtn); var showAntenaGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.17f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowAntenaGizmo)); showAntenaGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(showAntenaGizmoBtnLabel); var showAntenaGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showAntenaGizmoBtnLabel.Position.Y)); showAntenaGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; showAntenaGizmoBtn.Name = "ShowAntenaGizmo"; infoPage.Controls.Add(showAntenaGizmoBtn); CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_FriendlyAntennaRange),"FriendAntennaRange",-0.13f); CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_EnemyAntennaRange), "EnemyAntennaRange", -0.01f); CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_OwnedAntennaRange), "OwnedAntennaRange", 0.11f); var pivotBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, 0.23f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_PivotBtn)); pivotBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; infoPage.Controls.Add(pivotBtnLabel); var pivotBtn = new MyGuiControlCheckbox(new Vector2(0.45f, pivotBtnLabel.Position.Y)); pivotBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; pivotBtn.Name = "PivotBtn"; infoPage.Controls.Add(pivotBtn); if (MyFakes.ENABLE_TERMINAL_PROPERTIES) { var nameLabel = new MyGuiControlLabel() { Name = "RenameShipLabel", Text = "Ship Name", Position = new Vector2(0.15f, 0.26f) }; var nameTextBox = new MyGuiControlTextbox() { Name = "RenameShipText", Position = new Vector2(0.25f, 0.3f), Size = new Vector2(0.2f, 0.005f) }; var renameButton = new MyGuiControlButton() { Name = "RenameShipButton", Position = new Vector2(0.38f, 0.3f), Text = "Ok", VisualStyle = MyGuiControlButtonStyleEnum.Tiny, }; infoPage.Controls.Add(nameLabel); infoPage.Controls.Add(nameTextBox); infoPage.Controls.Add(renameButton); } var setDestructibleBlocksLabel = new MyGuiControlLabel(new Vector2(0.15f, 0.28f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_DestructibleBlocks)); setDestructibleBlocksLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; setDestructibleBlocksLabel.Visible = MySession.Static.Settings.ScenarioEditMode || MySession.Static.IsScenario; infoPage.Controls.Add(setDestructibleBlocksLabel); var setDestructibleBlocksBtn = new MyGuiControlCheckbox(new Vector2(0.45f, setDestructibleBlocksLabel.Position.Y), toolTip: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_DestructibleBlocks_Tooltip)); setDestructibleBlocksBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER; setDestructibleBlocksBtn.Name = "SetDestructibleBlocks"; infoPage.Controls.Add(setDestructibleBlocksBtn); }
public MyGuiControlTabPage GetTabSubControl(int key) { if (!m_pages.ContainsKey(key)) { m_pages[key] = new MyGuiControlTabPage( position: TabPosition, size: TabSize, color: ColorMask, pageKey: key) { Visible = false, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; Controls.Add(m_pages[key]); } return m_pages[key]; }
private void CreateControlPanelPageControls(MyGuiControlTabPage page) { page.Name = "PageControlPanel"; page.TextEnum = MySpaceTexts.ControlPanel; page.TextScale = 0.9f; var functionalBlockSearch = new MyGuiControlTextbox() { Position = new Vector2(-0.4625f, -0.325f), Size = new Vector2(0.255f, 0.052f), Name = "FunctionalBlockSearch", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER }; var functionalBlockSearchClear = new MyGuiControlButton() { Position = new Vector2(-0.232f, -0.325f), Size = new Vector2(0.045f, 0.05666667f), Name = "FunctionalBlockSearchClear", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; var functionalBlockListbox = new MyGuiControlListbox() { Position = new Vector2(-0.4625f, 0.0225f), Size = new Vector2(0.29f, 0.5f), Name = "FunctionalBlockListbox", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisibleRowsCount = 16 }; var control = new MyGuiControlCompositePanel() { Position = new Vector2(-0.1525f, 0f), Size = new Vector2(0.615f, 0.7125f), Name = "Control", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, InnerHeight = 0.685f }; var selectedBlockNamePanel = new MyGuiControlPanel() { Position = new Vector2(-0.1425f, -0.32f), Size = new Vector2(0.595f, 0.035f), Name = "SelectedBlockNamePanel", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK }; var blockNameLabel = new MyGuiControlLabel() { Position = new Vector2(-0.1325f, -0.322f), Size = new Vector2(0.0470270254f, 0.0266666654f), Name = "BlockNameLabel", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.Afterburner }; var groupTitleLabel = new MyGuiControlLabel() { Position = new Vector2(0.17f, -0.27f), Size = new Vector2(0.0470270254f, 0.0266666654f), Name = "GroupTitleLabel", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.Terminal_GroupTitle }; var groupName = new MyGuiControlTextbox() { Position = new Vector2(0.165f, -0.23f), Size = new Vector2(0.29f, 0.052f), Name = "GroupName", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER }; var groupSave = new MyGuiControlButton() { Position = new Vector2(0.2f, -0.17f), Name = "GroupSave", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.TerminalButton_GroupSave }; var groupDelete = new MyGuiControlButton() { Position = new Vector2(0.4f, -0.17f), Size = new Vector2(0.045f, 0.05666667f), Name = "GroupDelete", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close }; var showAll = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.SquareSmall, position: new Vector2(-0.205f, -0.345f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, buttonScale:0.5f) { Name = "ShowAll", }; page.Controls.Add(functionalBlockSearch); page.Controls.Add(functionalBlockSearchClear); page.Controls.Add(functionalBlockListbox); page.Controls.Add(control); page.Controls.Add(selectedBlockNamePanel); page.Controls.Add(blockNameLabel); page.Controls.Add(groupTitleLabel); page.Controls.Add(groupName); page.Controls.Add(groupSave); page.Controls.Add(showAll); page.Controls.Add(groupDelete); }
void joinGameTabs_OnPageChanged() { var serversPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageServersPanel"); var lobbiesPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageLobbiesPanel"); var favoritesPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageFavoritesPanel"); var historyPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageHistoryPanel"); var LANPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageLANPanel"); var friendsPage = (MyGuiControlTabPage)m_joinGameTabs.Controls.GetControlByName("PageFriendsPanel"); if (m_selectedPage == serversPage) { CloseServersPage(); } else if (m_selectedPage == lobbiesPage) { CloseLobbyPage(); } else if (m_selectedPage == favoritesPage) { CloseFavoritesPage(); } else if (m_selectedPage == LANPage) { CloseLANPage(); } else if (m_selectedPage == historyPage) { CloseHistoryPage(); } else if (m_selectedPage == friendsPage) { CloseFriendsPage(); } m_selectedPage = m_joinGameTabs.GetTabSubControl(m_joinGameTabs.SelectedPage); InitPageControls(m_selectedPage); if (m_selectedPage == serversPage) { InitServersPage(); m_showOnlyFriends.Enabled = false; m_showOnlyFriendsText.Enabled = false; } else if (m_selectedPage == lobbiesPage) { InitLobbyPage(); m_showOnlyFriends.Enabled = true; m_showOnlyFriendsText.Enabled = true; } else if (m_selectedPage == favoritesPage) { InitFavoritesPage(); m_showOnlyFriends.Enabled = false; m_showOnlyFriendsText.Enabled = false; } else if (m_selectedPage == historyPage) { InitHistoryPage(); m_showOnlyFriends.Enabled = false; m_showOnlyFriendsText.Enabled = false; } else if (m_selectedPage == LANPage) { InitLANPage(); m_showOnlyFriends.Enabled = false; m_showOnlyFriendsText.Enabled = false; } else if (m_selectedPage == friendsPage) { InitFriendsPage(); m_showOnlyFriends.Enabled = false; m_showOnlyFriendsText.Enabled = false; } if(m_contextMenu != null) { m_contextMenu.Deactivate(); m_contextMenu = null; } m_contextMenu = new MyGuiControlContextMenu(); m_contextMenu.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; m_contextMenu.Deactivate(); m_contextMenu.ItemClicked += OnContextMenu_ItemClicked; Controls.Add(m_contextMenu); }