public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f)) { trigger=(MyTriggerBlockDestroyed)trig; AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed); var layout = new MyLayoutTable(this); layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10); layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33); m_selectedBlocks = new MyGuiControlTable(); m_selectedBlocks.VisibleRowsCount = 8; m_selectedBlocks.ColumnsCount = 1; m_selectedBlocks.SetCustomColumnWidths(new float[]{1}); m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName)); layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3); m_buttonPaste = new MyGuiControlButton( text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, onButtonClick: OnPasteButtonClick ); m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip); layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1); m_buttonDelete = new MyGuiControlButton( text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, onButtonClick: OnDeleteButtonClick); layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1); m_labelSingleMessage = new MyGuiControlLabel( text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString() ); layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1); m_textboxSingleMessage = new MyGuiControlTextbox( defaultText: trigger.SingleMessage, maxLength: 85); layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3); foreach(var block in trigger.Blocks) AddRow(block.Key); m_tempSb.Clear().Append(trigger.SingleMessage); m_textboxSingleMessage.SetText(m_tempSb); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var layout = new MyLayoutTable(this); layout.SetColumnWidthsNormalized(50, 250, 150, 250, 50); layout.SetRowHeightsNormalized(50, 450, 30, 50); m_mainLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.GuiScenarioDescription), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); layout.AddWithSize(m_mainLabel, MyAlignH.Left, MyAlignV.Center, 0, 1, colSpan: 3); //BRIEFING: m_descriptionBox = new MyGuiControlMultilineText( position: new Vector2(0.0f, 0.0f), size: new Vector2(0.2f, 0.2f), textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, selectable: false); layout.AddWithSize(m_descriptionBox, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3); m_okButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Ok), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, size: new Vector2(200, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnOkClicked); layout.AddWithSize(m_okButton, MyAlignH.Left, MyAlignV.Top, 2, 2); }
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); }