public MyGuiScreenGameChat(bool sendToTeam) : base(Vector2.Zero, null, null) { m_closeOnEsc = true; m_enableBackgroundFade = true; m_teamOnly = sendToTeam; m_positionOffset = new Vector2(MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)).X - 920/1920f/2 - 0.04f, -0.2f); m_panelTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ChatBackground", flags: TextureFlags.IgnoreQuality); MyGuiControlPanel panel = new MyGuiControlPanel(this, new Vector2(0.5f, 0.85f) + m_positionOffset, new Vector2(920 / 1920f, 388 / 1200f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, m_panelTexture, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP); Controls.Add(panel); Vector2 menuPositionOrigin = new Vector2(0.423f, 0.939f) + m_positionOffset; Vector2 delta = new Vector2(0.17f, 0f); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; m_textbox = new MyGuiControlTextbox(this, menuPositionOrigin, MyGuiControlPreDefinedSize.MEDIUM, "", MyGuiConstants.CHAT_WINDOW_MAX_MESSAGE_LENGTH, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f, MyGuiControlTextboxType.NORMAL, true, false); Controls.Add(m_textbox); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + delta, MyGuiConstants.MAIN_MENU_BUTTON_SIZE * new Vector2(0.41f, 0.78f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonChatEnter", flags: TextureFlags.IgnoreQuality), null, null, sendToTeam ? MyTextsWrapperEnum.SendToTeam : MyTextsWrapperEnum.SendToAll, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.65f, menuButtonTextAlignement, OnSendClick, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE)); }
public MyGuiScreenSaveCheckpoint() : base(new Vector2(0.5f, 0.5f), new Vector2(0.33f, 0.85f)) { m_size = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 2, 0.1f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); AddCaption(MyTextsWrapperEnum.SaveCheckpoint, MyGuiConstants.LABEL_TEXT_COLOR); m_nameTextbox = new MyGuiControlTextbox(this, new Vector2(0, 0.1f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.Y / 2 - m_size.Value.Y / 2), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, MAXIMUM_CHECKPOINT_NAME_LENGTH, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_nameTextbox); AddOkAndCancelButtonControls(); }
public MyGuiScreenEditorRenameGroup(MyGuiScreenEditorGroups myGuiScreenEditorGroups, MyObjectGroup group) : base(new Vector2(0.5f, 0.5f), new Vector2(0.33f, 0.85f)) { m_myGuiScreenEditorGroups = myGuiScreenEditorGroups; m_group = group; m_size = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X*2, 0.1f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y*2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); AddCaption(MyTextsWrapperEnum.EditorGroupsRenameGroup, MyGuiConstants.LABEL_TEXT_COLOR); m_nameTextbox = new MyGuiControlTextbox(this, new Vector2(0, 0.1f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.Y / 2 - m_size.Value.Y / 2), MyGuiControlPreDefinedSize.MEDIUM, group.Name.ToString(), MAXIMUM_GROUP_NAME_LENGTH, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_nameTextbox); AddOkAndCancelButtonControls(); }
void Init() { string name = m_waypointPath != null ? m_waypointPath.Name : string.Empty; m_size = m_newlyAdded ? new Vector2(0.42f, 0.35f) : new Vector2(0.42f, 0.35f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize(); // Add screen title AddCaption(m_newlyAdded ? MyTextsWrapperEnum.WaypointPathNameCreateCaption : MyTextsWrapperEnum.WaypointPathNameCaption); Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.WaypointPathName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_groupNameTextbox = new MyGuiControlTextbox(this, controlsOriginLeft + 0.75f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2, 0), MyGuiControlPreDefinedSize.MEDIUM, name, MyWaypointConstants.MAXIMUM_WAYPOINT_PATH_NAME_LENGTH, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_groupNameTextbox); AddOkAndCancelButtonControls(); }
private void InitControls() { Vector2 position = new Vector2(-m_size.Value.X / 2f, 0f); Vector2 controlsDelta = new Vector2(m_offset, 0f); // create description label if ((m_flags & MyGuiSizeEnumFlags.Description) > 0) { m_descriptionLabel = new MyGuiControlLabel(this, position, null, m_description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_descriptionLabel); position += controlsDelta; } // create value slider if ((m_flags & MyGuiSizeEnumFlags.Slider) > 0) { // slider m_valueSlider = new MyGuiControlSlider(this, position, MyGuiConstants.SLIDER_WIDTH, m_minValue, m_maxValue, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_valueSlider.OnChange = OnSliderChange; Controls.Add(m_valueSlider); position += controlsDelta; } // create value textbox if ((m_flags & MyGuiSizeEnumFlags.TextBox) > 0) { m_valueTextBox = new MyGuiControlTextbox(this, position, MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); m_valueTextBox.TextChanged = OnTextBoxChange; Controls.Add(m_valueTextBox); } else if((m_flags & MyGuiSizeEnumFlags.Slider) > 0) { // slider value label m_valueLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.None, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_valueLabel); } }
public MyGuiScreenSaveSector() : base(new Vector2(0.5f, 0.5f), new Vector2(0.33f, 0.85f)) { m_size = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 2, 0.1f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); AddCaption(MyTextsWrapperEnum.SaveSector, MyGuiConstants.LABEL_TEXT_COLOR); string sectorName = MyGuiScreenGamePlay.Static.GetSectorIdentifier().SectorName; sectorName = sectorName == null ? string.Empty : sectorName; m_nameTextbox = new MyGuiControlTextbox(this, new Vector2(0, 0.1f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.Y / 2 - m_size.Value.Y / 2), MyGuiControlPreDefinedSize.MEDIUM, sectorName, MAXIMUM_SECTOR_NAME_LENGTH, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_nameTextbox); AddOkAndCancelButtonControls(); }
public MyGuiScreenEditorCopyToolSelectSector() : base(new Vector2(0.5f, 0.5f), new Vector2(0.03f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.04f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.03f, 0.55f)) { m_size = new Vector2(0.65f, 0.55f); Vector2 controlsDelta = new Vector2(0, 0.0525f); Vector2 controlsColumn1Origin = new Vector2(-m_size.Value.X / 2.0f + 0.04f, -m_size.Value.Y / 2.0f + 0.06f); Vector2 controlsColumn2Origin = new Vector2(controlsColumn1Origin.X + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.05f, controlsColumn1Origin.Y - 0.02f); Vector2 controlsColumn2OriginLabel = new Vector2(controlsColumn1Origin.X + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.03f, controlsColumn1Origin.Y - 0.02f); //Vector2 controls AddCaption(MyTextsWrapperEnum.SelectSector, MyGuiConstants.LABEL_TEXT_COLOR, new Vector2(0, 0.007f)); // controls for typing player name Controls.Add(new MyGuiControlLabel(this, controlsColumn1Origin + 1 * controlsDelta, null, MyTextsWrapperEnum.PlayerName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_playerName = new MyGuiControlTextbox(this, controlsColumn1Origin + 2 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_playerName); // controls for typing sector name Controls.Add(new MyGuiControlLabel(this, controlsColumn1Origin + 3 * controlsDelta, null, MyTextsWrapperEnum.SectorName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_sector_name = new MyGuiControlTextbox(this, controlsColumn1Origin + 4 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_sector_name); // controls for typing sector id. Controls.Add(new MyGuiControlLabel(this, controlsColumn2Origin + 3 * controlsDelta, null, MyTextsWrapperEnum.SectorIdentifier, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_sectorIdentifierX = new MyGuiControlTextbox(this, controlsColumn2Origin + 4 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_sectorIdentifierY = new MyGuiControlTextbox(this, controlsColumn2Origin + 5 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_sectorIdentifierZ = new MyGuiControlTextbox(this, controlsColumn2Origin + 6 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 4 * controlsDelta, null, MyTextsWrapperEnum.X, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 5 * controlsDelta, null, MyTextsWrapperEnum.Y, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 6 * controlsDelta, null, MyTextsWrapperEnum.Z, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_sectorIdentifierX); Controls.Add(m_sectorIdentifierY); Controls.Add(m_sectorIdentifierZ); AddOkAndCancelButtonControls(new Vector2(0, -0.02f)); }
public MyGuiScreenInputString(InputResultHandler resultHandler, MyTextsWrapperEnum caption, StringBuilder defaultValue = null, int maxLength = 128) : base(new Vector2(0.5f, 0.5f), new Vector2(0.33f, 0.85f)) { m_resultHandler = resultHandler; m_size = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 2, 0.1f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y); AddCaption(caption, MyGuiConstants.LABEL_TEXT_COLOR); m_nameTextbox = new MyGuiControlTextbox(this, new Vector2(0, 0.1f + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.Y / 2 - m_size.Value.Y / 2), MyGuiControlPreDefinedSize.MEDIUM, defaultValue != null ? defaultValue.ToString() : "", maxLength, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_nameTextbox); AddOkAndCancelButtonControls(); }
private void Init() { Vector2 topLeftPosition = new Vector2(-m_size.Value.X / 2f + 0.05f, -m_size.Value.Y / 2f + 0.15f); Vector2 labelHealthPosition = topLeftPosition; Vector2 textboxHealthPosition = labelHealthPosition + new Vector2(0.2f, 0f); Vector2 labelMaxHealthPosition = textboxHealthPosition + new Vector2(0.13f, 0f); Vector2 textboxMaxHealthPosition = labelMaxHealthPosition + new Vector2(0.22f, 0f); for (int i = 0; i < m_healthsAndMaxhealths.Length; i++) { if (m_healthsAndMaxhealths[i] != null) { MyGuiControlLabel labelHealth = new MyGuiControlLabel(this, labelHealthPosition, null, MyTextsWrapperEnum.Health, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(labelHealth); m_healthTextboxes[i] = new MyGuiControlTextbox(this, textboxHealthPosition, MyGuiControlPreDefinedSize.MEDIUM, MyValueFormatter.GetFormatedFloat(m_healthsAndMaxhealths[i].Health, 0, string.Empty), 6, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_healthTextboxes[i]); MyGuiControlLabel labelMaxHealth = new MyGuiControlLabel(this, labelMaxHealthPosition, null, MyTextsWrapperEnum.MaxHealth, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(labelMaxHealth); m_maxHealthTextboxes[i] = new MyGuiControlTextbox(this, textboxMaxHealthPosition, MyGuiControlPreDefinedSize.MEDIUM, MyValueFormatter.GetFormatedFloat(m_healthsAndMaxhealths[i].MaxHealth, 0, string.Empty), 6, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_maxHealthTextboxes[i]); } else { MyGuiControlLabel labelDestroyed = new MyGuiControlLabel(this, labelHealthPosition, null, MyTextsWrapperEnum.Destroyed, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(labelDestroyed); } labelHealthPosition += MyGuiConstants.CONTROLS_DELTA; textboxHealthPosition += MyGuiConstants.CONTROLS_DELTA; labelMaxHealthPosition += MyGuiConstants.CONTROLS_DELTA; textboxMaxHealthPosition += MyGuiConstants.CONTROLS_DELTA; } AddOkAndCancelButtonControls(); }
private void InitControls() { Vector2 controlsLeftPosition = -m_size.Value / 2f; Vector2 controlsRightPosition = controlsLeftPosition + new Vector2(m_size.Value.X / 2f, 0f); Vector2 labelOffset = new Vector2(0.25f, 0f); // use solo Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_useSoloCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_useSoloCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_useSoloCheckbox.GetSize().Value.Y)*/; if ((m_useProperties.UseMask & MyUseType.Solo) == 0) { m_useSoloCheckbox.Enabled = false; m_useSoloCheckbox.Checked = false; } // hack solo Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackSolo, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackSoloCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.Solo) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_hackSoloCheckbox); controlsRightPosition += MyGuiConstants.CONTROLS_DELTA/* + new Vector2(m_hackSoloCheckbox.GetSize().Value.Y)*/; if ((m_useProperties.HackMask & MyUseType.Solo) == 0) { m_hackSoloCheckbox.Enabled = false; m_hackSoloCheckbox.Checked = false; } // use from HUB Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.UseFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_useHUBCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.UseType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_useHUBCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; if ((m_useProperties.UseMask & MyUseType.FromHUB) == 0) { m_useHUBCheckbox.Enabled = false; m_useHUBCheckbox.Checked = false; } // hack from HUB Controls.Add(new MyGuiControlLabel(this, controlsRightPosition, null, MyTextsWrapperEnum.HackFromHUB, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackHUBCheckbox = new MyGuiControlCheckbox(this, controlsRightPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, (m_useProperties.HackType & MyUseType.FromHUB) != 0, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_hackHUBCheckbox); controlsRightPosition += MyGuiConstants.CONTROLS_DELTA; if ((m_useProperties.HackMask & MyUseType.FromHUB) == 0) { m_hackHUBCheckbox.Enabled = false; m_hackHUBCheckbox.Checked = false; } // is hacked Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.IsHacked, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_isHackedCheckbox = new MyGuiControlCheckbox(this, controlsLeftPosition + labelOffset, MyGuiConstants.CHECKBOX_SIZE, m_useProperties.IsHacked, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_isHackedCheckbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; // move the two last controls to the right a bit. labelOffset.X = labelOffset.X + 0.075f; // hacking time Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingTime, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackingTimeTextbox = new MyGuiControlTextbox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, m_useProperties.HackingTime.ToString(), 6, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_hackingTimeTextbox); controlsLeftPosition += MyGuiConstants.CONTROLS_DELTA; // hacking level Controls.Add(new MyGuiControlLabel(this, controlsLeftPosition, null, MyTextsWrapperEnum.HackingLevel, m_labelColor, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_hackingLevelCombobox = new MyGuiControlCombobox(this, controlsLeftPosition + labelOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); Controls.Add(m_hackingLevelCombobox); for (int i = 1; i <= 5; i++) { m_hackingLevelCombobox.AddItem(i, new StringBuilder(i.ToString())); } m_hackingLevelCombobox.SelectItemByKey(m_useProperties.HackingLevel); }
protected virtual void CreateControls() { CreateButtons(); var screenZero = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)); var screenMax = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(MyMinerGame.ScreenSize.X, MyMinerGame.ScreenSize.Y)); var textBoxSize = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(30f / 1600f,0); var treeViewSize = new Vector2(textBoxSize.X, screenMax.Y - (MyGuiConstants.TOOLBAR_PADDING.Y * 6 + textBoxSize.Y + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y)); var panelSize = treeViewSize + new Vector2(MyGuiConstants.TOOLBAR_PADDING.X * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3) + new Vector2(0, textBoxSize.Y); var textBoxPosition = screenZero + new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3 + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y); var treeViewPosition = textBoxPosition + new Vector2(0, textBoxSize.Y + MyGuiConstants.TOOLBAR_PADDING.Y); var panelPosition = textBoxPosition - new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y, MyGuiConstants.TOOLBAR_PADDING.Y); // Add treeview and add button panel m_controlPanel = new MyGuiControlPanel(m_parentScreen, panelPosition + panelSize / 2, panelSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR, null, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); m_editorControls.Add(m_controlPanel); m_addObjectTreeViewdragDrop = new MyTreeViewItemDragAndDrop(m_parentScreen); m_addObjectTreeViewdragDrop.Drop = OnDragDrop; // Add object treeView m_addObjectTreeView = new MyGuiControlTreeView( m_parentScreen, treeViewPosition + treeViewSize / 2, treeViewSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR, false); m_editorControls.Add(m_addObjectTreeView); // Add treeView filter textBox m_filterTextbox = new MyGuiControlTextbox(m_parentScreen, textBoxPosition + textBoxSize / 2, MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 80, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL, false); m_editorControls.Add(m_filterTextbox); MyGuiScreenGamePlay.Static.SetControlIndex(1); // Dragdrop Control must be last (draw over other controls) m_editorControls.Add(m_addObjectTreeViewdragDrop); Vector2 editVoxelHandPanelSize = new Vector2(panelSize.X * 1.4f, panelSize.Y); m_editVoxelHand = new MyGuiControlEditVoxelHand(m_parentScreen, panelPosition + editVoxelHandPanelSize / 2f, editVoxelHandPanelSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR); m_editorControls.Add(m_editVoxelHand); Vector2 editLightsSize = new Vector2(0.48f, 0.925f); m_editLights = new MyGuiControlEditLights(m_parentScreen, panelPosition + editLightsSize / 2, editLightsSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR); m_editorControls.Add(m_editLights); m_editLights.Visible = false; foreach (MyGuiControlBase control in m_editorControls) { control.DrawWhilePaused = false; } }
public MyGuiScreenEditorConnectPrefab() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.3f, 0.2f)) { Vector2 leftTop = -m_size.Value / 2f + new Vector2(0.025f, 0.025f); m_size = new Vector2(0.3f, 0.25f); MyGuiControlLabel label = new MyGuiControlLabel(this, leftTop, null, MyTextsWrapperEnum.ConnectEntityWithId, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); Controls.Add(label); leftTop.Y += label.GetSize().Value.Y + 0.025f; m_prefabIdTextbox = new MyGuiControlTextbox(this, leftTop + MyGuiConstants.TEXTBOX_SMALL_SIZE / 2f, MyGuiControlPreDefinedSize.SMALL, string.Empty, 10, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_prefabIdTextbox); Controls.Add(new MyGuiControlButton(this, new Vector2(0f, 0.05f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); OnEnterCallback += OnOkClickDelegate; }
void CreateControls(Vector2 controlsOrigin, Vector2 sliderOffset) { m_nameLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(0, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Name, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_nameTextBox = new MyGuiControlTextbox(this, controlsOrigin - new Vector2(-0.2f, 2 * CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, DummyPoint.Name ?? String.Empty, 512, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_nameTextBox.TextChanged = OnTextChange; Controls.Add(m_nameLabel); Controls.Add(m_nameTextBox); m_typeComboBox = new MyGuiControlCombobox(this, controlsOrigin - new Vector2(-0.25f, CONTROLS_DELTA.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_typeComboBox.AddItem(0, new StringBuilder("Box")); m_typeComboBox.AddItem(1, new StringBuilder("Sphere")); m_typeComboBox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_typeComboBox_OnSelect); Controls.Add(m_typeComboBox); MyGuiControlLabel typeLabel = new MyGuiControlLabel(this, controlsOrigin - new Vector2(-0.0f, CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Width, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); typeLabel.UpdateText("Type"); Controls.Add(typeLabel); float checkBoxOffset = 0.507f; //Enabled Controls.Add(new MyGuiControlLabel(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y), null, MyTextsWrapperEnum.Enabled, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_enabled = new MyGuiControlCheckbox(this, controlsOrigin - new Vector2(-checkBoxOffset, 2 * CONTROLS_DELTA.Y) + new Vector2(0.1f, 0f), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_enabled.OnCheck += OnEnabledChange; Controls.Add(m_enabled); // Active AddActivatedCheckbox(controlsOrigin - new Vector2(-checkBoxOffset, CONTROLS_DELTA.Y), DummyPoint.Activated); float sliderMax = 50000; //Width slider m_widthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f), new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Width), MyGuiSizeEnumFlags.All, sliderOffset.X); m_widthSize.OnValueChange += OnWidthChange; Controls.Add(m_widthSize); //Height slider m_heightSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 1 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Height), MyGuiSizeEnumFlags.All, sliderOffset.X); m_heightSize.OnValueChange += OnHeightChange; Controls.Add(m_heightSize); //Depth slider m_depthSize = new MyGuiControlSize(this, controlsOrigin + new Vector2(0.35f, 0f) + 2 * CONTROLS_DELTA, new Vector2(0.7f, MyGuiConstants.SLIDER_HEIGHT), Vector4.Zero, null, 0f, 0.1f, sliderMax, MyTextsWrapper.Get(MyTextsWrapperEnum.Depth), MyGuiSizeEnumFlags.All, sliderOffset.X); m_depthSize.OnValueChange += OnDepthChange; Controls.Add(m_depthSize); MyGuiControlLabel idLabel = new MyGuiControlLabel(this, controlsOrigin + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Depth, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(idLabel); idLabel.UpdateText("ID: " + m_entity.EntityId.ToString()); int controlsDelta = 4; // Flags m_colorArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta++ * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_colorArea.OnCheck += OnFlagChange; m_colorAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ColorArea, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_colorArea); Controls.Add(m_colorAreaLabel); m_playerStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_playerStart.OnCheck += OnPlayerStartFlagChange; m_playerStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerStart, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_playerStart); Controls.Add(m_playerStartLabel); m_mothershipStart = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_mothershipStart.OnCheck += OnMothershipStartFlagChange; m_mothershipStartLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.MothershipStart, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_mothershipStart); Controls.Add(m_mothershipStartLabel); m_detector = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_detector.OnCheck += OnFlagChange; m_detectorLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Detector, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_detector); Controls.Add(m_detectorLabel); m_sideMission = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_sideMission.OnCheck += OnFlagChange; m_sideMissionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SideMission, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_sideMission); Controls.Add(m_sideMissionLabel); m_particleEffect = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_particleEffect.OnCheck += OnFlagChange; m_particleEffectLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_particleEffectLabel); Controls.Add(m_particleEffect); m_respawnPoint = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_respawnPoint.OnCheck += OnFlagChange; m_respawnPointLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.RespawnPoint, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_respawnPointLabel); Controls.Add(m_respawnPoint); m_safeArea = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_safeArea.OnCheck += OnFlagChange; m_safeAreaLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SafeArea, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_safeArea); Controls.Add(m_safeAreaLabel); m_survivePrefabDestruction = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_survivePrefabDestruction.OnCheck += OnFlagChange; m_survivePrefabDestructionLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.SurvivePrefabDestruction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_survivePrefabDestructionLabel); Controls.Add(m_survivePrefabDestruction); m_textureQuad = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_textureQuad.OnCheck += OnFlagChange; m_textureQuadLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.TextureQuad, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_textureQuad); Controls.Add(m_textureQuadLabel); m_note = new MyGuiControlCheckbox(this, controlsOrigin + controlsDelta * CONTROLS_DELTA, false, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); m_note.OnCheck += OnFlagChange; m_noteLabel = new MyGuiControlLabel(this, controlsOrigin + new Vector2(MyGuiConstants.RADIOBUTTON_SIZE.X, 0.0f) + controlsDelta++ * CONTROLS_DELTA, null, MyTextsWrapperEnum.Note, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_note); Controls.Add(m_noteLabel); Vector2 columnOffset = new Vector2(0.15f, 0); Vector2 labelColumnOffset = new Vector2(0.18f, 0); // Red slider m_redSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Red, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_redSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_redSlider.OnChange = OnComponentChange; Controls.Add(m_redSliderLabel); Controls.Add(m_redSlider); // Green slider m_greenSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Green, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_greenSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 5 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_greenSlider.OnChange = OnComponentChange; Controls.Add(m_greenSliderLabel); Controls.Add(m_greenSlider); // Blue slider m_blueSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Blue, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_blueSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 6 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_blueSlider.OnChange = OnComponentChange; Controls.Add(m_blueSliderLabel); Controls.Add(m_blueSlider); // Alpha slider m_alphaSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 7 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Alpha, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_alphaSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 7 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, MyEditorConstants.COLOR_COMPONENT_MIN_VALUE, MyEditorConstants.COLOR_COMPONENT_MAX_VALUE, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_alphaSlider.OnChange = OnComponentChange; m_alphaSliderValueLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); // scale slider m_userScaleSliderLabel = new MyGuiControlLabel(this, labelColumnOffset + controlsOrigin + 8 * CONTROLS_DELTA, null, MyTextsWrapperEnum.UserScale, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_userScaleSlider = new MyGuiControlSlider(this, columnOffset + controlsOrigin + sliderOffset + 8 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0.01f, 3.9f, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_userScaleSlider.OnChange = OnComponentChange; m_userScaleLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 8 * CONTROLS_DELTA + new Vector2(0.4f, 0), null, new StringBuilder("0"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_alphaSliderLabel); Controls.Add(m_alphaSliderValueLabel); Controls.Add(m_alphaSlider); Controls.Add(m_userScaleSliderLabel); Controls.Add(m_userScaleSlider); Controls.Add(m_userScaleLabel); // Particle effect //m_particleNameLabel = new MyGuiControlLabel(this, columnOffset + controlsOrigin + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ParticleEffect, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_particleCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 9 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5, false, false, false); foreach (var p in MyParticlesLibrary.GetParticleEffects()) { m_particleCombo.AddItem(p.GetID(), new StringBuilder(p.Name)); m_particleCombo.SortItemsByValueText(); } m_particleCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_particleCombo_OnSelect); //Controls.Add(m_particleNameLabel); Controls.Add(m_particleCombo); m_respawnPointCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 10 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4); foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues) { MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue); m_respawnPointCombo.AddItem((int)enumValue, null, factionNationalityHelper.Description); } m_respawnPointCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_repawnPointCombo_OnSelect); Controls.Add(m_respawnPointCombo); m_secretCombo = new MyGuiControlCombobox(this, columnOffset + controlsOrigin + 7 * CONTROLS_DELTA + sliderOffset, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 4); m_secretCombo.AddItem(0, null, new StringBuilder("No secret")); foreach (var room in MySecretRooms.SecretRooms) { m_secretCombo.AddItem(room.Key, null, new StringBuilder(room.Value)); } m_secretCombo.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_secretCombo_OnSelect); Controls.Add(m_secretCombo); UpdateValues(); }
public MyGuiScreenRegister(MyGuiScreenBase openAfterSuccesfullRegistration, string login, string password) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_enableBackgroundFade = true; m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); m_size = new Vector2(1030f / 1600f, 897f / 1200f); m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration; // If user presses enter in any control, we call this method. It's default ENTER. this.OnEnterCallback = delegate { OnOkClick(null); }; Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.32f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f ); Vector2 checkboxControlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.35f, -m_size.Value.Y / 2.0f + 0.125f); AddCaption(MyTextsWrapperEnum.Registration, new Vector2(0, 0.005f)); // Choose a username Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseUsername, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_usernameTextbox); // Choose a password Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChoosePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD); Controls.Add(m_passwordTextbox); // Retype password Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RetypePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_retypePasswordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 2.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD); Controls.Add(m_retypePasswordTextbox); // Email address Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EmailAddress, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_emailTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 3.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.EMAIL_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_emailTextbox); // Send me newsletters Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f,0) + controlsOriginLeft) + 5.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SendNewsletters, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 5.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); //m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_sendNewslettersCheckbox); bool remember = MyConfig.RememberUsernameAndPassword; // Remember me Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f, 0) + controlsOriginLeft) + 6.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_rememberCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_rememberCheckbox); /* // Buttons APPLY and BACK Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f); Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); */ var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); var cancelButton = new MyGuiControlButton(this, new Vector2(0.1418f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(cancelButton); if (login != null) { m_usernameTextbox.Text = login; } if (password != null) { m_passwordTextbox.Text = password; m_retypePasswordTextbox.Text = password; } }
protected void AddIdTextBox(Vector2 position, uint value) { if (HasEntity() && MyFakes.ENABLE_ENTITY_ID_CHANGE) { Controls.Add(new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.EntityId, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_idTextbox = new MyGuiControlTextbox(this, position + new Vector2(0.2f, 0f), MyGuiControlPreDefinedSize.MEDIUM, Convert.ToString(value), 10, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_idTextbox); } }
public void InitControls() { StringBuilder otherSideInventoryName = new StringBuilder(); otherSideInventoryName.Append(string.IsNullOrEmpty(m_entity.DisplayName) ? m_entity.GetFriendlyName() : m_entity.DisplayName); otherSideInventoryName.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.OtherSideInventory)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 4f + 0.03f, 0.1f); Vector2 controlsOriginRight = new Vector2(+m_size.Value.X / 4f - 0.03f, 0.1f); List<MyGuiControlListbox> listboxesToDragAndDrop = new List<MyGuiControlListbox>(); m_allItemsInventoryListbox = new MyGuiControlListbox(this, controlsOriginLeft, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); AddInventoryListbox(m_allItemsInventoryListbox, m_allItemsInventory, ref listboxesToDragAndDrop); m_entityInventoryListbox = new MyGuiControlListbox(this, controlsOriginRight, MyGuiConstants.LISTBOX_SMALL_SIZE, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, COLUMNS, ROWS, COLUMNS, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 4, 2, MyGuiConstants.LISTBOX_ITEM_COLOR, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); AddInventoryListbox(m_entityInventoryListbox, EntityWithInventory.Inventory, ref listboxesToDragAndDrop); m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxesToDragAndDrop, MyGuiControlPreDefinedSize.SMALL, MyGuiConstants.LISTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, Vector2.Zero, true); m_dragAndDrop.ListboxItemDropped += DragAndDropListboxItemDropped; Controls.Add(m_dragAndDrop); Vector2 labelOffset = new Vector2(0.05f, -0.05f); Controls.Add(new MyGuiControlLabel(this, m_allItemsInventoryListbox.GetPosition() - m_allItemsInventoryListbox.GetSize().Value / 2f + labelOffset, null, MyTextsWrapperEnum.AllItemsInventory, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, m_entityInventoryListbox.GetPosition() - m_entityInventoryListbox.GetSize().Value / 2f + labelOffset, null, otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Vector2 otherSettingsPosition = new Vector2(-m_size.Value.X / 2f + 0.1f, -0.35f); Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.PriceCoeficient, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_priceCoeficientTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 3, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); m_priceCoeficientTextbox.Text = MyValueFormatter.GetFormatedFloat(EntityWithInventory.Inventory.PriceCoeficient, 2, string.Empty); Controls.Add(m_priceCoeficientTextbox); if (PrefabContainer != null) { otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA; Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.InventoryTemplates, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_inventoryTemplatesCombobox = new MyGuiControlCombobox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_inventoryTemplatesCombobox.OnSelect += new MyGuiControlCombobox.OnComboBoxSelectCallback(m_inventoryTemplatesCombobox_OnSelect); m_inventoryTemplatesCombobox.AddItem(0, MyTextsWrapperEnum.None); foreach (MyMwcInventoryTemplateTypeEnum inventoryTemplateType in MyGuiInventoryTemplateTypeHelpers.MyInventoryTemplateTypeValues) { if (MyInventoryTemplates.ContainsAnyItems(inventoryTemplateType)) { m_inventoryTemplatesCombobox.AddItem((int)inventoryTemplateType, MyGuiInventoryTemplateTypeHelpers.GetInventoryTemplateTypeHelper(inventoryTemplateType).Description); } } Controls.Add(m_inventoryTemplatesCombobox); otherSettingsPosition += MyGuiConstants.CONTROLS_DELTA; Controls.Add(new MyGuiControlLabel(this, otherSettingsPosition, null, MyTextsWrapperEnum.RefillTime, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_refillTimeTextbox = new MyGuiControlTextbox(this, otherSettingsPosition + new Vector2(0.5f, 0f), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, 9, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_refillTimeTextbox); RefillTime = PrefabContainer.RefillTime; SelectedTemplateType = EntityWithInventory.Inventory.TemplateType; } }
public MyGuiScreenJoinGame(MyGuiScreenBase closeAfterSuccessfulEnter, MyGameTypes gameTypeFilter) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f)) { m_size = new Vector2(0.95f, 0.85f); m_serverDisconnectedHandler = new ConnectionHandler(Static_ServerDisconnected); m_gameTypeFilter = gameTypeFilter; m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter; m_enableBackgroundFade = true; m_games = new List<MyGameExtendedInfo>(); AddCaption(MyTextsWrapperEnum.JoinGame, new Vector2(0, 0.0075f)); Vector2 menuPositionOrigin = new Vector2(-0.31f, -m_size.Value.Y / 2.0f + 0.15f); Vector2 buttonDelta = new Vector2(0.22f, 0); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.SearchGameToJoin, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); m_searchTextbox = new MyGuiControlTextbox(this, menuPositionOrigin + buttonDelta, MyGuiControlPreDefinedSize.LARGE, "", 40, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_searchTextbox.TextChanged += OnSearchTextChanged; Controls.Add(m_searchTextbox); menuPositionOrigin += new Vector2(0.395f, 0); var refreshButton = new MyGuiControlButton( this, menuPositionOrigin + buttonDelta, MyGuiConstants.BACK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Refresh, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnRefreshButtonClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true); Controls.Add(refreshButton); menuPositionOrigin.Y += 0.052f; menuPositionOrigin.X = -0.33f; var storyLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(storyLabel); menuPositionOrigin.X = -0.35f; m_storyCheck = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null); m_storyCheck.OnCheck = CheckChanged; Controls.Add(m_storyCheck); menuPositionOrigin.X = -0.2f; var deathLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Deathmatch, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(deathLabel); menuPositionOrigin.X = -0.22f; m_deathCheck = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null); m_deathCheck.OnCheck = CheckChanged; Controls.Add(m_deathCheck); //var storyButton = new MyGuiControlButton(this, menuPositionOrigin, null, Vector4.One, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, menuPositionOrigin.Y += 0.25f; menuPositionOrigin.X = 0; m_gameList = new MyGuiControlListbox(this, menuPositionOrigin, new Vector2(0.22f, 0.04f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, MyTextsWrapper.Get(MyTextsWrapperEnum.JoinGame), MyGuiConstants.LABEL_TEXT_SCALE, HeaderCount, 10, HeaderCount, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 2, 1, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f); m_gameList.ItemSelect += OnGamesItemSelect; m_gameList.DisplayHighlight = true; m_gameList.MultipleSelection = true; m_gameList.ItemDoubleClick += GameListOnItemDoubleClick; m_gameList.HighlightHeadline = true; m_gameList.EnableAllRowHighlightWhileMouseOver(true, true); m_gameList.SetCustomCollumnsWidths(new List<float>() { 0.15f, 0.30f, 0.15f, 0.10f }); Controls.Add(m_gameList); buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.06f); Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); AddHeaders(); }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.92f, 0.95f); // Add screen title AddCaption(); Vector2 originDelta = new Vector2(0.02f, 0); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta; Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize() + originDelta; // Decide if screen is for editing existing phys object or adding new if (HasEntity()) { //controlsOriginLeft.X += 0.5f * MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X; controlsOriginLeft.Y += 0.075f; //AddEditPositionControls(); AddVoxelMaterialCombobox( controlsOriginLeft + new Vector2(0.1f,-0.02f), controlsOriginLeft + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0) + 2 * CONTROLS_DELTA + new Vector2(0.1f,-0.065f), m_entity.VoxelMaterial); if (this.m_entity is MyVoxelMap) { Vector2 buttonDelta = new Vector2(-0.15f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.085f); Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.RemoveVoxels, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); buttonDelta.X = -buttonDelta.X; Controls.Add(new MyGuiControlButton(this, new Vector2(buttonDelta.X, buttonDelta.Y), new Vector2(0.25f, 0.0475f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.RemoveAllVoxelHands, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnClearVoxelHands, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); } Vector2 controlsColumn2OriginLabel = new Vector2(controlsOriginLeft.X + MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2 + MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X + 0.03f, -m_size.Value.Y / 2.0f + 0.04f); Vector2 controlsColumn2Origin = new Vector2(controlsColumn2OriginLabel.X + 0.02f, -m_size.Value.Y / 2.0f + 0.04f); m_positionX = new MyGuiControlTextbox(this, controlsColumn2Origin + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_positionY = new MyGuiControlTextbox(this, controlsColumn2Origin + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); m_positionZ = new MyGuiControlTextbox(this, controlsColumn2Origin + 5 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.X, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Y, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Z, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_positionX); Controls.Add(m_positionY); Controls.Add(m_positionZ); m_positionX.Text = m_entity.WorldMatrix.Translation.X.ToString(); m_positionY.Text = m_entity.WorldMatrix.Translation.Y.ToString(); m_positionZ.Text = m_entity.WorldMatrix.Translation.Z.ToString(); m_changeMaterial = new MyGuiControlCheckbox(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA + new Vector2(0.16f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(new MyGuiControlLabel(this, controlsColumn2OriginLabel + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChangeMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_changeMaterial); AddOkAndCancelButtonControls(); } else { #region Asteroid Type //choose asteroid type label //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA + new Vector2(0, -0.0f), null, MyTextsWrapperEnum.AsteroidType, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //COMBOBOX - asteroid type m_selectAsteroidTypeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(- controlsOriginRight.X, -0.045f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 2); foreach (MyGuiAsteroidTypesEnum enumValue in MyGuiAsteroidHelpers.MyGuiAsteroidTypeEnumValues) { MyGuiAsteroidHelper asteroidTypeHelper = MyGuiAsteroidHelpers.GetMyGuiAsteroidTypeHelper(enumValue); m_selectAsteroidTypeCombobox.AddItem((int)enumValue, null, asteroidTypeHelper.Description); } m_selectAsteroidTypeCombobox.SelectItemByKey(0); Controls.Add(m_selectAsteroidTypeCombobox); m_selectAsteroidTypeCombobox.OnSelect += OnComboboxAsteroidTypeSelect; #endregion ReloadControls(); AddOkAndCancelButtonControls(); } }
public MyGuiScreenLogin(string username, string password, MyGuiScreenBase openAfterSuccessfulLogin, bool simple = false) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_simple = simple; m_enableBackgroundFade = true; m_openAfterSuccessfulLogin = openAfterSuccessfulLogin; m_size = new Vector2(1030f / 1600f, 674 / 1200f); m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\LoginBackground", flags: TextureFlags.IgnoreQuality); // If user presses enter in any control, we call this method. It's default ENTER. this.OnEnterCallback = delegate { OnOkClick(null); }; Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.149f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.25f, -m_size.Value.Y / 2.0f + 0.149f); AddCaption(MyTextsWrapperEnum.Login); // Player name Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, username, MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_usernameTextbox); // Password Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Password, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), true, MyGuiConstants.LABEL_TEXT_COLOR); m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, password, MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_passwordTextbox); bool remember = MyConfig.RememberUsernameAndPassword; bool autologin = MyConfig.Autologin; m_hidePasswordCheckbox = new MyGuiControlCheckbox(this, new Vector2(0.1950f,-0.0793f), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); //m_hidePasswordCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight - 0.025f * Vector2.UnitX + MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_hidePasswordCheckbox); m_hidePasswordCheckbox.OnCheck = OnChangePasswordType; OnChangePasswordType(m_hidePasswordCheckbox); // Remember m_rememberCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); if (!m_simple) { Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_rememberCheckbox); } // Auto-login m_autologinCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 3.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, autologin, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); if (!m_simple) { Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Autologin, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); Controls.Add(m_autologinCheckbox); } // Buttons APPLY and BACK Vector2 buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f); var okButton = new MyGuiControlButton(this, new Vector2(-0.1861f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, Vector4.One, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); var cancelButton = new MyGuiControlButton(this, new Vector2(-0.0461f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, Vector4.One, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); var registerButton = new MyGuiControlButton(this, new Vector2(0.1924f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, Vector4.One, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Register, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnRegisterClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); Controls.Add(cancelButton); if (!m_simple) { Controls.Add(registerButton); } // Hide password Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2164f,-0.0793f), null, MyTextsWrapperEnum.HidePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); }
protected void AddEditPositionControls() { if (HasEntity()) { Controls.Add(new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + 0 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Position, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //TODO add support for textbox with numbers with floating point Controls.Add(new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.X, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_positionXTextBox = new MyGuiControlTextbox(this, (new Vector2(0.05f, 0) + GetControlsOriginLeftFromScreenSize()) + 1 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "0", MyMwcValidationConstants.POSITION_X_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_positionXTextBox); m_positionXTextBox.Text = Convert.ToInt32(m_entity.GetPosition().X).ToString(); Controls.Add(new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Y, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_positionYTextBox = new MyGuiControlTextbox(this, (new Vector2(0.05f, 0) + GetControlsOriginLeftFromScreenSize()) + 2 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "0", MyMwcValidationConstants.POSITION_X_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_positionYTextBox); m_positionYTextBox.Text = Convert.ToInt32(m_entity.GetPosition().Y).ToString(); Controls.Add(new MyGuiControlLabel(this, GetControlsOriginLeftFromScreenSize() + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Z, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_positionZTextBox = new MyGuiControlTextbox(this, (new Vector2(0.05f, 0) + GetControlsOriginLeftFromScreenSize()) + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "0", MyMwcValidationConstants.POSITION_X_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_positionZTextBox); m_positionZTextBox.Text = Convert.ToInt32(m_entity.GetPosition().Z).ToString(); } }
private void RecreateControls() { m_size = new Vector2(1100f / 1600f, 1200 / 1200f); Controls.Clear(); string prevName = MyConfig.LastFriendName; if (m_findPlayerName != null && m_findPlayerName.Text != null) { prevName = m_findPlayerName.Text; } AddCaption(MyTextsWrapperEnum.FriendsSectorMap, new Vector2(0, 0.04f)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.1f, -m_size.Value.Y / 2.0f + 0.1f); Vector2 controlsDelta = new Vector2(0, 0.0525f); // controls for typing friend name to search Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1f * controlsDelta, null, MyTextsWrapperEnum.FriendName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_findPlayerName = new MyGuiControlTextbox(this, controlsOriginLeft + 1f * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f + 0.15f, 0), MyGuiControlPreDefinedSize.MEDIUM, prevName, 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_findPlayerName); var searchButton = new MyGuiControlButton(this, m_findPlayerName.GetPosition() + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f - 0.0208f, 0), MyGuiConstants.SEARCH_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetButtonSearchTexture(), null, null, MyTextsWrapperEnum.Search, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.8f, MyGuiControlButtonTextAlignment.CENTERED, OnSearchClick, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true, true); Controls.Add(searchButton); // friend maps available for selection //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3* controlsDelta, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); if (m_sectorIdentifiers != null && m_userDetails != null && m_sectorIdentifiers.Count > 0) { m_mapsCombobox = new MyGuiControlListbox(this, new Vector2(0, -0.010f), new Vector2(0.43f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 1, 0, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0f, -0.01f, -0.01f, -0.02f, 0.02f); for (int i = 0; i < m_sectorIdentifiers.Count; i++) { MyMwcSectorIdentifier sectorIdentifier = m_sectorIdentifiers[i]; foreach (MyMwcUserDetail userDetail in m_userDetails) { if (sectorIdentifier.UserId.HasValue && sectorIdentifier.UserId.Value == userDetail.UserId) { if (string.IsNullOrEmpty(sectorIdentifier.SectorName)) { m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1}", userDetail.DisplayName, sectorIdentifier.Position.ToString())), null); } else { m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1} ({2})", userDetail.DisplayName, sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())), null); } } } } SortSectors(); m_mapsCombobox.ItemDoubleClick += OnItemDoubleClick; Controls.Add(m_mapsCombobox); } else { Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * controlsDelta + new Vector2(0.21f, 0), null, MyTextsWrapperEnum.NoSectorsAvailable, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } // Buttons OK and CANCEL var m_okButton = new MyGuiControlButton(this, new Vector2(-0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); m_findPlayerName.MoveCartrigeToEnd(); this.SetControlIndex(Controls.IndexOf(m_findPlayerName)); }
private void RecreateControls() { Controls.Clear(); AddCaption(new StringBuilder("Select Sector"), MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.04f, -m_size.Value.Y / 2.0f + 0.08f); Vector2 controlsDelta = new Vector2(0, 0.0525f); // controls for typing friend name to search Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * controlsDelta, null, MyTextsWrapperEnum.FriendName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_findPlayerName = new MyGuiControlTextbox(this, controlsOriginLeft + 2 * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_findPlayerName); // search button Controls.Add(new MyGuiControlButton(this, m_findPlayerName.GetPosition() + new Vector2(0.2f, 0), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Search, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSearchClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); // friend maps available for selection Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * controlsDelta, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); if (m_sectorIdentifiers != null && m_userDetails != null) { m_mapsCombobox = new MyGuiControlCombobox(this, controlsOriginLeft + 5 * controlsDelta + new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); for (int i = 0; i < m_sectorIdentifiers.Count; i++) { MyMwcSectorIdentifier sectorIdentifier = m_sectorIdentifiers[i]; if (!sectorIdentifier.UserId.HasValue) { AddSectorToCombo(sectorIdentifier, i, "STORY"); } else { foreach (MyMwcUserDetail userDetail in m_userDetails) { if (sectorIdentifier.UserId.HasValue && sectorIdentifier.UserId.Value == userDetail.UserId) { AddSectorToCombo(sectorIdentifier, i, userDetail.DisplayName); } } } } SortSectors(); m_mapsCombobox.SelectItemByIndex(0); Controls.Add(m_mapsCombobox); } else { Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 5 * controlsDelta, null, MyTextsWrapperEnum.NoSectorsAvailable, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } // Buttons OK and CANCEL Vector2 buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f); if (m_mapsCombobox != null) { Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); } else { Controls.Add(new MyGuiControlButton(this, new Vector2(0, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); } }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.97f, 0.85f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + new Vector2(0.04f, 0); m_bots = new Dictionary<int, BotTemplate>(); // Add screen title AddCaption(new Vector2(0, 0.028f)); //Faction Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_selectShipFactionCombobox = new MyGuiControlCombobox(this, (new Vector2(0.31f, 0)) + controlsOriginLeft + 1 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues) { MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue); m_selectShipFactionCombobox.AddItem((int)enumValue, null, factionNationalityHelper.Description); } m_selectShipFactionCombobox.SelectItemByKey((int)MyMwcObjectBuilder_FactionEnum.China);//hopefuly china Controls.Add(m_selectShipFactionCombobox); //radius slider Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_radiusSlider = new MyGuiControlSlider(this, (new Vector2(0.25f, 0) + controlsOriginLeft) + 2 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 15, 200, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_radiusSlider.SetNormalizedValue(0.2f); m_radiusSlider.OnChange = OnComponentChange; Controls.Add(m_radiusSlider); Controls.Add(m_radiusLabel = new MyGuiControlLabel(this, new Vector2(m_radiusSlider.GetPosition().X + m_radiusSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Radius, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //first spawn timer Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.FirstSpawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_firstSpawnTimeSlider = new MyGuiControlSlider(this, (new Vector2(0.25f, 0) + controlsOriginLeft) + 3 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_firstSpawnTimeSlider.OnChange = OnComponentChange; m_firstSpawnTimeSlider.SetNormalizedValue(0.0f); Controls.Add(m_firstSpawnTimeSlider); Controls.Add(m_firstSpawnLabel = new MyGuiControlLabel(this, new Vector2(m_firstSpawnTimeSlider.GetPosition().X + m_firstSpawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //respawn timer Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_respawnTimeSlider = new MyGuiControlSlider(this, controlsOriginLeft + new Vector2(0.25f, 0) + 4 * CONTROLS_DELTA, MyGuiConstants.SLIDER_WIDTH, 0, 10 * 60 * 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_respawnTimeSlider.OnChange = OnComponentChange; m_respawnTimeSlider.SetNormalizedValue(0.0f); Controls.Add(m_respawnTimeSlider); Controls.Add(m_respawnLabel = new MyGuiControlLabel(this, new Vector2(m_respawnTimeSlider.GetPosition().X + m_respawnTimeSlider.GetSize().Value.X / 2 + 0.01f, controlsOriginLeft.Y) + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Respawn, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //waypoints Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.WayPointPath, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_waypointPathCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 5 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); int k = 0; int selected = 0; m_waypointPathCombobox.AddItem(k++, null, MyTextsWrapper.Get(MyTextsWrapperEnum.None)); foreach (var path in MyWayPointGraph.StoredPaths) { if (HasEntity() && String.Compare(path.Name, m_spawnPoint.GetWaypointPath()) == 0) { selected = k; } m_waypointPathCombobox.AddItem(k++, null, new StringBuilder(path.Name)); } m_waypointPathCombobox.SelectItemByKey(selected);// Controls.Add(m_waypointPathCombobox); // patrol mode Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.PatrolMode, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_patrolModeCombobox = new MyGuiControlCombobox(this, new Vector2(0.31f, 0) + controlsOriginLeft + 6 * CONTROLS_DELTA, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 8); foreach (MyPatrolMode enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_PatrolModes) { MyGuiHelperBase patrolModeHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipPatrolMode(enumValue); m_patrolModeCombobox.AddItem((int)enumValue, null, patrolModeHelper.Description); } m_patrolModeCombobox.SelectItemByKey(HasEntity() ? (int)m_spawnPoint.PatrolMode : 0); Controls.Add(m_patrolModeCombobox); #region Smallship Bots To Spawn //MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 6 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); //Controls.Add(smallShipLabel); m_selectShipsListbox = new MyGuiControlListbox(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_LARGE_SIZE.X / 2.0f + MyGuiConstants.LISTBOX_SCROLLBAR_WIDTH / 2.0f, MyGuiConstants.COMBOBOX_LARGE_SIZE.Y * 2.5f), MyGuiConstants.LISTBOX_LONGMEDIUM_SIZE, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, false, true, false); //m_selectShipsListbox.ItemSelect = OnItemSelect; m_selectShipsListbox.ItemDoubleClick += OnDoubleClick; Controls.Add(m_selectShipsListbox); Vector2 columnOriginLeft = new Vector2(0.178f, controlsOriginLeft.Y); Vector2 controlsOriginRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, controlsOriginLeft.Y); // Activated Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Active, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_activeCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_activeCheckbox); // Spawn in groups Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnInGroups, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spawnInGroupsCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2 * MyGuiConstants.CONTROLS_DELTA - new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.02f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_spawnInGroupsCheckbox); Controls.Add(new MyGuiControlLabel(this, columnOriginLeft + 3 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SpawnedBots, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_spawnedBotsTextbox = new MyGuiControlTextbox(this, columnOriginLeft + 4 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2 - 0.01f, 0), MyGuiControlPreDefinedSize.MEDIUM, string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_spawnedBotsTextbox); #endregion #region Bots Listbox Buttons Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 7 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Add, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAddClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 8 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEditClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 9 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Inventory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInventoryClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Copy, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDuplicateClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 11 * CONTROLS_DELTA + new Vector2(0.77f, -0.005f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Delete, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDeleteClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); #endregion AddOkAndCancelButtonControls(new Vector2(0, -0.038f)); if (HasEntity()) { m_radiusSlider.SetValue( m_spawnPoint.BoundingSphereRadius ); m_spawnInGroupsCheckbox.Checked = m_spawnPoint.SpawnInGroups; m_spawnedBotsTextbox.Text = m_spawnPoint.LeftToSpawn >= 0 ? m_spawnPoint.LeftToSpawn.ToString() : string.Empty; m_firstSpawnTimeSlider.SetValue(m_spawnPoint.FirstSpawnTimer); m_respawnTimeSlider.SetValue(m_spawnPoint.RespawnTimer); m_selectShipFactionCombobox.SelectItemByKey((int)m_spawnPoint.Faction); m_bots.Clear(); foreach (BotTemplate bt in m_spawnPoint.GetBotTemplates()) { if (bt.m_builder.ShipTemplateID != null) { AddBot(bt.m_builder, MySmallShipTemplates.GetTemplate(bt.m_builder.ShipTemplateID.Value)); } else { AddBot(bt.m_builder); } } m_activeCheckbox.Checked = m_spawnPoint.IsActive(); } // Just UI update OnComponentChange(null); }
private void InitControls() { Controls.Clear(); string entityName; if (m_entities.Count == 1) { entityName = "(" + m_entities[0].GetFriendlyName() + ")"; } else { entityName = "(Mutliedit)"; } Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, -m_size.Value.Y / 2f + 0.063f), null, new StringBuilder(entityName), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); Vector2 controlsStartPosition = new Vector2(-m_size.Value.X / 2f + 0.05f, -m_size.Value.Y / 2f + 0.12f); Vector2 labelPosition = controlsStartPosition; Vector2 controlPosition = controlsStartPosition + new Vector2(0.4f, 0f); Vector4 notSameColor = Color.Red.ToVector4(); // name if ((m_editPropertiesFlags & MyEditPropertyEnum.Name) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Name, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Name]); m_name = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.Name != null ? m_editProperties.Name : string.Empty, TEXTBOX_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_name); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // display name if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayName) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.DisplayName, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayName]); m_displayName = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.DisplayName != null ? m_editProperties.DisplayName : string.Empty, TEXTBOX_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_displayName); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // display hud if ((m_editPropertiesFlags & MyEditPropertyEnum.DisplayHud) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.DisplayHud, m_editPropertiesNotSame[(int)MyEditPropertyEnum.DisplayHud]); m_displayHud = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.DisplayHud, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_displayHud); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // difficulty if ((m_editPropertiesFlags ^ MyEditPropertyEnum.Difficulty) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.ActivatedUpToDifficulty, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Difficulty]); m_difficulty = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.EASY, MyTextsWrapperEnum.DifficultyEasy); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.NORMAL, MyTextsWrapperEnum.DifficultyNormal); m_difficulty.AddItem((int)MyGameplayDifficultyEnum.HARD, MyTextsWrapperEnum.DifficultyHard); m_difficulty.SelectItemByKey((int)m_editProperties.Difficulty); Controls.Add(m_difficulty); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // faction if ((m_editPropertiesFlags & MyEditPropertyEnum.Faction) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Faction, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Faction]); m_faction = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); foreach (MyMwcObjectBuilder_FactionEnum faction in Enum.GetValues(typeof(MyMwcObjectBuilder_FactionEnum))) { MyGuiHelperBase factionHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(faction); m_faction.AddItem((int)faction, factionHelper.Description); } m_faction.SelectItemByKey((int)m_editProperties.Faction); Controls.Add(m_faction); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // health if ((m_editPropertiesFlags & MyEditPropertyEnum.HealthRatio) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.HealthPercentage, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]); m_healthPercentage = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.HealthRatio != null ? GetFormatedFloat( m_editProperties.HealthRatio.Value * 100f) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_healthPercentage); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; AddLabel(labelPosition, MyTextsWrapperEnum.Health, m_editPropertiesNotSame[(int)MyEditPropertyEnum.HealthRatio]); m_health = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.HealthRatio != null && m_editProperties.MaxHealth != null ? GetFormatedFloat( m_editProperties.HealthRatio.Value * m_editProperties.MaxHealth.Value) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_health); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; m_healthPercentage.TextChanged -= HealthChanged; m_healthPercentage.TextChanged += HealthChanged; m_health.TextChanged -= HealthChanged; m_health.TextChanged += HealthChanged; } // maxhealth if ((m_editPropertiesFlags & MyEditPropertyEnum.MaxHealth) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.MaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.MaxHealth]); m_maxHealth = new MyGuiControlTextbox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, m_editProperties.MaxHealth != null ? GetFormatedFloat( m_editProperties.MaxHealth.Value) : string.Empty, TEXTBOX_NUMBERS_MAX_LENGTH, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.DIGITS_ONLY); Controls.Add(m_maxHealth); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; m_maxHealth.TextChanged -= HealthChanged; m_maxHealth.TextChanged += HealthChanged; } // prefab kinematic parts health and max health if ((m_editPropertiesFlags & MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.EditPrefabKinematicPartsHealthAndMaxHealth, m_editPropertiesNotSame[(int)MyEditPropertyEnum.KinematicPartsHealthAndMaxHealth]); m_kinematicPartsHealthAndMaxHealth = new MyGuiControlButton(this, controlPosition + new Vector2(0.1f, 0f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Edit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEditPrefabKinematicPartsHealthAndMaxHealthClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true); Controls.Add(m_kinematicPartsHealthAndMaxHealth); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // indestructible if ((m_editPropertiesFlags & MyEditPropertyEnum.Indestructible) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Indestructible, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Indestructible]); m_indestructible = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsIndestructible, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_indestructible.OnCheck -= OnIndestructibleChecked; m_indestructible.OnCheck += OnIndestructibleChecked; Controls.Add(m_indestructible); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // change faction appearance if ((m_editPropertiesFlags & MyEditPropertyEnum.FactionAppearance) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.PrefabMaterials, false); m_appearance = new MyGuiControlCombobox(this, controlPosition, MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); foreach (MyMwcObjectBuilder_Prefab_AppearanceEnum factionAppearance in MyGuiPrefabHelpers.MyMwcFactionTextureEnumValues) { m_appearance.AddItem((int)factionAppearance, MyGuiPrefabHelpers.GetFactionName(factionAppearance)); } Controls.Add(m_appearance); Controls.Add(new MyGuiControlButton( this, controlPosition + new Vector2(.2f, 0), MyGuiConstants.BACK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnChangeAppearanceClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // Requires energy if ((m_editPropertiesFlags & MyEditPropertyEnum.RequiresEnergy) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.RequiresEnergy, m_editPropertiesNotSame[(int)MyEditPropertyEnum.RequiresEnergy]); m_requiresEnergyCheckbox = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.RequiresEnergy.Value, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); //m_requiresEnergyCheckbox.OnCheck -= OnRequiresEnergyChecked; //m_requiresEnergyCheckbox.OnCheck += OnRequiresEnergyChecked; Controls.Add(m_requiresEnergyCheckbox); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } // use properties if ((m_editPropertiesFlags & MyEditPropertyEnum.UseProperties) != 0) { m_useProperties = new MyGuiControlUseProperties(this, controlPosition, m_editProperties.UseProperties, m_editPropertiesNotSame[(int)MyEditPropertyEnum.UseProperties] ? new Vector4(1f, 0f, 0f, 1f) : MyGuiConstants.LABEL_TEXT_COLOR); Vector2 usePropertiesSize = m_useProperties.GetSize().Value; m_useProperties.SetPosition(labelPosition + usePropertiesSize / 2f); Controls.Add(m_useProperties); labelPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA; controlPosition += new Vector2(0f, usePropertiesSize.Y) + MyGuiConstants.CONTROLS_DELTA; } // Activated /* //Temporary disabled because there is no way how to select invisible object if ((m_editPropertiesFlags & MyEditPropertyEnum.Activated) != 0) { AddLabel(labelPosition, MyTextsWrapperEnum.Active, m_editPropertiesNotSame[(int)MyEditPropertyEnum.Activated]); m_activated = new MyGuiControlCheckbox(this, controlPosition, m_editProperties.IsActivated, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_activated.OnCheck -= OnActivatedChecked; m_activated.OnCheck += OnActivatedChecked; Controls.Add(m_activated); labelPosition += MyGuiConstants.CONTROLS_DELTA; controlPosition += MyGuiConstants.CONTROLS_DELTA; } */ foreach (var notSameFlag in m_editPropertiesNotSame) { if (notSameFlag) { Controls.Add(new MyGuiControlLabel(this, new Vector2(-m_size.Value.X / 2f + 0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f + 0.03f), null, MyTextsWrapperEnum.RedColoredPropertiesAreNotSame, new Vector4(1f, 0f, 0f, 1f), MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); break; } } AddOkAndCancelButtonControls(new Vector2(0, 0.0f)); }