private void OnGridMouseOverIndexChanged(MyGuiControlGrid myGuiControlGrid, MyGuiControlGrid.EventArgs eventArgs) { if (m_gridBlocks.Visible) { MyGuiControlGrid.Item gridItem = m_gridBlocks.MouseOverItem ?? m_gridBlocks.SelectedItem; if (gridItem == null) { m_blockInfoList.InitControls(new MyGuiControlBase[] { }); return; } GridItemUserData userData = gridItem.UserData as GridItemUserData; if (userData == null) { return; } MyObjectBuilder_ToolbarItemCubeBlock itemData = userData.ItemData as MyObjectBuilder_ToolbarItemCubeBlock; if (itemData == null) { return; } MyDefinitionBase definition; if (MyDefinitionManager.Static.TryGetDefinition(itemData.DefinitionId, out definition)) { var group = MyDefinitionManager.Static.GetDefinitionGroup((definition as MyCubeBlockDefinition).BlockPairName); if (MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Small && MyCubeBuilder.Static.IsCubeSizeAvailable(group.Small)) { m_blockInfoList.InitControls(GenerateBlockInfos(group.Small, ref m_blockInfoStyle)); } else if (MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Large && MyCubeBuilder.Static.IsCubeSizeAvailable(group.Large)) { m_blockInfoList.InitControls(GenerateBlockInfos(group.Large, ref m_blockInfoStyle)); } else { bool blockSizeLarge = MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Large; m_blockInfoList.InitControls(new MyGuiControlBase[] { GenerateSizeInfoLabel(blockSizeLarge), GenerateSizeNotAvailableText(blockSizeLarge) }); } } } else { m_blockInfoList.InitControls(new MyGuiControlBase[] { }); } }
private void RecreateControls() { Debug.Assert(m_infoPage != null, "Terminal page is null"); if (m_infoPage == null) { return; } if (MyFakes.ENABLE_CENTER_OF_MASS) { var centerBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("CenterBtn"); centerBtn.IsChecked = MyCubeGrid.ShowCenterOfMass; centerBtn.IsCheckedChanged = centerBtn_IsCheckedChanged; var pivotBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("PivotBtn"); pivotBtn.IsChecked = MyCubeGrid.ShowGridPivot; pivotBtn.IsCheckedChanged = pivotBtn_IsCheckedChanged; } var showGravityGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowGravityGizmo"); showGravityGizmoBtn.IsChecked = MyCubeGrid.ShowGravityGizmos; showGravityGizmoBtn.IsCheckedChanged = showGravityGizmos_IsCheckedChanged; var showSenzorGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowSenzorGizmo"); showSenzorGizmoBtn.IsChecked = MyCubeGrid.ShowSenzorGizmos; showSenzorGizmoBtn.IsCheckedChanged = showSenzorGizmos_IsCheckedChanged; var showAntenaGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowAntenaGizmo"); showAntenaGizmoBtn.IsChecked = MyCubeGrid.ShowAntennaGizmos; showAntenaGizmoBtn.IsCheckedChanged = showAntenaGizmos_IsCheckedChanged; var friendAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("FriendAntennaRange"); friendAntennaRange.Value = MyHudMarkerRender.FriendAntennaRange; friendAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.FriendAntennaRange = s.Value; }; var enemyAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("EnemyAntennaRange"); enemyAntennaRange.Value = MyHudMarkerRender.EnemyAntennaRange; enemyAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.EnemyAntennaRange = s.Value; }; var ownedAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("OwnedAntennaRange"); ownedAntennaRange.Value = MyHudMarkerRender.OwnerAntennaRange; ownedAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.OwnerAntennaRange = s.Value; }; if (MyFakes.ENABLE_TERMINAL_PROPERTIES) { var renameShipLabel = (MyGuiControlLabel)m_infoPage.Controls.GetControlByName("RenameShipLabel"); var renameShipBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("RenameShipButton"); var renameShipText = (MyGuiControlTextbox)m_infoPage.Controls.GetControlByName("RenameShipText"); if (renameShipText != null && m_grid != null) { renameShipText.Text = m_grid.DisplayName; } var showRenameShip = IsPlayerOwner(m_grid); renameShipLabel.Visible = showRenameShip; renameShipBtn.Visible = showRenameShip; renameShipText.Visible = showRenameShip; } var convertBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertBtn"); MyGuiControlList list = (MyGuiControlList)m_infoPage.Controls.GetControlByName("InfoList"); list.Controls.Clear(); if (m_grid == null || m_grid.Physics == null) { convertBtn.Enabled = false; MyGuiControlLabel noShip = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScreenTerminalError_ShipNotConnected), font: Common.MyFontEnum.Red); list.Controls.Add(noShip); return; } if (!m_grid.IsStatic || m_grid.MarkedForClose) { convertBtn.Enabled = false; } int gravityCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyGravityGenerator))) { gravityCounter = m_grid.BlocksCounters[typeof(MyGravityGenerator)]; } int massCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyVirtualMass))) { massCounter = m_grid.BlocksCounters[typeof(MyVirtualMass)]; } int lightCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyInteriorLight))) { lightCounter = m_grid.BlocksCounters[typeof(MyInteriorLight)]; } var conveyorCounter = 0; foreach (var key in m_grid.BlocksCounters.Keys) { if (typeof(IMyConveyorSegmentBlock).IsAssignableFrom(key) || typeof(IMyConveyorEndpointBlock).IsAssignableFrom(key)) { conveyorCounter += m_grid.BlocksCounters[key]; } } int polygonCounter = 0; foreach (var block in m_grid.GetBlocks()) { if (block.FatBlock != null) { polygonCounter += block.FatBlock.Model.GetTrianglesCount(); } } foreach (var cell in m_grid.RenderData.Cells.Values) { foreach (var part in cell.CubeParts) { polygonCounter += part.Model.GetTrianglesCount(); } } MyGuiControlLabel polygonCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Triangles)).AppendInt32(polygonCounter).ToString()); polygonCount.SetToolTip(MySpaceTexts.TerminalTab_Info_TrianglesTooltip); MyGuiControlLabel cubeCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Blocks)).AppendInt32(m_grid.GetBlocks().Count).ToString()); cubeCount.SetToolTip(MySpaceTexts.TerminalTab_Info_BlocksTooltip); MyGuiControlLabel blockCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_NonArmor)).AppendInt32(m_grid.Hierarchy.Children.Count).ToString()); MyGuiControlLabel thrustCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Thrusters)).AppendInt32(m_grid.GridSystems.ThrustSystem.ThrustCount).ToString()); MyGuiControlLabel lightCount = new MyGuiControlLabel(text: new StringBuilder().Clear().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Lights)).AppendInt32(lightCounter).ToString()); MyGuiControlLabel reflectorCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Reflectors)).AppendInt32(m_grid.GridSystems.ReflectorLightSystem.ReflectorCount).ToString()); //MyGuiControlLabel wheelCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Rotors)).AppendInt32(m_grid.WheelSystem.WheelCount)); MyGuiControlLabel gravityCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_GravGens)).AppendInt32(gravityCounter).ToString()); MyGuiControlLabel massCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_VirtualMass)).AppendInt32(massCounter).ToString()); MyGuiControlLabel conveyorCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Conveyors)).AppendInt32(conveyorCounter).ToString()); list.InitControls(new MyGuiControlBase[] { cubeCount, blockCount, conveyorCount, thrustCount, lightCount, reflectorCount, gravityCount, massCount, polygonCount }); }
public override void RecreateControls(bool contructor) { base.RecreateControls(contructor); Controls.Clear(); m_entitiesGuiList = new MyGuiControlList( this, new Vector2(0.0034f, -0.030f), new Vector2(0.489f, 0.65f), Vector4.Zero, null,//MyTextsWrapper.Get(MyTextsWrapperEnum.SecurityControlHUB), MyGuiManager.GetBlankTexture(), new Vector2(0.01f, 0.0f)); if (!contructor) { foreach (var entityGui in m_entitiesGui) { entityGui.ClearAfterRemove(); } } m_entitiesGui.Clear(); foreach (IMyUseableEntity connectedEntity in m_prefabSecurityControlHUB.ConnectedEntities) { MyEntity entity = connectedEntity as MyEntity; if (!entity.Visible) { continue; } Debug.Assert((connectedEntity.UseProperties.UseType & MyUseType.FromHUB) != 0); IMyHasGuiControl entityWithGuiControl = connectedEntity as IMyHasGuiControl; Debug.Assert(entityWithGuiControl != null); // if entity is not hacked and could be hacked from HUB, then try hack it if (!connectedEntity.UseProperties.IsHacked && (connectedEntity.UseProperties.HackType & MyUseType.FromHUB) != 0) { if (m_useBy.HackingTool != null && m_useBy.HackingTool.HackingLevel >= connectedEntity.UseProperties.HackingLevel) { connectedEntity.UseProperties.IsHacked = true; } } MyGuiControlEntityUse entityGui = entityWithGuiControl.GetGuiControl(m_entitiesGuiList); entityGui.ParentScreen = this; m_entitiesGui.Add(entityGui); } m_entitiesGuiList.InitControls(m_entitiesGui); Controls.Add(m_entitiesGuiList); var exitButton = new MyGuiControlButton( this, new Vector2(0f, 0.3740f), new Vector2(0.161f, 0.0637f), Vector4.One, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Exit, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnExitClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(exitButton); }
private void RecreateControls() { Debug.Assert(m_infoPage != null, "Terminal page is null"); if (m_infoPage == null) { return; } if (MyFakes.ENABLE_CENTER_OF_MASS) { var centerBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("CenterBtn"); centerBtn.IsChecked = MyCubeGrid.ShowCenterOfMass; centerBtn.IsCheckedChanged = centerBtn_IsCheckedChanged; var pivotBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("PivotBtn"); pivotBtn.IsChecked = MyCubeGrid.ShowGridPivot; pivotBtn.IsCheckedChanged = pivotBtn_IsCheckedChanged; } var showGravityGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowGravityGizmo"); showGravityGizmoBtn.IsChecked = MyCubeGrid.ShowGravityGizmos; showGravityGizmoBtn.IsCheckedChanged = showGravityGizmos_IsCheckedChanged; var showSenzorGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowSenzorGizmo"); showSenzorGizmoBtn.IsChecked = MyCubeGrid.ShowSenzorGizmos; showSenzorGizmoBtn.IsCheckedChanged = showSenzorGizmos_IsCheckedChanged; var showAntenaGizmoBtn = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("ShowAntenaGizmo"); showAntenaGizmoBtn.IsChecked = MyCubeGrid.ShowAntennaGizmos; showAntenaGizmoBtn.IsCheckedChanged = showAntenaGizmos_IsCheckedChanged; var friendAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("FriendAntennaRange"); friendAntennaRange.Value = MyHudMarkerRender.FriendAntennaRange; friendAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.FriendAntennaRange = s.Value; }; var enemyAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("EnemyAntennaRange"); enemyAntennaRange.Value = MyHudMarkerRender.EnemyAntennaRange; enemyAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.EnemyAntennaRange = s.Value; }; var ownedAntennaRange = (MyGuiControlSlider)m_infoPage.Controls.GetControlByName("OwnedAntennaRange"); ownedAntennaRange.Value = MyHudMarkerRender.OwnerAntennaRange; ownedAntennaRange.ValueChanged += (MyGuiControlSlider s) => { MyHudMarkerRender.OwnerAntennaRange = s.Value; }; if (MyFakes.ENABLE_TERMINAL_PROPERTIES) { var renameShipLabel = (MyGuiControlLabel)m_infoPage.Controls.GetControlByName("RenameShipLabel"); var renameShipBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("RenameShipButton"); var renameShipText = (MyGuiControlTextbox)m_infoPage.Controls.GetControlByName("RenameShipText"); if (renameShipText != null && m_grid != null) { renameShipText.Text = m_grid.DisplayName; } var showRenameShip = IsPlayerOwner(m_grid); renameShipLabel.Visible = showRenameShip; renameShipBtn.Visible = showRenameShip; renameShipText.Visible = showRenameShip; } var convertBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertBtn"); var convertToStationBtn = (MyGuiControlButton)m_infoPage.Controls.GetControlByName("ConvertToStationBtn"); MyGuiControlList list = (MyGuiControlList)m_infoPage.Controls.GetControlByName("InfoList"); list.Controls.Clear(); var setDestructibleBlocks = (MyGuiControlCheckbox)m_infoPage.Controls.GetControlByName("SetDestructibleBlocks"); setDestructibleBlocks.Visible = MySession.Static.Settings.ScenarioEditMode || MySession.Static.IsScenario; setDestructibleBlocks.Enabled = MySession.Static.Settings.ScenarioEditMode; if (m_grid == null || m_grid.Physics == null) { convertBtn.Enabled = false; convertToStationBtn.Enabled = false; RecreateServerLimitInfo(list); return; } if (!m_grid.IsStatic) { convertBtn.Enabled = false; convertToStationBtn.Enabled = true; } else { convertBtn.Enabled = true; convertToStationBtn.Enabled = false; } if (m_grid.GridSizeEnum == MyCubeSize.Small) { convertToStationBtn.Enabled = false; } if (!m_grid.BigOwners.Contains(MySession.Static.LocalPlayerId)) { convertBtn.Enabled = false; convertToStationBtn.Enabled = false; } setDestructibleBlocks.IsChecked = m_grid.DestructibleBlocks; setDestructibleBlocks.IsCheckedChanged = setDestructibleBlocks_IsCheckedChanged; int gravityCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyObjectBuilder_GravityGenerator))) { gravityCounter = m_grid.BlocksCounters[typeof(MyObjectBuilder_GravityGenerator)]; } int massCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyObjectBuilder_VirtualMass))) { massCounter = m_grid.BlocksCounters[typeof(MyObjectBuilder_VirtualMass)]; } int lightCounter = 0; if (m_grid.BlocksCounters.ContainsKey(typeof(MyObjectBuilder_InteriorLight))) { lightCounter = m_grid.BlocksCounters[typeof(MyObjectBuilder_InteriorLight)]; } var conveyorCounter = 0; foreach (var key in m_grid.BlocksCounters.Keys) { Type blockType = MyCubeBlockFactory.GetProducedType(key); if (typeof(IMyConveyorSegmentBlock).IsAssignableFrom(blockType) || typeof(IMyConveyorEndpointBlock).IsAssignableFrom(blockType)) { conveyorCounter += m_grid.BlocksCounters[key]; } } int polygonCounter = 0; foreach (var block in m_grid.GetBlocks()) { if (block.FatBlock != null) { polygonCounter += block.FatBlock.Model.GetTrianglesCount(); } } foreach (var cell in m_grid.RenderData.Cells.Values) { foreach (var part in cell.CubeParts) { polygonCounter += part.Model.GetTrianglesCount(); } } int thrustCount = 0; var thrustComp = m_grid.Components.Get <MyEntityThrustComponent>(); if (thrustComp != null) { thrustCount = thrustComp.ThrustCount; } MyGuiControlLabel thrustCountLabel = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Thrusters)).AppendInt32(thrustCount).ToString()); MyGuiControlLabel polygonCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Triangles)).AppendInt32(polygonCounter).ToString()); polygonCount.SetToolTip(MySpaceTexts.TerminalTab_Info_TrianglesTooltip); MyGuiControlLabel cubeCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Blocks)).AppendInt32(m_grid.GetBlocks().Count).ToString()); cubeCount.SetToolTip(MySpaceTexts.TerminalTab_Info_BlocksTooltip); MyGuiControlLabel blockCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_NonArmor)).AppendInt32(m_grid.Hierarchy.Children.Count).ToString()); MyGuiControlLabel lightCount = new MyGuiControlLabel(text: new StringBuilder().Clear().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Lights)).AppendInt32(lightCounter).ToString()); MyGuiControlLabel reflectorCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Reflectors)).AppendInt32(m_grid.GridSystems.ReflectorLightSystem.ReflectorCount).ToString()); //MyGuiControlLabel wheelCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Rotors)).AppendInt32(m_grid.WheelSystem.WheelCount)); MyGuiControlLabel gravityCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_GravGens)).AppendInt32(gravityCounter).ToString()); MyGuiControlLabel massCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_VirtualMass)).AppendInt32(massCounter).ToString()); MyGuiControlLabel conveyorCount = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_Conveyors)).AppendInt32(conveyorCounter).ToString()); var mainCockpit = m_grid.MainCockpit as MyShipController; MyCharacter pilot = null; if (mainCockpit != null) { pilot = mainCockpit.Pilot; } MyGuiControlLabel gridMass = new MyGuiControlLabel(text: new StringBuilder().AppendStringBuilder(MyTexts.Get(MySpaceTexts.TerminalTab_Info_GridMass)).AppendInt32(m_grid.GetCurrentMass(pilot)).ToString()); list.InitControls(new MyGuiControlBase[] { cubeCount, blockCount, conveyorCount, thrustCountLabel, lightCount, reflectorCount, gravityCount, massCount, polygonCount, gridMass }); }
public MyGuiScreenFake() : base(new Vector2(0.5f, 0.5f), new Vector4(0f, 1f, 0f, 0.5f), new Vector2(1f, 1f)) { MyGuiControlList controlList = new MyGuiControlList(this, new Vector2(0f, 0f), new Vector2(0.8f, 0.5f), MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR, new StringBuilder("ToolTip"), MyGuiManager.GetBlankTexture()); Controls.Add(controlList); List <MyGuiControlBase> fakeControls = new List <MyGuiControlBase>(); MyGuiControlParent parent1 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 0f, 1f), new StringBuilder("Parent1"), null); parent1.Controls.Add(new MyGuiControlTextbox(parent1, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "AAA", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent1.Controls.Add(new MyGuiControlCheckbox(parent1, new Vector2(0f, 0.07f), MyGuiConstants.CHECKBOX_SIZE, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR)); fakeControls.Add(parent1); MyGuiControlParent parent2 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 1f, 0f, 1f), new StringBuilder("Parent2"), null); parent2.Controls.Add(new MyGuiControlTextbox(parent2, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "CCC", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); MyGuiControlCombobox combobox1 = new MyGuiControlCombobox(parent2, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false); combobox1.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 ")); combobox1.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 ")); combobox1.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 ")); combobox1.AddItem(3, new StringBuilder("Item4")); combobox1.AddItem(4, new StringBuilder("Item5")); combobox1.AddItem(5, new StringBuilder("Item6")); combobox1.AddItem(6, new StringBuilder("Item7")); combobox1.AddItem(7, new StringBuilder("Item8")); combobox1.AddItem(8, new StringBuilder("Item9")); combobox1.AddItem(9, new StringBuilder("Item10")); combobox1.AddItem(10, new StringBuilder("Item11")); combobox1.AddItem(11, new StringBuilder("Item12")); combobox1.AddItem(12, new StringBuilder("Item13")); parent2.Controls.Add(combobox1); fakeControls.Add(parent2); MyGuiControlParent parent3 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 0f, 1f, 1f), new StringBuilder("Parent3"), null); parent3.Controls.Add(new MyGuiControlTextbox(parent3, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "EEE", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); MyGuiControlCombobox combobox2 = new MyGuiControlCombobox(parent3, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false); combobox2.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 ")); combobox2.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 ")); combobox2.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 ")); combobox2.AddItem(3, new StringBuilder("Item4")); combobox2.AddItem(4, new StringBuilder("Item5")); combobox2.AddItem(5, new StringBuilder("Item6")); combobox2.AddItem(6, new StringBuilder("Item7")); combobox2.AddItem(7, new StringBuilder("Item8")); combobox2.AddItem(8, new StringBuilder("Item9")); combobox2.AddItem(9, new StringBuilder("Item10")); combobox2.AddItem(10, new StringBuilder("Item11")); combobox2.AddItem(11, new StringBuilder("Item12")); combobox2.AddItem(12, new StringBuilder("Item13")); parent3.Controls.Add(combobox2); fakeControls.Add(parent3); MyGuiControlParent parent4 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 1f, 1f), new StringBuilder("Parent4"), null); parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "GGG", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "HHH", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); fakeControls.Add(parent4); MyGuiControlParent parent5 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 1f, 0f, 1f), new StringBuilder("Parent5"), null); parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "III", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "JJJ", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL)); fakeControls.Add(parent5); controlList.InitControls(fakeControls); }
private void OnGridMouseOverIndexChanged(MyGuiControlGrid myGuiControlGrid, MyGuiControlGrid.EventArgs eventArgs) { if (m_gridBlocks.Visible) { MyGuiControlGrid.Item gridItem = m_gridBlocks.MouseOverItem ?? m_gridBlocks.SelectedItem; if (gridItem == null) { m_blockInfoList.InitControls(new MyGuiControlBase[] { }); return; } GridItemUserData userData = gridItem.UserData as GridItemUserData; if (userData == null) { return; } MyObjectBuilder_ToolbarItemCubeBlock itemData = userData.ItemData as MyObjectBuilder_ToolbarItemCubeBlock; if (itemData == null) { return; } MyDefinitionBase definition; if (MyDefinitionManager.Static.TryGetDefinition(itemData.DefinitionId, out definition)) { var group = MyDefinitionManager.Static.GetDefinitionGroup((definition as MyCubeBlockDefinition).BlockPairName); List <MyGuiControlBase> blockInfos = null; if (group.Small != null) { var blockInfosSmall = GenerateBlockInfos(group.Small, ref m_blockInfoStyle); if (blockInfosSmall != null) { if (blockInfos == null) { blockInfos = new List <MyGuiControlBase>(); } blockInfos.AddArray(blockInfosSmall); } } if (group.Large != null) { var blockInfosLarge = GenerateBlockInfos(group.Large, ref m_blockInfoStyle); if (blockInfosLarge != null) { if (blockInfos == null) { blockInfos = new List <MyGuiControlBase>(); } blockInfos.AddArray(blockInfosLarge); } } if (blockInfos != null) { m_blockInfoList.InitControls(blockInfos); } else { m_blockInfoList.InitControls(new MyGuiControlBase[] { }); } //else //{ // bool blockSizeLarge = MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Large; // m_blockInfoList.InitControls(new MyGuiControlBase[] // { // GenerateSizeInfoLabel(blockSizeLarge), // GenerateSizeNotAvailableText(blockSizeLarge) // }); //} } } else { m_blockInfoList.InitControls(new MyGuiControlBase[] { }); } }