private void AddBlueprintClassButton(MyBlueprintClassDefinition classDef, ref float xOffset, bool selected = false) { Debug.Assert(classDef != null); if (classDef == null) { return; } var test = new MyGuiControlRadioButton( position: m_blueprintsLabel.Position + new Vector2(xOffset, m_blueprintsLabel.Size.Y), size: new Vector2(46f, 46f) / MyGuiConstants.GUI_OPTIMAL_SIZE ); xOffset += test.Size.X; test.Icon = new MyGuiHighlightTexture() { Normal = classDef.Icon, Highlight = classDef.HighlightIcon, SizePx = new Vector2(46f, 46f) }; test.UserData = classDef; test.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; if (classDef.DisplayNameEnum.HasValue) { test.SetToolTip(classDef.DisplayNameEnum.Value); } else { test.SetToolTip(classDef.DisplayNameString); } m_blueprintButtonGroup.Add(test); m_controlsParent.Controls.Add(test); test.Selected = selected; }
private void OnGridSizeSmallSelected(MyGuiControlRadioButton obj) { if (MyCubeBuilder.Static == null) { return; } if (obj.Selected) { MyCubeBuilder.Static.CubeBuilderState.SetCubeSize(MyCubeSize.Small); } this.UpdateGridControl(); }
public void Close() { foreach (var system in m_registeredConveyorSystems) { system.BlockAdded -= ConveyorSystem_BlockAdded; system.BlockRemoved -= ConveyorSystem_BlockRemoved; } m_registeredConveyorSystems.Clear(); m_leftTypeGroup.Clear(); m_leftFilterGroup.Clear(); m_rightTypeGroup.Clear(); m_rightFilterGroup.Clear(); m_controlsDisabledWhileDragged.Clear(); m_leftOwnersControl = null; m_leftSuitButton = null; m_leftGridButton = null; m_leftFilterStorageButton = null; m_leftFilterSystemButton = null; m_leftFilterEnergyButton = null; m_leftFilterAllButton = null; m_rightOwnersControl = null; m_rightSuitButton = null; m_rightGridButton = null; m_rightFilterStorageButton = null; m_rightFilterSystemButton = null; m_rightFilterEnergyButton = null; m_rightFilterAllButton = null; m_throwOutButton = null; m_dragAndDrop = null; m_dragAndDropInfo = null; m_focusedOwnerControl = null; m_focusedGridControl = null; m_selectedInventory = null; m_hideEmptyLeft.IsCheckedChanged -= HideEmptyLeft_Checked; m_hideEmptyRight.IsCheckedChanged -= HideEmptyRight_Checked; m_blockSearchLeft.TextChanged -= BlockSearchLeft_TextChanged; m_blockSearchClearLeft.ButtonClicked -= BlockSearchClearLeft_ButtonClicked; m_blockSearchRight.TextChanged -= BlockSearchRight_TextChanged; m_blockSearchClearRight.ButtonClicked -= BlockSearchClearRight_ButtonClicked; m_hideEmptyLeft = null; m_hideEmptyLeftLabel = null; m_hideEmptyRight = null; m_hideEmptyRightLabel = null; m_blockSearchLeft = null; m_blockSearchClearLeft = null; m_blockSearchRight = null; m_blockSearchClearRight = null; }
public void Init(IMyGuiControlsParent controlsParent, MyEntity thisEntity, MyEntity interactedEntity, MyGridColorHelper colorHelper) { ProfilerShort.Begin("MyGuiScreenTerminal.ControllerInventory.Init"); m_userAsEntity = thisEntity; m_interactedAsEntity = interactedEntity; m_colorHelper = colorHelper; m_leftOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("LeftInventory"); m_rightOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("RightInventory"); m_leftSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftSuitButton"); m_leftGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftGridButton"); m_leftFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterStorageButton"); m_leftFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterSystemButton"); m_leftFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterEnergyButton"); m_leftFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterAllButton"); m_rightSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightSuitButton"); m_rightGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightGridButton"); m_rightFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterStorageButton"); m_rightFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterSystemButton"); m_rightFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterEnergyButton"); m_rightFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterAllButton"); m_throwOutButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("ThrowOutButton"); m_hideEmptyLeft = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyLeft"); m_hideEmptyLeftLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyLeft"); m_hideEmptyRight = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyRight"); m_hideEmptyRightLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyRight"); m_blockSearchLeft = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchLeft"); m_blockSearchClearLeft = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearLeft"); m_blockSearchRight = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchRight"); m_blockSearchClearRight = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearRight"); m_hideEmptyLeft.Visible = false; m_hideEmptyLeftLabel.Visible = false; m_hideEmptyRight.Visible = true; m_hideEmptyRightLabel.Visible = true; m_blockSearchLeft.Visible = false; m_blockSearchClearLeft.Visible = false; m_blockSearchRight.Visible = true; m_blockSearchClearRight.Visible = true; m_hideEmptyLeft.IsCheckedChanged += HideEmptyLeft_Checked; m_hideEmptyRight.IsCheckedChanged += HideEmptyRight_Checked; m_blockSearchLeft.TextChanged += BlockSearchLeft_TextChanged; m_blockSearchClearLeft.ButtonClicked += BlockSearchClearLeft_ButtonClicked; m_blockSearchRight.TextChanged += BlockSearchRight_TextChanged; m_blockSearchClearRight.ButtonClicked += BlockSearchClearRight_ButtonClicked; m_leftSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowCharacter); m_leftGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected); m_rightSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowInteracted); m_rightGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected); m_leftFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll); m_leftFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy); m_leftFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage); m_leftFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem); m_rightFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll); m_rightFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy); m_rightFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage); m_rightFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem); m_throwOutButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ThrowOut); m_throwOutButton.CueEnum = GuiSounds.None; m_leftTypeGroup.Add(m_leftSuitButton); m_leftTypeGroup.Add(m_leftGridButton); m_rightTypeGroup.Add(m_rightSuitButton); m_rightTypeGroup.Add(m_rightGridButton); m_leftFilterGroup.Add(m_leftFilterAllButton); m_leftFilterGroup.Add(m_leftFilterEnergyButton); m_leftFilterGroup.Add(m_leftFilterStorageButton); m_leftFilterGroup.Add(m_leftFilterSystemButton); m_rightFilterGroup.Add(m_rightFilterAllButton); m_rightFilterGroup.Add(m_rightFilterEnergyButton); m_rightFilterGroup.Add(m_rightFilterStorageButton); m_rightFilterGroup.Add(m_rightFilterSystemButton); m_throwOutButton.DrawCrossTextureWhenDisabled = false; //m_throwOutButton.Enabled = false; // initialize drag and drop // maybe this requires screen? m_dragAndDrop = new MyGuiControlGridDragAndDrop(MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR, MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR, 0.7f, MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true); controlsParent.Controls.Add(m_dragAndDrop); m_dragAndDrop.DrawBackgroundTexture = false; m_throwOutButton.ButtonClicked += throwOutButton_OnButtonClick; m_dragAndDrop.ItemDropped += dragDrop_OnItemDropped; var thisInventoryOwner = (m_userAsEntity != null && m_userAsEntity.HasInventory) ? m_userAsEntity : null; if (thisInventoryOwner != null) m_userAsOwner = thisInventoryOwner; var targetInventoryOwner = (m_interactedAsEntity != null && m_interactedAsEntity.HasInventory) ? m_interactedAsEntity : null; if (targetInventoryOwner != null) m_interactedAsOwner = targetInventoryOwner; var parentGrid = (m_interactedAsEntity != null) ? m_interactedAsEntity.Parent as MyCubeGrid : null; m_interactedGridOwners.Clear(); if (parentGrid != null) { var group = MyCubeGridGroups.Static.Logical.GetGroup(parentGrid); foreach (var node in group.Nodes) { GetGridInventories(node.NodeData, m_interactedGridOwners); node.NodeData.GridSystems.ConveyorSystem.BlockAdded += ConveyorSystem_BlockAdded; node.NodeData.GridSystems.ConveyorSystem.BlockRemoved += ConveyorSystem_BlockRemoved; m_registeredConveyorSystems.Add(node.NodeData.GridSystems.ConveyorSystem); } } m_leftTypeGroup.SelectedIndex = 0; m_rightTypeGroup.SelectedIndex = (m_interactedAsEntity is MyCharacter) || (m_interactedAsEntity is MyInventoryBagEntity) ? 0 : 1; m_leftFilterGroup.SelectedIndex = 0; m_rightFilterGroup.SelectedIndex = 0; LeftTypeGroup_SelectedChanged(m_leftTypeGroup); RightTypeGroup_SelectedChanged(m_rightTypeGroup); SetLeftFilter(null); SetRightFilter(null); m_leftTypeGroup.SelectedChanged += LeftTypeGroup_SelectedChanged; m_rightTypeGroup.SelectedChanged += RightTypeGroup_SelectedChanged; m_leftFilterAllButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(null); }; m_leftFilterEnergyButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.Energy); }; m_leftFilterStorageButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.Storage); }; m_leftFilterSystemButton.SelectedChanged += (button) => { if (button.Selected) SetLeftFilter(MyInventoryOwnerTypeEnum.System); }; m_rightFilterAllButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(null); }; m_rightFilterEnergyButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.Energy); }; m_rightFilterStorageButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.Storage); }; m_rightFilterSystemButton.SelectedChanged += (button) => { if (button.Selected) SetRightFilter(MyInventoryOwnerTypeEnum.System); }; if (m_interactedAsEntity == null) { m_leftGridButton.Enabled = false; m_rightGridButton.Enabled = false; m_rightTypeGroup.SelectedIndex = 0; } RefreshSelectedInventoryItem(); ProfilerShort.End(); }
private void AddBlueprintClassButton(MyBlueprintClassDefinition classDef, ref float xOffset, bool selected = false) { Debug.Assert(classDef != null); if (classDef == null) return; var test = new MyGuiControlRadioButton( position: m_blueprintsLabel.Position + new Vector2(xOffset, m_blueprintsLabel.Size.Y), size: new Vector2(46f, 46f) / MyGuiConstants.GUI_OPTIMAL_SIZE ); xOffset += test.Size.X; test.Icon = new MyGuiHighlightTexture() { Normal = classDef.Icon, Highlight = classDef.HighlightIcon, SizePx = new Vector2(46f, 46f) }; test.UserData = classDef; test.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; if (classDef.DisplayNameEnum.HasValue) test.SetToolTip(classDef.DisplayNameEnum.Value); else test.SetToolTip(classDef.DisplayNameString); m_blueprintButtonGroup.Add(test); m_controlsParent.Controls.Add(test); test.Selected = selected; }
private void CreateInventoryPageControls(MyGuiControlTabPage page) { page.Name = "PageInventory"; page.TextEnum = MySpaceTexts.Inventory; page.TextScale = 0.9f; #region Left radio buttons var leftRadioCharacter = new MyGuiControlRadioButton() { Position = new Vector2(-0.465f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "LeftSuitButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterCharacter }; var leftRadioGrid = new MyGuiControlRadioButton() { Position = new Vector2(-0.405f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "LeftGridButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterGrid }; var leftRadioStorage = new MyGuiControlRadioButton() { Position = new Vector2(-0.175f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterStorageButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterStorage }; var leftRadioSystem = new MyGuiControlRadioButton() { Position = new Vector2(-0.125f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterSystemButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterSystem }; var leftRadioEnergy = new MyGuiControlRadioButton() { Position = new Vector2(-0.075f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterEnergyButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterEnergy }; var leftRadioAll = new MyGuiControlRadioButton() { Position = new Vector2(-0.025f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "LeftFilterAllButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterAll }; #endregion #region Left search filters var blockSearchLeft = new MyGuiControlTextbox() { Position = new Vector2(-0.465f, -0.283f), Size = new Vector2(0.288f, 0.052f), Name = "BlockSearchLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER }; var blockSearchClearLeft = new MyGuiControlButton() { Position = new Vector2(-0.2f, -0.283f), Size = new Vector2(0.045f, 0.05666667f), Name = "BlockSearchClearLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; var hideEmptyLeft = new MyGuiControlCheckbox() { Position = new Vector2(-0.025f, -0.283f), Name = "CheckboxHideEmptyLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER }; var hideEmptyLeftLabel = new MyGuiControlLabel() { Position = new Vector2(-0.155f, -0.283f), Name = "LabelHideEmptyLeft", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.HideEmpty }; #endregion var leftList = new MyGuiControlList() { Position = new Vector2(-0.465f, -0.26f), Size = new Vector2(0.44f, 0.616f), Name = "LeftInventory", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; page.Controls.Add(leftRadioCharacter); page.Controls.Add(leftRadioGrid); page.Controls.Add(leftRadioStorage); page.Controls.Add(leftRadioSystem); page.Controls.Add(leftRadioEnergy); page.Controls.Add(leftRadioAll); page.Controls.Add(blockSearchLeft); page.Controls.Add(blockSearchClearLeft); page.Controls.Add(hideEmptyLeft); page.Controls.Add(hideEmptyLeftLabel); page.Controls.Add(leftList); #region Right radio buttons var rightRadioCharacter = new MyGuiControlRadioButton() { Position = new Vector2(0.025f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "RightSuitButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterCharacter }; var rightRadioGrid = new MyGuiControlRadioButton() { Position = new Vector2(0.085f, -0.36f), Size = new Vector2(0.056875f, 0.0575f), Name = "RightGridButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterGrid }; var rightRadioStorage = new MyGuiControlRadioButton() { Position = new Vector2(0.315f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterStorageButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterStorage }; var rightRadioSystem = new MyGuiControlRadioButton() { Position = new Vector2(0.365f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterSystemButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterSystem }; var rightRadioEnergy = new MyGuiControlRadioButton() { Position = new Vector2(0.415f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterEnergyButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterEnergy }; var rightRadioAll = new MyGuiControlRadioButton() { Position = new Vector2(0.465f, -0.36f), Size = new Vector2(0.045f, 0.05666667f), Name = "RightFilterAllButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, Key = 0, VisualStyle = MyGuiControlRadioButtonStyleEnum.FilterAll }; #endregion #region Right search filters var blockSearchRight = new MyGuiControlTextbox() { Position = new Vector2(0.025f, -0.283f), Size = new Vector2(0.288f, 0.052f), Name = "BlockSearchRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, }; var blockSearchClearRight = new MyGuiControlButton() { Position = new Vector2(0.29f, -0.283f), Size = new Vector2(0.045f, 0.05666667f), Name = "BlockSearchClearRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, VisualStyle = MyGuiControlButtonStyleEnum.Close, ActivateOnMouseRelease = true }; var hideEmptyRight = new MyGuiControlCheckbox() { Position = new Vector2(0.465f, -0.283f), Name = "CheckboxHideEmptyRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER }; var hideEmptyRightLabel = new MyGuiControlLabel() { Position = new Vector2(0.335f, -0.283f), Name = "LabelHideEmptyRight", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextEnum = MySpaceTexts.HideEmpty }; #endregion var rightList = new MyGuiControlList() { Position = new Vector2(0.465f, -0.295f), Size = new Vector2(0.44f, 0.65f), Name = "RightInventory", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP }; page.Controls.Add(rightRadioCharacter); page.Controls.Add(rightRadioGrid); page.Controls.Add(rightRadioStorage); page.Controls.Add(rightRadioSystem); page.Controls.Add(rightRadioEnergy); page.Controls.Add(rightRadioAll); page.Controls.Add(blockSearchRight); page.Controls.Add(blockSearchClearRight); page.Controls.Add(hideEmptyRight); page.Controls.Add(hideEmptyRightLabel); page.Controls.Add(rightList); var trash = new MyGuiControlButton() { Position = new Vector2(0f, 0.355f), Size = new Vector2(0.044375f, 0.13666667f), Name = "ThrowOutButton", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM, TextEnum = MySpaceTexts.Afterburner, TextScale = 0f, TextAlignment = 0f, DrawCrossTextureWhenDisabled = true, VisualStyle = MyGuiControlButtonStyleEnum.InventoryTrash, ActivateOnMouseRelease = true }; page.Controls.Add(trash); }
private void CreateProductionPageControls(MyGuiControlTabPage productionPage) { productionPage.Name = "PageProduction"; productionPage.TextEnum = MySpaceTexts.TerminalTab_Production; float columnSpacing = 0.03f; float controlSpacing = 0.01f; float smallBackgroundPanelHeight = 0.05f; float largeBackgroundPanelHeight = 0.08f; var assemblersCombobox = new MyGuiControlCombobox( position: -0.5f * productionPage.Size + new Vector2(0f, controlSpacing)) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Name = "AssemblersCombobox" }; var blueprintsBackgroundPanel = new MyGuiControlPanel( position: assemblersCombobox.Position + new Vector2(0f, assemblersCombobox.Size.Y + controlSpacing), size: new Vector2(1f, largeBackgroundPanelHeight), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, Name = "BlueprintsBackgroundPanel", }; var blueprintsLabel = new MyGuiControlLabel( position: blueprintsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Blueprints), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { Name = "BlueprintsLabel" }; var blueprintsGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = MyTerminalProductionController.BLUEPRINT_GRID_ROWS, ColumnsCount = 4, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var blueprintsScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: blueprintsGrid) { Name = "BlueprintsScrollableArea", ScrollbarVEnabled = true, Position = blueprintsBackgroundPanel.Position + new Vector2(0f, blueprintsBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, Size = new Vector2(blueprintsBackgroundPanel.Size.X, 0.5f), ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; blueprintsScrollableArea.FitSizeToScrolledControl(); assemblersCombobox.Size = new Vector2(blueprintsScrollableArea.Size.X, assemblersCombobox.Size.Y); blueprintsBackgroundPanel.Size = new Vector2(blueprintsScrollableArea.Size.X, largeBackgroundPanelHeight); blueprintsGrid.RowsCount = 20; productionPage.Controls.Add(assemblersCombobox); productionPage.Controls.Add(blueprintsBackgroundPanel); productionPage.Controls.Add(blueprintsLabel); productionPage.Controls.Add(blueprintsScrollableArea); var materialsBackgroundPanel = new MyGuiControlPanel( position: blueprintsBackgroundPanel.Position + new Vector2(blueprintsBackgroundPanel.Size.X + columnSpacing, 0f), size: new Vector2(blueprintsBackgroundPanel.Size.X, smallBackgroundPanelHeight), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) { BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK }; var materialsLabel = new MyGuiControlLabel( position: materialsBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_StoredMaterials), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var materialsList = new MyGuiControlComponentList() { Position = materialsBackgroundPanel.Position + new Vector2(0f, materialsBackgroundPanel.Size.Y), Size = new Vector2(materialsBackgroundPanel.Size.X, blueprintsBackgroundPanel.Size.Y + blueprintsScrollableArea.Size.Y - materialsBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_NEUTRAL, Name = "MaterialsList", }; productionPage.Controls.Add(materialsBackgroundPanel); productionPage.Controls.Add(materialsLabel); productionPage.Controls.Add(materialsList); var assemblingButton = new MyGuiControlRadioButton( position: materialsBackgroundPanel.Position + new Vector2(materialsBackgroundPanel.Size.X + columnSpacing, 0f), size: new Vector2(200f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_COMPONENT, IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_AssemblingButton), Name = "AssemblingButton", }; assemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_AssemblingMode); var disassemblingButton = new MyGuiControlRadioButton( position: assemblingButton.Position + new Vector2(assemblingButton.Size.X + controlSpacing, 0f), size: new Vector2(238f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, Icon = MyGuiConstants.TEXTURE_BUTTON_ICON_DISASSEMBLY, IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, Text = MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassemblingButton), Name = "DisassemblingButton", }; disassemblingButton.SetToolTip(MySpaceTexts.ToolTipTerminalProduction_DisassemblingMode); var queueBackgroundPanel = new MyGuiControlCompositePanel() { Position = assemblingButton.Position + new Vector2(0f, assemblingButton.Size.Y + controlSpacing), Size = new Vector2(0.4f, largeBackgroundPanelHeight), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; var queueLabel = new MyGuiControlLabel( position: queueBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_ProductionQueue), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var queueGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = 2, ColumnsCount = 6, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var queueScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: queueGrid) { Name = "QueueScrollableArea", ScrollbarVEnabled = true, Position = queueBackgroundPanel.Position + new Vector2(0f, queueBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; queueScrollableArea.FitSizeToScrolledControl(); queueGrid.RowsCount = 10; queueBackgroundPanel.Size = new Vector2(queueScrollableArea.Size.X, queueBackgroundPanel.Size.Y); var repeatCheckbox = new MyGuiControlCheckbox( position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - controlSpacing, controlSpacing), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_RepeatMode), visualStyle: MyGuiControlCheckboxStyleEnum.Repeat) { Name = "RepeatCheckbox", }; var slaveCheckbox = new MyGuiControlCheckbox( position: queueBackgroundPanel.Position + new Vector2(queueBackgroundPanel.Size.X - 0.1f - controlSpacing, controlSpacing), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_SlaveMode), visualStyle: MyGuiControlCheckboxStyleEnum.Slave) { Name = "SlaveCheckbox", }; var inventoryBackgroundPanel = new MyGuiControlCompositePanel() { Position = queueScrollableArea.Position + new Vector2(0f, queueScrollableArea.Size.Y + controlSpacing), Size = new Vector2(0.4f, largeBackgroundPanelHeight), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK, }; var inventoryLabel = new MyGuiControlLabel( position: inventoryBackgroundPanel.Position + new Vector2(controlSpacing, controlSpacing), text: MyTexts.GetString(MySpaceTexts.ScreenTerminalProduction_Inventory), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP ); var inventoryGrid = new MyGuiControlGrid() { VisualStyle = MyGuiControlGridStyleEnum.Toolbar, RowsCount = 3, ColumnsCount = 6, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP }; var inventoryScrollableArea = new MyGuiControlScrollablePanel( scrolledControl: inventoryGrid) { Name = "InventoryScrollableArea", ScrollbarVEnabled = true, Position = inventoryBackgroundPanel.Position + new Vector2(0f, inventoryBackgroundPanel.Size.Y), OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST, ScrolledAreaPadding = new MyGuiBorderThickness(0.005f), }; inventoryScrollableArea.FitSizeToScrolledControl(); inventoryGrid.RowsCount = 10; inventoryBackgroundPanel.Size = new Vector2(inventoryScrollableArea.Size.X, inventoryBackgroundPanel.Size.Y); var disassembleAllButton = new MyGuiControlButton( position: inventoryBackgroundPanel.Position + new Vector2(inventoryBackgroundPanel.Size.X - controlSpacing, controlSpacing), size: new Vector2(220f, 40f) / MyGuiConstants.GUI_OPTIMAL_SIZE, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_DisassembleAllButton), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, toolTip: MyTexts.GetString(MySpaceTexts.ToolTipTerminalProduction_DisassembleAll)) { Name = "DisassembleAllButton", }; var inventoryButton = new MyGuiControlButton( position: inventoryScrollableArea.Position + new Vector2(0f, inventoryScrollableArea.Size.Y + controlSpacing), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: new Vector2(214f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_InventoryButton)) { Name = "InventoryButton", }; var controlPanelButton = new MyGuiControlButton( position: inventoryButton.Position + new Vector2(inventoryButton.Size.X + controlSpacing, 0f), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: inventoryButton.Size, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, text: MyTexts.Get(MySpaceTexts.ScreenTerminalProduction_ControlPanelButton)) { Name = "ControlPanelButton", }; productionPage.Controls.Add(assemblingButton); productionPage.Controls.Add(disassemblingButton); productionPage.Controls.Add(queueBackgroundPanel); productionPage.Controls.Add(queueLabel); productionPage.Controls.Add(repeatCheckbox); productionPage.Controls.Add(slaveCheckbox); productionPage.Controls.Add(queueScrollableArea); productionPage.Controls.Add(inventoryBackgroundPanel); productionPage.Controls.Add(inventoryLabel); productionPage.Controls.Add(disassembleAllButton); productionPage.Controls.Add(inventoryScrollableArea); productionPage.Controls.Add(inventoryButton); productionPage.Controls.Add(controlPanelButton); }
public override void RecreateControls(bool contructor) { base.RecreateControls(contructor); ProfilerShort.Begin("MyGuiScreenCubeBuilder.RecreateControls"); m_gridBlocks.MouseOverIndexChanged += OnGridMouseOverIndexChanged; m_gridBlocks.ItemSelected += OnSelectedItemChanged; m_blockInfoStyle = new MyGuiControlBlockInfo.MyControlBlockInfoStyle() { BlockNameLabelFont = MyFontEnum.White, EnableBlockTypeLabel = false, ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components, ComponentsLabelFont = MyFontEnum.Blue, InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required, InstalledRequiredLabelFont = MyFontEnum.Blue, RequiredLabelText = MyCommonTexts.HudBlockInfo_Required, IntegrityLabelFont = MyFontEnum.White, IntegrityBackgroundColor = new Vector4(78 / 255.0f, 116 / 255.0f, 137 / 255.0f, 1.0f), IntegrityForegroundColor = new Vector4(0.5f, 0.1f, 0.1f, 1), IntegrityForegroundColorOverCritical = new Vector4(118 / 255.0f, 166 / 255.0f, 192 / 255.0f, 1.0f), LeftColumnBackgroundColor = new Vector4(46 / 255.0f, 76 / 255.0f, 94 / 255.0f, 1.0f), TitleBackgroundColor = new Vector4(72 / 255.0f, 109 / 255.0f, 130 / 255.0f, 1.0f), ComponentLineMissingFont = MyFontEnum.Red, ComponentLineAllMountedFont = MyFontEnum.White, ComponentLineAllInstalledFont = MyFontEnum.Blue, ComponentLineDefaultFont = MyFontEnum.White, ComponentLineDefaultColor = new Vector4(0.6f, 0.6f, 0.6f, 1f), ShowAvailableComponents = false, EnableBlockTypePanel = false, }; m_rbGridSizeSmall = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeSmall"); if (m_rbGridSizeSmall == null) { Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); } m_rbGridSizeSmall.HighlightType = MyGuiControlHighlightType.NEVER; m_rbGridSizeSmall.SelectedChanged += OnGridSizeSmallSelected; m_rbGridSizeLarge = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeLarge"); if (m_rbGridSizeLarge == null) { Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); } m_rbGridSizeLarge.HighlightType = MyGuiControlHighlightType.NEVER; m_rbGridSizeLarge.SelectedChanged += OnGridSizeLargeSelected; m_rbGroupGridSize = new MyGuiControlRadioButtonGroup { m_rbGridSizeSmall, m_rbGridSizeLarge }; if (MyCubeBuilder.Static != null) { m_rbGroupGridSize.SelectedIndex = MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Small ? 0 : 1; } MyGuiControlLabel gridSizeLabel = (MyGuiControlLabel)Controls.GetControlByName("GridSizeHintLabel"); gridSizeLabel.Text = string.Format(MyTexts.GetString(gridSizeLabel.TextEnum), MyGuiSandbox.GetKeyName(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE)); m_blockInfoList = (MyGuiControlList)Controls.GetControlByName("BlockInfoPanel"); if (m_blockInfoList == null) { Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); } //m_blockInfoSmall = new MyGuiControlBlockInfo(style, false, false); //m_blockInfoSmall.Visible = false; //m_blockInfoSmall.IsActiveControl = false; //m_blockInfoSmall.BlockInfo = new MyHudBlockInfo(); //m_blockInfoSmall.Position = new Vector2(0.28f, -0.04f); //m_blockInfoSmall.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; //Controls.Add(m_blockInfoSmall); //m_blockInfoLarge = new MyGuiControlBlockInfo(style, false, true); //m_blockInfoLarge.Visible = false; //m_blockInfoLarge.IsActiveControl = false; //m_blockInfoLarge.BlockInfo = new MyHudBlockInfo(); //m_blockInfoLarge.Position = new Vector2(0.28f, -0.06f); //m_blockInfoLarge.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; //Controls.Add(m_blockInfoLarge); ProfilerShort.End(); }
public void LoadControls() { m_controls = new List <MyGuiControlBase>(); Vector2 labelOffset = new Vector2(-0.015f, 0f); Vector2 controlsOriginLeft = m_position + new Vector2(-m_size.Value.X / 2.0f + 0.025f, -m_size.Value.Y / 2.0f + 0.025f); Vector2 controlsOriginRight = m_position + new Vector2(m_size.Value.X / 2.0f - 0.025f, -m_size.Value.Y / 2.0f + 0.025f); Vector2 controlsDelta = MyGuiConstants.CONTROLS_DELTA * 0.6f; // add panel //m_controls.Add(new MyGuiControlPanel(m_parentScreen, m_position, m_size, m_backgroundColor.Value, null, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); m_controls.Add(new MyGuiControlPanel(m_parent, m_position, m_size, m_backgroundColor.Value, 2, MyGuiConstants.TREEVIEW_VERTICAL_LINE_COLOR)); #region shape types m_controls.Add(new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeType, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_voxelShapeTypeRadioButtonGroup = new MyGuiControlRadioButtonGroup(); foreach (MyVoxelHandShapeType voxelShapeType in MyGuiEditorVoxelHandHelpers.MyEditorVoxelHandShapeHelperTypesEnumValues) { controlsOriginLeft += controlsDelta; MyGuiEditorVoxelHandHelper voxelHandHelper = MyGuiEditorVoxelHandHelpers.GetEditorVoxelHandShapeHelper(voxelShapeType); MyGuiControlRadioButton voxelShapeTypeRadioButton = new MyGuiControlRadioButton(m_parent, controlsOriginLeft, (int)voxelShapeType, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); MyGuiControlLabel voxelShapeTypeDescription = new MyGuiControlLabel(m_parent, controlsOriginLeft + new Vector2(voxelShapeTypeRadioButton.GetSize().Value.X, 0.0f), null, voxelHandHelper.Description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_controls.Add(voxelShapeTypeRadioButton); m_controls.Add(voxelShapeTypeDescription); m_voxelShapeTypeRadioButtonGroup.Add(voxelShapeTypeRadioButton); } #endregion controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA; #region voxel mode types m_controls.Add(new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandShapeMode, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_voxelShapeModeRadioButtonGroup = new MyGuiControlRadioButtonGroup(); foreach (MyMwcVoxelHandModeTypeEnum voxelModeType in MyGuiEditorVoxelHandHelpers.MyEditorVoxelHandModeHelperTypesEnumValues) { controlsOriginLeft += controlsDelta; MyGuiEditorVoxelHandHelper voxelHandHelper = MyGuiEditorVoxelHandHelpers.GetEditorVoxelHandModeHelper(voxelModeType); MyGuiControlRadioButton voxelShapeModeRadioButton = new MyGuiControlRadioButton(m_parent, controlsOriginLeft, (int)voxelModeType, MyGuiConstants.RADIOBUTTON_BACKGROUND_COLOR); MyGuiControlLabel voxelShapeModeDescription = new MyGuiControlLabel(m_parent, controlsOriginLeft + new Vector2(voxelShapeModeRadioButton.GetSize().Value.X, 0.0f), null, voxelHandHelper.Description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); m_controls.Add(voxelShapeModeRadioButton); m_controls.Add(voxelShapeModeDescription); m_voxelShapeModeRadioButtonGroup.Add(voxelShapeModeRadioButton); } #endregion controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA; #region is projected m_controls.Add(new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandIsProjected, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_controls.Add(m_isProjectedCheckbox = new MyGuiControlCheckbox(m_parent, new Vector2(controlsOriginRight.X - MyGuiConstants.CHECKBOX_SIZE.X, controlsOriginLeft.Y), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR)); m_isProjectedCheckbox.Checked = MyEditorVoxelHand.IsProjected; m_isProjectedCheckbox.OnCheck = OnCheckboxChecked; controlsOriginLeft += MyGuiConstants.CONTROLS_DELTA; m_controls.Add(new MyGuiControlLabel(m_parent, controlsOriginLeft + labelOffset, null, MyTextsWrapperEnum.EditVoxelHandIsProjectedToWaypoints, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_controls.Add(m_isProjectedOnWaypointCheckbox = new MyGuiControlCheckbox(m_parent, new Vector2(controlsOriginRight.X - MyGuiConstants.CHECKBOX_SIZE.X, controlsOriginLeft.Y), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR)); m_isProjectedOnWaypointCheckbox.Checked = MyEditorVoxelHand.IsProjectedToWaypoints; m_isProjectedOnWaypointCheckbox.OnCheck = OnCheckboxChecked; #endregion controlsOriginLeft += new Vector2(0, MyGuiConstants.SLIDER_HEIGHT); m_offsetForSizeProperties = controlsOriginLeft.Y; RecreateDynamicProperties(); m_voxelShapeTypeRadioButtonGroup.SetSelected((int)MyEditorVoxelHand.VoxelHandShape.GetShapeType()); m_voxelShapeTypeRadioButtonGroup.OnSelectedChanged += OnRadioButtonSelectedChange; m_voxelShapeModeRadioButtonGroup.SetSelected((int)MyEditorVoxelHand.VoxelHandShape.ModeType); m_voxelShapeModeRadioButtonGroup.OnSelectedChanged += OnRadioButtonSelectedChange; }
public override void RecreateControls(bool contructor) { base.RecreateControls(contructor); ProfilerShort.Begin("MyGuiScreenCubeBuilder.RecreateControls"); m_gridBlocks.MouseOverIndexChanged += OnGridMouseOverIndexChanged; m_gridBlocks.ItemSelected += OnSelectedItemChanged; m_blockInfoStyle = new MyGuiControlBlockInfo.MyControlBlockInfoStyle() { BlockNameLabelFont = MyFontEnum.White, EnableBlockTypeLabel = false, ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components, ComponentsLabelFont = MyFontEnum.Blue, InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required, InstalledRequiredLabelFont = MyFontEnum.Blue, RequiredLabelText = MyCommonTexts.HudBlockInfo_Required, IntegrityLabelFont = MyFontEnum.White, IntegrityBackgroundColor = new Vector4(78 / 255.0f, 116 / 255.0f, 137 / 255.0f, 1.0f), IntegrityForegroundColor = new Vector4(0.5f, 0.1f, 0.1f, 1), IntegrityForegroundColorOverCritical = new Vector4(118 / 255.0f, 166 / 255.0f, 192 / 255.0f, 1.0f), LeftColumnBackgroundColor = new Vector4(46 / 255.0f, 76 / 255.0f, 94 / 255.0f, 1.0f), TitleBackgroundColor = new Vector4(72 / 255.0f, 109 / 255.0f, 130 / 255.0f, 1.0f), ComponentLineMissingFont = MyFontEnum.Red, ComponentLineAllMountedFont = MyFontEnum.White, ComponentLineAllInstalledFont = MyFontEnum.Blue, ComponentLineDefaultFont = MyFontEnum.White, ComponentLineDefaultColor = new Vector4(0.6f, 0.6f, 0.6f, 1f), ShowAvailableComponents = false, EnableBlockTypePanel = false, }; m_rbGridSizeSmall = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeSmall"); if(m_rbGridSizeSmall == null) Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); m_rbGridSizeSmall.HighlightType = MyGuiControlHighlightType.NEVER; m_rbGridSizeSmall.SelectedChanged += OnGridSizeSmallSelected; m_rbGridSizeLarge = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeLarge"); if (m_rbGridSizeLarge == null) Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); m_rbGridSizeLarge.HighlightType = MyGuiControlHighlightType.NEVER; m_rbGridSizeLarge.SelectedChanged += OnGridSizeLargeSelected; m_rbGroupGridSize = new MyGuiControlRadioButtonGroup { m_rbGridSizeSmall, m_rbGridSizeLarge }; if (MyCubeBuilder.Static != null) { m_rbGroupGridSize.SelectedIndex = MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Small ? 0 : 1; } MyGuiControlLabel gridSizeLabel = (MyGuiControlLabel)Controls.GetControlByName("GridSizeHintLabel"); gridSizeLabel.Text = string.Format(MyTexts.GetString(gridSizeLabel.TextEnum), MyGuiSandbox.GetKeyName(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE)); m_blockInfoList = (MyGuiControlList)Controls.GetControlByName("BlockInfoPanel"); if (m_blockInfoList == null) Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check"); //m_blockInfoSmall = new MyGuiControlBlockInfo(style, false, false); //m_blockInfoSmall.Visible = false; //m_blockInfoSmall.IsActiveControl = false; //m_blockInfoSmall.BlockInfo = new MyHudBlockInfo(); //m_blockInfoSmall.Position = new Vector2(0.28f, -0.04f); //m_blockInfoSmall.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; //Controls.Add(m_blockInfoSmall); //m_blockInfoLarge = new MyGuiControlBlockInfo(style, false, true); //m_blockInfoLarge.Visible = false; //m_blockInfoLarge.IsActiveControl = false; //m_blockInfoLarge.BlockInfo = new MyHudBlockInfo(); //m_blockInfoLarge.Position = new Vector2(0.28f, -0.06f); //m_blockInfoLarge.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; //Controls.Add(m_blockInfoLarge); ProfilerShort.End(); }
private void OnGridSizeSmallSelected(MyGuiControlRadioButton obj) { if (MyCubeBuilder.Static == null) return; if (obj.Selected) MyCubeBuilder.Static.CubeBuilderState.SetCubeSize(MyCubeSize.Small); this.UpdateGridControl(); }