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 override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_toolbarControl = new MyGuiControlToolbar(); m_toolbarControl.Position = new Vector2(0.5f, 0.99f); m_toolbarControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM; m_toolbarControl.IsActiveControl = false; Elements.Add(m_toolbarControl); m_textScale = MyGuiConstants.HUD_TEXT_SCALE * MyGuiManager.LanguageTextScale; var style = new MyGuiControlBlockInfo.MyControlBlockInfoStyle() { BlockNameLabelFont = MyFontEnum.White, EnableBlockTypeLabel = true, 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 = true, }; m_blockInfo = new MyGuiControlBlockInfo(style); m_blockInfo.IsActiveControl = false; Controls.Add(m_blockInfo); m_questlogControl = new MyGuiControlQuestlog(new Vector2(20f, 20f)); m_questlogControl.IsActiveControl = false; m_questlogControl.RecreateControls(); Controls.Add(m_questlogControl); m_chatControl = new MyHudControlChat(MyHud.Chat, Vector2.Zero, new Vector2(0.4f, 0.28f), visibleLinesCount: 12); Elements.Add(m_chatControl); m_cameraInfoMultilineControl = new MyGuiControlMultilineText( position: Vector2.Zero, size: new Vector2(0.4f, 0.25f), backgroundColor: null, font: MyFontEnum.White, textScale: 0.7f, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, contents: null, drawScrollbar: false, textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM); m_cameraInfoMultilineControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM; Elements.Add(m_cameraInfoMultilineControl); m_rotatingWheelControl = new MyGuiControlRotatingWheel(position: new Vector2(0.5f, 0.85f)); Controls.Add(m_rotatingWheelControl); Vector2 buildModePosition = new Vector2(0.5f, 0.02f); buildModePosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref buildModePosition); m_buildModeLabel = new MyGuiControlLabel( position: buildModePosition, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, font: MyFontEnum.White, text: MyTexts.GetString(MyCommonTexts.Hud_BuildMode)); Controls.Add(m_buildModeLabel); m_blocksLeft = new MyGuiControlLabel( position: new Vector2(0.238f, 0.89f), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, font: MyFontEnum.White, text: MyHud.BlocksLeft.GetStringBuilder().ToString() ); Controls.Add(m_blocksLeft); m_relayNotification = new MyGuiControlLabel(new Vector2(1, 0), font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_relayNotification.TextEnum = MyCommonTexts.Multiplayer_IndirectConnection; m_relayNotification.Visible = false; Controls.Add(m_relayNotification); var offset = new Vector2(0, m_relayNotification.Size.Y); m_noMsgSentNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Debug, text: MyTexts.GetString(MyCommonTexts.Multiplayer_LastMsg), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noMsgSentNotification.Visible = false; Controls.Add(m_noMsgSentNotification); offset += new Vector2(0, m_noMsgSentNotification.Size.Y); m_noConnectionNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Red, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_noConnectionNotification.TextEnum = MyCommonTexts.Multiplayer_NoConnection; m_noConnectionNotification.Visible = false; Controls.Add(m_noConnectionNotification); m_serverSavingNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP); m_serverSavingNotification.TextEnum = MyCommonTexts.SavingPleaseWait; m_serverSavingNotification.Visible = false; Controls.Add(m_serverSavingNotification); MyHud.ReloadTexts(); }
public override void RecreateControls(bool contructor) { base.RecreateControls(contructor); ProfilerShort.Begin("MyGuiScreenCubeBuilder.RecreateControls"); bool showRightControls = !(MySession.ControlledEntity is MyShipController) || MyToolbarComponent.GlobalBuilding; //Disable right buttons if current spectator is official spectator if (MySession.Static.SurvivalMode) showRightControls &= !(MySession.IsCameraUserControlledSpectator() && !MyInput.Static.ENABLE_DEVELOPER_KEYS && MySession.Static.Settings.EnableSpectator); m_smallShipButton = (MyGuiControlButton)Controls.GetControlByName("ButtonSmall"); m_smallShipButton.Visible = showRightControls; m_smallShipButton.ButtonClicked += smallShipButton_OnButtonClick; m_largeShipButton = (MyGuiControlButton)Controls.GetControlByName("ButtonLarge"); m_largeShipButton.Visible = showRightControls; m_largeShipButton.ButtonClicked += largeShipButton_OnButtonClick; m_stationButton = (MyGuiControlButton)Controls.GetControlByName("ButtonStation"); m_stationButton.Visible = showRightControls; m_stationButton.ButtonClicked += stationButton_OnButtonClick; if (m_screenCubeGrid != null) { m_smallShipButton.Visible = false; m_stationButton.Visible = false; m_largeShipButton.Visible = false; } var style = new MyGuiControlBlockInfo.MyControlBlockInfoStyle() { BlockNameLabelFont = MyFontEnum.White, EnableBlockTypeLabel = true, ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components, ComponentsLabelFont = MyFontEnum.Blue, InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required, InstalledRequiredLabelFont = MyFontEnum.Blue, RequiredLabelText = MySpaceTexts.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 = true, }; 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(); }