public override void RecreateControls(bool constructor) { var titlePos = new Vector2(0f, -0.3f); var descSize = m_descSize; var descPosition = new Vector2(-descSize.X / 2, titlePos.Y + 0.10f); var objSize = new Vector2(0.2f, 0.3f); var objOffset = new Vector2(0.32f, 0f); var padding = new Vector2(0.005f, 0f); var curObjPos = new Vector2(0f, titlePos.Y + 0.05f); base.RecreateControls(constructor); CloseButtonEnabled = true; m_okButton = new MyGuiControlButton(position: new Vector2(0f, 0.29f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: m_okButtonCaption, onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); Controls.Add(m_okButton); m_titleLabel = new MyGuiControlLabel(text: m_missionTitle, position: titlePos, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textScale: 1.5f); Controls.Add(m_titleLabel); m_currentObjectiveLabel = new MyGuiControlLabel(position: curObjPos, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, textScale: 1f); Controls.Add(m_currentObjectiveLabel); SetCurrentObjective(m_currentObjective); m_descriptionBackgroundPanel = AddCompositePanel(MyGuiConstants.TEXTURE_RECTANGLE_DARK, descPosition, descSize, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); m_descriptionBox = AddMultilineText(offset: descPosition + padding, size: descSize, selectable: false); m_descriptionBox.Text = new StringBuilder(m_description); }
protected MyGuiControlCompositePanel AddCompositePanel(MyGuiCompositeTexture texture, Vector2 position, Vector2 size, MyGuiDrawAlignEnum panelAlign) { var panel = new MyGuiControlCompositePanel() { BackgroundTexture = texture }; panel.Position = position; panel.Size = size; panel.OriginAlign = panelAlign; Controls.Add(panel); return(panel); }
private void AddSeparator(string sectionName) { var panel = new MyGuiControlCompositePanel() { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = Vector2.Zero }; var label = new MyGuiControlLabel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Text = sectionName, Font = MyFontEnum.Blue, PositionX = 0.005f }; var imageOffset = 0.003f; var colorMask = MyGuiConstants.THEMED_GUI_LINE_COLOR; var img = new MyGuiControlImage(textures: new[] { @"Textures\GUI\FogSmall3.dds" }) { Size = new Vector2(label.Size.X + imageOffset * 10, 0.007f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, //ColorMask = new Vector4(0,0,0,1), ColorMask = colorMask.ToVector4(), Position = new Vector2(-imageOffset, label.Size.Y) }; var parent = new MyGuiControlParent { Size = new Vector2(m_campaignList.Size.X, label.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = Vector2.Zero }; panel.Size = parent.Size + new Vector2(-0.035f, 0.01f); panel.Position -= parent.Size / 2 - new Vector2(-0.01f, 0f); label.Position -= parent.Size / 2; img.Position -= parent.Size / 2; parent.Controls.Add(panel); parent.Controls.Add(img); parent.Controls.Add(label); m_campaignList.Controls.Add(parent); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var left = -0.23f; var top = -0.23f; var spacingV = 0.045f; var buttonSize = new Vector2(0.29f, 0.052f); var composite = new MyGuiControlCompositePanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(0.46f, 0.46f) }; left += 0.005f; top += 0.007f; var panel = new MyGuiControlPanel() { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Position = new Vector2(left, top), Size = new Vector2(0.451f, 0.038f), BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK }; left += 0.005f; top += 0.003f; // LABELS var headerText = MyTexts.GetString((m_editFaction == null) ? MySpaceTexts.TerminalTab_Factions_CreateFaction : MySpaceTexts.TerminalTab_Factions_EditFaction); var headerLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top), text: headerText); top += 0.01f; var shortcutLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionTag)); var nameLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 2f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionName)); var descLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 3f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription)); var secretLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, size: buttonSize, position: new Vector2(left, top + 4f * spacingV), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfo)); shortcutLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip); secretLabel.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip); Controls.Add(composite); Controls.Add(panel); Controls.Add(headerLabel); Controls.Add(shortcutLabel); Controls.Add(nameLabel); Controls.Add(descLabel); Controls.Add(secretLabel); // INPUTS var iLeft = 0.06f; var iTop = -0.15f; m_shortcut = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop), maxLength: 3, defaultText: (m_editFaction != null) ? m_editFaction.Tag : ""); m_name = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + spacingV), maxLength: 64, defaultText: (m_editFaction != null) ? m_editFaction.Name : ""); m_desc = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 2f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.Description : ""); m_privInfo = new MyGuiControlTextbox(position: new Vector2(iLeft, iTop + 3f * spacingV), maxLength: 512, defaultText: (m_editFaction != null) ? m_editFaction.PrivateInfo : ""); m_shortcut.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionTagToolTip); m_privInfo.SetToolTip(MySpaceTexts.TerminalTab_Factions_CreateFactionPrivateInfoToolTip); Controls.Add(m_shortcut); Controls.Add(m_name); Controls.Add(m_desc); Controls.Add(m_privInfo); // BUTTONS top -= 0.003f; Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(left, -top), text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkClick)); Controls.Add(new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, size: buttonSize, position: new Vector2(-left, -top), text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelClick)); }
private void InitRightSide() { Vector2 originL; originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP); var screenSize = m_size.Value; var layoutSize = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM); var columnWidthLabel = layoutSize.X * 0.25f; var columnWidthControl = layoutSize.X - columnWidthLabel; var rowHeight = 0.052f; var leftHeight = layoutSize.Y - 4 * rowHeight; var descriptionMargin = 0.005f; m_tableLayout = new MyLayoutTable(this, originL, layoutSize); m_tableLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl); m_tableLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, leftHeight); m_nameLabel = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.Name), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM, position: new Vector2(0, 0.2f)); m_nameTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH); m_nameTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP; m_nameTextbox.Enabled = false; float width = m_nameTextbox.Size.X; m_difficultyLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.Difficulty), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); m_difficultyCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); m_difficultyCombo.Enabled = false; m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy); m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal); m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard); m_onlineModeLabel = new MyGuiControlLabel(text: MyTexts.GetString(MyCommonTexts.WorldSettings_OnlineMode), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); m_onlineMode = new MyGuiControlCheckbox(originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); m_onlineMode.Enabled = false; m_descriptionMultilineText = new MyGuiControlMultilineText( selectable: false, font: MyFontEnum.Blue) { Name = "BriefingMultilineText", Position = new Vector2(-0.009f, -0.115f), Size = new Vector2(0.419f, 0.412f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, TextAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var panel = new MyGuiControlCompositePanel() { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; m_tableLayout.Add(m_nameLabel, MyAlignH.Left, MyAlignV.Center, 0, 0); m_tableLayout.Add(m_difficultyLabel, MyAlignH.Left, MyAlignV.Center, 2, 0); m_tableLayout.Add(m_onlineModeLabel, MyAlignH.Left, MyAlignV.Center, 3, 0); m_tableLayout.Add(m_nameTextbox, MyAlignH.Left, MyAlignV.Center, 0, 1); m_tableLayout.Add(m_difficultyCombo, MyAlignH.Left, MyAlignV.Center, 2, 1); m_tableLayout.Add(m_onlineMode, MyAlignH.Left, MyAlignV.Center, 3, 1); m_tableLayout.Add(panel, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2); m_tableLayout.Add(m_descriptionMultilineText, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2); m_descriptionMultilineText.Position = new Vector2(panel.Position.X + descriptionMargin, panel.Position.Y); panel.Size = new Vector2(m_nameTextbox.Size.X + columnWidthLabel, m_tableLayout.GetCellSize(4, 0).Y + 0.01f); m_descriptionMultilineText.Size = new Vector2(panel.Size.X - descriptionMargin, m_tableLayout.GetCellSize(4, 0).Y - descriptionMargin + 0.01f); var buttonsOrigin = m_size.Value / 2 - new Vector2(0.365f, 0.03f); var buttonSize = MyGuiConstants.BACK_BUTTON_SIZE; // Ok/Cancel var okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); var cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.055f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); Controls.Add(okButton); Controls.Add(cancelButton); CloseButtonEnabled = true; }
private void InitRightSide() { var originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP); var screenSize = m_size.Value; var layoutSize = new Vector2(screenSize.X / 2 - originL.X, screenSize.Y - MARGIN_TOP - MARGIN_BOTTOM) - new Vector2(0.05f, 0.05f); var columnWidthLabel = layoutSize.X * 0.4f; var columnWidthControl = layoutSize.X - columnWidthLabel; var rowHeight = 0.052f; var leftHeight = layoutSize.Y - 4 * rowHeight; var descriptionMargin = 0.005f; m_tableLayout = new MyLayoutTable(this, originL, layoutSize); m_tableLayout.SetColumnWidthsNormalized(columnWidthLabel, columnWidthControl); m_tableLayout.SetRowHeightsNormalized(rowHeight, rowHeight, rowHeight, rowHeight, leftHeight); // Name m_nameLabel = new MyGuiControlLabel { Text = MyTexts.GetString(MyCommonTexts.Name), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, }; m_nameTextbox = new MyGuiControlTextbox { MaxLength = MySession.MAX_NAME_LENGTH, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Enabled = false }; // Difficulty m_difficultyLabel = new MyGuiControlLabel { Text = MyTexts.GetString(MySpaceTexts.Difficulty), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP }; m_difficultyCombo = new MyGuiControlCombobox { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Enabled = false }; m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy); m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal); m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard); // Online m_onlineModeLabel = new MyGuiControlLabel { Text = MyTexts.GetString(MyCommonTexts.WorldSettings_OnlineMode), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP }; m_onlineMode = new MyGuiControlCheckbox { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, Enabled = false }; // Description m_descriptionMultilineText = new MyGuiControlMultilineText( selectable: false) { Name = "BriefingMultilineText", Position = new Vector2(-0.009f, -0.115f), Size = new Vector2(0.419f, 0.412f), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, TextAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var panel = new MyGuiControlCompositePanel { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; m_tableLayout.Add(m_nameLabel, MyAlignH.Left, MyAlignV.Center, 0, 0); m_tableLayout.Add(m_difficultyLabel, MyAlignH.Left, MyAlignV.Center, 2, 0); m_tableLayout.Add(m_onlineModeLabel, MyAlignH.Left, MyAlignV.Center, 3, 0); m_tableLayout.AddWithSize(m_nameTextbox, MyAlignH.Left, MyAlignV.Center, 0, 1); m_tableLayout.AddWithSize(m_difficultyCombo, MyAlignH.Left, MyAlignV.Center, 2, 1); m_tableLayout.AddWithSize(m_onlineMode, MyAlignH.Left, MyAlignV.Center, 3, 1); m_tableLayout.AddWithSize(panel, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2); m_tableLayout.AddWithSize(m_descriptionMultilineText, MyAlignH.Left, MyAlignV.Top, 4, 0, 1, 2); // Panel offset from text var bothSidesOffset = 0.003f; panel.Position = new Vector2(panel.PositionX - bothSidesOffset, panel.PositionY - bothSidesOffset); panel.Size = new Vector2(panel.Size.X + bothSidesOffset, panel.Size.Y + bothSidesOffset * 2); // The bulgarian constant is offset from side to match the size of the layout var buttonsOrigin = panel.Position + new Vector2(panel.Size.X, panel.Size.Y + 0.02f); var buttonSize = MyGuiConstants.BACK_BUTTON_SIZE; var buttonHorizontalSpacing = 0.02f; // Ok/Cancel/Publish m_publishButton = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MyCommonTexts.LoadScreenButtonPublish), onButtonClick: OnPublishButtonOnClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); var cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0, buttonSize.Y), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); var okButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(-buttonSize.X - buttonHorizontalSpacing, buttonSize.Y), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); Controls.Add(m_publishButton); Controls.Add(okButton); Controls.Add(cancelButton); CloseButtonEnabled = true; }