private bool HasControlledNonZeroVelocity() { var entity = ControlledEntity; if (entity == null || MySession.IsCameraUserControlledSpectator()) { return(false); } var remoteControl = entity as MyRemoteControl; if (remoteControl != null) { entity = remoteControl.GetTopMostParent(); } var cockpit = entity as MyCockpit; if (cockpit != null) { entity = cockpit.GetTopMostParent(); } if (entity != null && entity.Physics != null && entity.Physics.LinearVelocity != Vector3.Zero) { return(true); } return(false); }
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; } m_blockInfoSmall = new MyGuiControlBlockInfo(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(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 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(); }