Esempio n. 1
0
 public static void PlaySound(GuiSounds sound)
 {
     if (m_audio != null)
     {
         m_audio.PlaySound(sound);
     }
 }
Esempio n. 2
0
 public void PlaySound(GuiSounds sound)
 {
     if (sound == GuiSounds.None)
         return;
     MyGuiSounds hudSound = GetSound(sound);
     PlaySound(hudSound);
 }
Esempio n. 3
0
        public void PlaySound(GuiSounds sound)
        {
            if (sound == GuiSounds.None)
            {
                return;
            }
            MyGuiSounds hudSound = GetSound(sound);

            PlaySound(hudSound);
        }
Esempio n. 4
0
 private MyGuiSounds GetSound(GuiSounds sound)
 {
     switch(sound)
     {
         case(GuiSounds.MouseClick):
             return MyGuiSounds.HudMouseClick;
         case(GuiSounds.MouseOver):
             return MyGuiSounds.HudMouseOver;
         default:
             return MyGuiSounds.HudClick;
     }
 }
Esempio n. 5
0
        private MyGuiSounds GetSound(GuiSounds sound)
        {
            switch (sound)
            {
            case (GuiSounds.MouseClick):
                return(MyGuiSounds.HudMouseClick);

            case (GuiSounds.MouseOver):
                return(MyGuiSounds.HudMouseOver);

            default:
                return(MyGuiSounds.HudClick);
            }
        }
Esempio n. 6
0
        public MyGuiControlButton(
            Vector2?position = null,
            MyGuiControlButtonStyleEnum visualStyle = MyGuiControlButtonStyleEnum.Default,
            Vector2?size      = null,
            Vector4?colorMask = null,
            MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            String toolTip     = null,
            StringBuilder text = null,
            float textScale    = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlignment        = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            MyGuiControlHighlightType highlightType = MyGuiControlHighlightType.WHEN_ACTIVE,
            bool implementedFeature = true,
            Action <MyGuiControlButton> onButtonClick = null,
            GuiSounds cueEnum           = GuiSounds.MouseClick,
            float buttonScale           = 1.0f,
            int?buttonIndex             = null,
            bool activateOnMouseRelease = false)
            : base(position :        position ?? Vector2.Zero,
                   size :            size,
                   colorMask :       colorMask ?? MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                   toolTip :         toolTip,
                   highlightType :   highlightType,
                   originAlign :     originAlign,
                   canHaveFocus :    implementedFeature)
        {
            Name                 = "Button";
            ButtonClicked        = onButtonClick;
            Index                = buttonIndex ?? 0;
            m_implementedFeature = implementedFeature;
            UpdateText();

            m_drawText.Clear().Append(text);
            TextScale     = textScale;
            TextAlignment = textAlignment;

            VisualStyle = visualStyle;
            m_cueEnum   = cueEnum;
            m_activateOnMouseRelease = activateOnMouseRelease;

            ButtonScale = buttonScale;

            Size *= ButtonScale;
        }
Esempio n. 7
0
        public MyGuiControlImageButton(
            string name       = "Button",
            Vector2?position  = null,
            Vector2?size      = null,
            Vector4?colorMask = null,
            MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            String toolTip     = null,
            StringBuilder text = null,
            float textScale    = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlignment               = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            MyGuiControlHighlightType highlightType        = MyGuiControlHighlightType.WHEN_ACTIVE,
            Action <MyGuiControlImageButton> onButtonClick = null,
            GuiSounds cueEnum           = GuiSounds.MouseClick,
            float buttonScale           = 1.0f,
            int?buttonIndex             = null,
            bool activateOnMouseRelease = false)
            : base(position : position ?? Vector2.Zero,
                   size : size,
                   colorMask : colorMask ?? MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                   toolTip : toolTip,
                   highlightType : highlightType,
                   originAlign : originAlign,
                   canHaveFocus : true)
        {
            m_styleDefinition = new StyleDefinition()
            {
                Active = new StateDefinition()
                {
                    Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL
                },
                Disabled = new StateDefinition()
                {
                    Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL
                },
                Normal = new StateDefinition()
                {
                    Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL
                },
                Highlight = new StateDefinition()
                {
                    Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT
                },
                ActiveHighlight = new StateDefinition()
                {
                    Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT
                },
            };

            Name          = name ?? "Button";
            ButtonClicked = onButtonClick;
            Index         = buttonIndex ?? 0;
            UpdateText();

            m_drawText.Clear().Append(text);
            TextScale     = textScale;
            TextAlignment = textAlignment;

            m_cueEnum = cueEnum;
            m_activateOnMouseRelease = activateOnMouseRelease;

            ButtonScale = buttonScale;

            Size *= ButtonScale;
        }
        public MyGuiControlImageButton(
            string name = "Button",
            Vector2? position = null,
            Vector2? size = null,
            Vector4? colorMask = null,
            MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            String toolTip = null,
            StringBuilder text = null,
            float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            MyGuiControlHighlightType highlightType = MyGuiControlHighlightType.WHEN_ACTIVE,
            Action<MyGuiControlImageButton> onButtonClick = null,
            GuiSounds cueEnum = GuiSounds.MouseClick,
            float buttonScale = 1.0f,
            int? buttonIndex = null,
            bool activateOnMouseRelease = false)
            : base(position: position ?? Vector2.Zero,
                    size: size,
                    colorMask: colorMask ?? MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    toolTip: toolTip,
                    highlightType: highlightType,
                    originAlign: originAlign,
                    canHaveFocus: true)
        {
            m_styleDefinition = new StyleDefinition()
            {
                Active = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Disabled = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Normal = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Highlight = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT },
                ActiveHighlight = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT },
            };

            Name = name ?? "Button";
            ButtonClicked = onButtonClick;
            Index = buttonIndex ?? 0;
            UpdateText();

            m_drawText.Clear().Append(text);
            TextScale = textScale;
            TextAlignment = textAlignment;

            m_cueEnum = cueEnum;
            m_activateOnMouseRelease = activateOnMouseRelease;

            ButtonScale = buttonScale;

            Size *= ButtonScale;
        }
        public MyGuiControlButton(
            Vector2? position                         = null,
            MyGuiControlButtonStyleEnum visualStyle   = MyGuiControlButtonStyleEnum.Default,
            Vector2? size                             = null,
            Vector4? colorMask                        = null,
            MyGuiDrawAlignEnum originAlign            = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            String toolTip                     = null,
            StringBuilder text                        = null,
            float textScale                           = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlignment          = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            MyGuiControlHighlightType highlightType   = MyGuiControlHighlightType.WHEN_ACTIVE,
            bool implementedFeature                   = true,
            Action<MyGuiControlButton> onButtonClick  = null,
            GuiSounds cueEnum                   = GuiSounds.MouseClick,
            float buttonScale                         = 1.0f,
            int? buttonIndex = null,
            bool activateOnMouseRelease               = false)
            : base( position:        position ?? Vector2.Zero,
                    size:            size,
                    colorMask:       colorMask ?? MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    toolTip:         toolTip,
                    highlightType:   highlightType,
                    originAlign:     originAlign,
                    canHaveFocus:    implementedFeature)
        {
            Name                             = "Button";
            ButtonClicked                    = onButtonClick;
            Index                            = buttonIndex ?? 0;
            m_implementedFeature             = implementedFeature;
            UpdateText();

            m_drawText.Clear().Append(text);
            TextScale = textScale;
            TextAlignment = textAlignment;

            VisualStyle = visualStyle;
            m_cueEnum = cueEnum;
            m_activateOnMouseRelease = activateOnMouseRelease;

            ButtonScale = buttonScale;

            Size *= ButtonScale;
        }
Esempio n. 10
0
 public static void PlaySound(GuiSounds sound)
 {
     if (m_audio != null)
         m_audio.PlaySound(sound);
 }