コード例 #1
0
 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return(new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToEnterCockpit,
         FormatParams = new object[] { MyGuiSandbox.GetKeyName(MyControlsSpace.USE) },
         IsTextControlHint = true,
         JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
     });
 }
コード例 #2
0
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description = new MyActionDescription {
                Text = MySpaceTexts.NotificationHintPressToEnterCockpit
            };

            description.FormatParams         = new object[] { "[" + MyGuiSandbox.GetKeyName(MyControlsSpace.USE) + "]", ((VRage.Game.Entity.MyEntity) this.Cockpit).DisplayNameText };
            description.IsTextControlHint    = true;
            description.JoystickFormatParams = new object[] { "]" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]", ((VRage.Game.Entity.MyEntity) this.Cockpit).DisplayNameText };
            return(description);
        }
コード例 #3
0
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description = new MyActionDescription {
                Text = MySpaceTexts.NotificationHintPressToGetOnLadder
            };

            description.FormatParams         = new object[] { "[" + MyGuiSandbox.GetKeyName(MyControlsSpace.USE) + "]" };
            description.IsTextControlHint    = true;
            description.JoystickFormatParams = new object[] { "[" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]" };
            return(description);
        }
コード例 #4
0
        protected void DrawGuiIndicators()
        {
            if (MyHud.MinimalHud)
            {
                return;
            }

            if (MyGuiScreenGamePlay.ActiveGameplayScreen != null)
            {
                return;
            }

            if (IsCubeSizeModesAvailable)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat(MyTexts.GetString(MySpaceTexts.CubeBuilder_CubeSizeModeChange), MyGuiSandbox.GetKeyName(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE));
                Vector2 coords2D = new Vector2(0.5f, 0.13f);
                MyGuiManager.DrawString(MyFontEnum.White, sb, coords2D, 1.0f, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                coords2D = new Vector2(0.52f, 0.2f);
                float alphaValue         = CubeBuilderState.CubeSizeMode != MyCubeSize.Small ? 0.8f : 1.0f;
                Color premultipliedColor = new Color(alphaValue, alphaValue, alphaValue, alphaValue);
                MyRenderProxy.DrawSprite(MyGuiConstants.CB_SMALL_GRID_MODE, coords2D, Vector2.One, premultipliedColor, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 0, Vector2.UnitX, 1.0f, null);

                coords2D           = new Vector2(0.48f, 0.2f);
                alphaValue         = CubeBuilderState.CubeSizeMode != MyCubeSize.Large ? 0.8f : 1.0f;
                premultipliedColor = new Color(alphaValue, alphaValue, alphaValue, alphaValue);
                MyRenderProxy.DrawSprite(MyGuiConstants.CB_LARGE_GRID_MODE, coords2D, Vector2.One, premultipliedColor, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 0, Vector2.UnitX, 1.0f, null);
            }

            if (BuildInputValid)
            {
                Vector2 screenPos = new Vector2(0.5f, 0.1f);
                string  texture   = DynamicMode ? MyGuiConstants.CB_FREE_MODE_ICON : MyGuiConstants.CB_LCS_GRID_ICON;

                MyRenderProxy.DrawSprite(texture, screenPos, Vector2.One, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 0, Vector2.UnitX, 1.0f, null);
            }
        }
コード例 #5
0
        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();
        }
コード例 #6
0
    private void DrawPerformanceWarning(int xPosition, int yPosition, MyGuiDrawAlignEnum alignment, string texturepath, float length, float width)
    {
        if (!Controls.Contains(m_warningLabel))
        {
            Controls.Add(m_warningLabel);
        }
        if (m_warningNotifications.Count != 0)
        {
            Vector2 position = MyGuiManager.ComputeFullscreenGuiCoordinate(alignment, xPosition, yPosition);
            position -= new Vector2(length / 1.5f, 0f);

            MyGuiManager.DrawSpriteBatch(Path.GetFullPath(Path.Combine(MyFileSystem.UserDataPath, texturepath)), position, new Vector2(length / 1.5f, width / 1.5f), Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            StringBuilder stringBuilder = new StringBuilder();
            if (MyInput.Static.IsJoystickLastUsed)
            {
                stringBuilder.AppendFormat(MyCommonTexts.PerformanceWarningCombinationGamepad, MyControllerHelper.GetCodeForControl(MyControllerHelper.CX_BASE, MyControlsSpace.WARNING_SCREEN));
            }
            else
            {
                stringBuilder.AppendFormat(MyCommonTexts.PerformanceWarningCombination, MyGuiSandbox.GetKeyName(MyControlsSpace.HELP_SCREEN));
            }
            MyGuiManager.DrawString("White", MyTexts.GetString(m_warningNotifications[0]), position + new Vector2(0.09f, -0.011f), 0.7f, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            MyGuiManager.DrawString("White", stringBuilder.ToString(), position + new Vector2(0.09f, 0.018f), 0.6f, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            stringBuilder.Clear();
            MyGuiManager.DrawString("White", stringBuilder.AppendFormat("({0})", m_warningNotifications.Count).ToString(), position + new Vector2(0.177f, -0.023f), 0.55f, null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
            m_warningNotifications.RemoveAt(0);
        }
    }