public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_toolbarControl = new MyGuiControlToolbar(); m_toolbarControl.Position = new Vector2(0.5f, 0.99f); m_toolbarControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM; m_toolbarControl.IsActiveControl = false; Elements.Add(m_toolbarControl); m_textScale = MyGuiConstants.HUD_TEXT_SCALE * MyGuiManager.LanguageTextScale; var style = new MyGuiControlBlockInfo.MyControlBlockInfoStyle() { BlockNameLabelFont = MyFontEnum.White, EnableBlockTypeLabel = true, ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components, ComponentsLabelFont = MyFontEnum.Blue, InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required, InstalledRequiredLabelFont = MyFontEnum.Blue, RequiredLabelText = MySpaceTexts.HudBlockInfo_Required, IntegrityLabelFont = MyFontEnum.White, IntegrityBackgroundColor = new Vector4(78 / 255.0f, 116 / 255.0f, 137 / 255.0f, 1.0f), IntegrityForegroundColor = new Vector4(0.5f, 0.1f, 0.1f, 1), IntegrityForegroundColorOverCritical = new Vector4(118 / 255.0f, 166 / 255.0f, 192 / 255.0f, 1.0f), LeftColumnBackgroundColor = new Vector4(46 / 255.0f, 76 / 255.0f, 94 / 255.0f, 1.0f), TitleBackgroundColor = new Vector4(72 / 255.0f, 109 / 255.0f, 130 / 255.0f, 1.0f), ComponentLineMissingFont = MyFontEnum.Red, ComponentLineAllMountedFont = MyFontEnum.White, ComponentLineAllInstalledFont = MyFontEnum.Blue, ComponentLineDefaultFont = MyFontEnum.White, ComponentLineDefaultColor = new Vector4(0.6f, 0.6f, 0.6f, 1f), ShowAvailableComponents = false, EnableBlockTypePanel = true, }; m_blockInfo = new MyGuiControlBlockInfo(style); m_blockInfo.IsActiveControl = false; Controls.Add(m_blockInfo); m_chatControl = new MyHudControlChat(MyHud.Chat, Vector2.Zero, new Vector2(0.4f, 0.25f)); Elements.Add(m_chatControl); m_cameraInfoMultilineControl = new MyGuiControlMultilineText( position: Vector2.Zero, size: new Vector2(0.4f, 0.25f), backgroundColor: null, font: MyFontEnum.White, textScale: 0.7f, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, contents: null, drawScrollbar: false, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_cameraInfoMultilineControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; Elements.Add(m_cameraInfoMultilineControl); m_rotatingWheelControl = new MyGuiControlRotatingWheel(position: new Vector2(0.5f, 0.85f)); Controls.Add(m_rotatingWheelControl); Vector2 buildModePosition = new Vector2(0.5f, 0.02f); buildModePosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref buildModePosition); m_buildModeLabel = new MyGuiControlLabel( position: buildModePosition, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, font: MyFontEnum.White, text: MyTexts.GetString(MySpaceTexts.Hud_BuildMode)); Controls.Add(m_buildModeLabel); m_relayNotification = new MyGuiControlLabel(new Vector2(1, 0), font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_relayNotification.TextEnum = MySpaceTexts.Multiplayer_IndirectConnection; m_relayNotification.Visible = false; Controls.Add(m_relayNotification); var offset = new Vector2(0, m_relayNotification.Size.Y); m_noMsgSentNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Debug, text: MyTexts.GetString(MySpaceTexts.Multiplayer_LastMsg), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noMsgSentNotification.Visible = false; Controls.Add(m_noMsgSentNotification); offset += new Vector2(0, m_noMsgSentNotification.Size.Y); m_noConnectionNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Red, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noConnectionNotification.TextEnum = MySpaceTexts.Multiplayer_NoConnection; m_noConnectionNotification.Visible = false; Controls.Add(m_noConnectionNotification); MyHud.ReloadTexts(); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var layout = new MyLayoutTable(this); layout.SetColumnWidthsNormalized(50, 300, 300, 300, 300, 300, 50); layout.SetRowHeightsNormalized(50, 450, 70, 70, 70, 400, 70, 70, 50); //BRIEFING: MyGuiControlParent briefing = new MyGuiControlParent(); var briefingScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: briefing) { Name = "BriefingScrollableArea", ScrollbarVEnabled = true, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; layout.AddWithSize(briefingScrollableArea, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 4, colSpan: 3); //inside scrollable area: m_descriptionBox = new MyGuiControlMultilineText( position: new Vector2(-0.227f, 5f), size: new Vector2(briefingScrollableArea.Size.X - 0.02f, 11f), textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, selectable: false); briefing.Controls.Add(m_descriptionBox); m_connectedPlayers = new MyGuiControlTable(); m_connectedPlayers.Size = new Vector2(490f, 150f) / MyGuiConstants.GUI_OPTIMAL_SIZE; m_connectedPlayers.VisibleRowsCount = 8; m_connectedPlayers.ColumnsCount = 2; m_connectedPlayers.SetCustomColumnWidths(new float[] { 0.7f, 0.3f }); m_connectedPlayers.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiScenarioPlayerName)); m_connectedPlayers.SetColumnName(1, MyTexts.Get(MySpaceTexts.GuiScenarioPlayerStatus)); m_kickPlayerButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Kick), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnKick2Clicked); m_kickPlayerButton.Enabled = CanKick(); m_timeoutLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.GuiScenarioTimeout), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); TimeoutCombo = new MyGuiControlCombobox(); TimeoutCombo.ItemSelected += OnTimeoutSelected; TimeoutCombo.AddItem(3, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout3min)); TimeoutCombo.AddItem(5, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout5min)); TimeoutCombo.AddItem(10, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout10min)); TimeoutCombo.AddItem(-1, MyTexts.Get(MySpaceTexts.GuiScenarioTimeoutUnlimited)); TimeoutCombo.SelectItemByIndex(0); TimeoutCombo.Enabled = Sync.IsServer; m_canJoinRunningLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScenarioSettings_CanJoinRunningShort), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_canJoinRunning = new MyGuiControlCheckbox(); m_canJoinRunningLabel.Enabled = false; m_canJoinRunning.Enabled = false; m_startButton = new MyGuiControlButton(text: MyTexts.Get(MySpaceTexts.GuiScenarioStart), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, size: new Vector2(200, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnStartClicked); m_startButton.Enabled = Sync.IsServer; m_chatControl = new MyHudControlChat( MyHud.Chat, size: new Vector2(1400f, 300f) / MyGuiConstants.GUI_OPTIMAL_SIZE, font: MyFontEnum.DarkBlue, textScale: 0.7f, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, backgroundColor: MyGuiConstants.THEMED_GUI_BACKGROUND_COLOR, contents: null, drawScrollbar: true, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_chatControl.BorderEnabled = true; m_chatControl.BorderColor = Color.CornflowerBlue; m_chatTextbox = new MyGuiControlTextbox(maxLength: ChatMessageBuffer.MAX_MESSAGE_SIZE); m_chatTextbox.Size = new Vector2(1400f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE; m_chatTextbox.TextScale = 0.8f; m_chatTextbox.VisualStyle = MyGuiControlTextboxStyleEnum.Default; m_chatTextbox.EnterPressed += ChatTextbox_EnterPressed; m_sendChatButton = new MyGuiControlButton(text: MyTexts.Get(MySpaceTexts.GuiScenarioSend), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnSendChatClicked); layout.AddWithSize(m_connectedPlayers, MyAlignH.Left, MyAlignV.Top, 1, 4, rowSpan: 2, colSpan: 2); layout.AddWithSize(m_kickPlayerButton, MyAlignH.Left, MyAlignV.Center, 2, 5); layout.AddWithSize(m_timeoutLabel, MyAlignH.Left, MyAlignV.Center, 3, 4); layout.AddWithSize(TimeoutCombo, MyAlignH.Left, MyAlignV.Center, 3, 5); layout.AddWithSize(m_canJoinRunningLabel, MyAlignH.Left, MyAlignV.Center, 4, 4); layout.AddWithSize(m_canJoinRunning, MyAlignH.Right, MyAlignV.Center, 4, 5); layout.AddWithSize(m_chatControl, MyAlignH.Left, MyAlignV.Top, 5, 1, rowSpan: 1, colSpan: 5); layout.AddWithSize(m_chatTextbox, MyAlignH.Left, MyAlignV.Top, 6, 1, rowSpan: 1, colSpan: 4); layout.AddWithSize(m_sendChatButton, MyAlignH.Right, MyAlignV.Top, 6, 5); layout.AddWithSize(m_startButton, MyAlignH.Left, MyAlignV.Top, 7, 2); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_toolbarControl = new MyGuiControlToolbar(); m_toolbarControl.Position = new Vector2(0.5f, 0.99f); m_toolbarControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM; m_toolbarControl.IsActiveControl = false; Elements.Add(m_toolbarControl); m_textScale = MyGuiConstants.HUD_TEXT_SCALE * MyGuiManager.LanguageTextScale; m_blockInfo = new MyGuiControlBlockInfo(); m_blockInfo.IsActiveControl = false; Controls.Add(m_blockInfo); m_chatControl = new MyHudControlChat(Vector2.Zero, new Vector2(0.4f, 0.25f)); Elements.Add(m_chatControl); m_cameraInfoMultilineControl = new MyGuiControlMultilineText( position: Vector2.Zero, size: new Vector2(0.4f, 0.25f), backgroundColor: null, font: MyFontEnum.White, textScale: 0.7f, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, contents: null, drawScrollbar: false, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_cameraInfoMultilineControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; Elements.Add(m_cameraInfoMultilineControl); m_rotatingWheelControl = new MyGuiControlRotatingWheel(position: new Vector2(0.5f, 0.85f)); Controls.Add(m_rotatingWheelControl); Vector2 buildModePosition = new Vector2(0.5f, 0.02f); buildModePosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref buildModePosition); m_buildModeLabel = new MyGuiControlLabel( position: buildModePosition, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, font: MyFontEnum.White, text: MyTexts.GetString(MySpaceTexts.Hud_BuildMode)); Controls.Add(m_buildModeLabel); m_relayNotification = new MyGuiControlLabel(new Vector2(1, 0), font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_relayNotification.TextEnum = MySpaceTexts.Multiplayer_IndirectConnection; m_relayNotification.Visible = false; Controls.Add(m_relayNotification); var offset = new Vector2(0, m_relayNotification.Size.Y); m_noMsgSentNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Debug, text: MyTexts.GetString(MySpaceTexts.Multiplayer_LastMsg), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noMsgSentNotification.Visible = false; Controls.Add(m_noMsgSentNotification); offset += new Vector2(0, m_noMsgSentNotification.Size.Y); m_noConnectionNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Red, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noConnectionNotification.TextEnum = MySpaceTexts.Multiplayer_NoConnection; m_noConnectionNotification.Visible = false; Controls.Add(m_noConnectionNotification); MyHud.ReloadTexts(); }