예제 #1
0
        public BorderedButton(HudParentBase parent) : base(parent)
        {
            border = new BorderBox(this)
            {
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            AutoResize     = false;
            Format         = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center);
            FocusTextColor = TerminalFormatting.Charcoal;
            Text           = "NewBorderedButton";

            TextPadding      = new Vector2(32f, 0f);
            Padding          = new Vector2(37f, 0f);
            Size             = new Vector2(253f, 50f);
            HighlightEnabled = true;

            Color              = TerminalFormatting.OuterSpace;
            HighlightColor     = TerminalFormatting.Atomic;
            BorderColor        = TerminalFormatting.LimedSpruce;
            FocusColor         = TerminalFormatting.Mint;
            UseFocusFormatting = true;

            _mouseInput.GainedInputFocus += GainFocus;
            _mouseInput.LostInputFocus   += LoseFocus;
        }
예제 #2
0
        public BorderedCheckBox(HudParentBase parent) : base(parent)
        {
            border = new BorderBox(this)
            {
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both,
            };

            tickBox = new TexturedBox()
            {
                DimAlignment = DimAlignments.Both,
                Padding      = new Vector2(17f),
            };
            tickBox.Register(this, true);

            Size = new Vector2(37f);

            Color          = TerminalFormatting.OuterSpace;
            HighlightColor = TerminalFormatting.Atomic;
            FocusColor     = TerminalFormatting.Mint;

            TickBoxColor          = TerminalFormatting.StormGrey;
            TickBoxHighlightColor = Color.White;
            TickBoxFocusColor     = TerminalFormatting.Cinder;

            BorderColor        = TerminalFormatting.LimedSpruce;
            UseFocusFormatting = true;

            MouseInput.LeftClicked      += ToggleValue;
            MouseInput.GainedInputFocus += GainFocus;
            MouseInput.LostInputFocus   += LoseFocus;
        }
예제 #3
0
        public WindowBase(HudParentBase parent) : base(parent)
        {
            header = new LabelBoxButton(this)
            {
                DimAlignment     = DimAlignments.Width,
                Height           = 32f,
                ParentAlignment  = ParentAlignments.Top | ParentAlignments.Inner,
                ZOffset          = 1,
                Format           = GlyphFormat.White.WithAlignment(TextAlignment.Center),
                HighlightEnabled = false,
                AutoResize       = false,
            };

            body = new EmptyHudElement(header)
            {
                DimAlignment    = DimAlignments.Width,
                ParentAlignment = ParentAlignments.Bottom,
            };

            bodyBg = new TexturedBox(body)
            {
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
                ZOffset      = -2,
            };

            border = new BorderBox(this)
            {
                ZOffset      = 1,
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both,
            };

            resizeInput = new MouseInputElement(this)
            {
                ZOffset          = sbyte.MaxValue,
                Padding          = new Vector2(16f),
                DimAlignment     = DimAlignments.Both,
                CanIgnoreMasking = true
            };

            inputInner = new MouseInputElement(resizeInput)
            {
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            AllowResizing = true;
            CanDrag       = true;
            UseCursor     = true;
            ShareCursor   = false;
            IsMasking     = true;
            MinimumSize   = new Vector2(200f, 200f);

            LoseFocusCallback = LoseFocus;
            GetFocus();
        }
예제 #4
0
            public DropdownDisplay(HudParentBase parent = null) : base(parent)
            {
                border = new BorderBox(this)
                {
                    Thickness    = 1f,
                    DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
                };

                name = new Label()
                {
                    AutoResize = false,
                    Padding    = new Vector2(10f, 0f)
                };

                divider = new TexturedBox()
                {
                    Padding = new Vector2(4f, 17f),
                    Width   = 2f,
                    Color   = new Color(104, 113, 120),
                };

                arrow = new TexturedBox()
                {
                    Width        = 38f,
                    MatAlignment = MaterialAlignment.FitVertical,
                    Material     = arrowMat,
                };

                layout = new HudChain(false, this)
                {
                    SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                    DimAlignment        = DimAlignments.Height | DimAlignments.IgnorePadding,
                    CollectionContainer = { name, divider, arrow }
                };

                Format         = TerminalFormatting.ControlFormat;
                FocusTextColor = TerminalFormatting.Charcoal;

                Color          = TerminalFormatting.OuterSpace;
                HighlightColor = TerminalFormatting.Atomic;
                FocusColor     = TerminalFormatting.Mint;
                BorderColor    = TerminalFormatting.LimedSpruce;

                HighlightEnabled   = true;
                UseFocusFormatting = true;

                _mouseInput.GainedInputFocus += GainFocus;
                _mouseInput.LostInputFocus   += LoseFocus;
            }
예제 #5
0
        public SelectionBox(HudParentBase parent) : base(parent)
        {
            entryPool           = new ObjectPool <TContainer>(GetNewEntry, ResetEntry);
            hudChain.SizingMode = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.ClampChainOffAxis;

            border = new BorderBox(hudChain)
            {
                DimAlignment = DimAlignments.Both,
                Color        = new Color(58, 68, 77),
                Thickness    = 1f,
            };

            LineHeight    = 28f;
            MemberPadding = new Vector2(20f, 6f);
        }
예제 #6
0
        public SliderBox(HudParentBase parent) : base(parent)
        {
            background = new TexturedBox(this)
            {
                DimAlignment = DimAlignments.Both
            };

            border = new BorderBox(background)
            {
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both,
            };

            slide = new SliderBar(this)
            {
                DimAlignment = DimAlignments.Both,
                SliderSize   = new Vector2(14f, 28f),
                BarHeight    = 5f
            };

            BackgroundColor      = TerminalFormatting.OuterSpace;
            BorderColor          = TerminalFormatting.LimedSpruce;
            BackgroundHighlight  = TerminalFormatting.Atomic;
            BackgroundFocusColor = TerminalFormatting.Mint;

            SliderColor      = TerminalFormatting.MistBlue;
            SliderHighlight  = Color.White;
            SliderFocusColor = TerminalFormatting.Cinder;

            BarColor      = TerminalFormatting.MidGrey;
            BarHighlight  = Color.White;
            BarFocusColor = TerminalFormatting.BlackPerl;

            UseFocusFormatting = true;
            HighlightEnabled   = true;

            Padding = new Vector2(18f, 18f);
            Size    = new Vector2(317f, 47f);

            slide.MouseInput.CursorEntered    += CursorEnter;
            slide.MouseInput.CursorExited     += CursorExit;
            slide.MouseInput.GainedInputFocus += GainFocus;
            slide.MouseInput.LostInputFocus   += LoseFocus;
        }
예제 #7
0
        public TextField(HudParentBase parent) : base(parent)
        {
            border = new BorderBox(background)
            {
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both,
            };

            textBox = new TextBox(background)
            {
                AutoResize                = false,
                DimAlignment              = DimAlignments.Both | DimAlignments.IgnorePadding,
                Padding                   = new Vector2(24f, 0f),
                MoveToEndOnGainFocus      = true,
                ClearSelectionOnLoseFocus = true
            };

            Format         = TerminalFormatting.ControlFormat;
            FocusTextColor = TerminalFormatting.Charcoal;
            Text           = "NewTextField";

            Color          = TerminalFormatting.OuterSpace;
            HighlightColor = TerminalFormatting.Atomic;
            FocusColor     = TerminalFormatting.Mint;
            BorderColor    = TerminalFormatting.LimedSpruce;

            UseFocusFormatting = true;
            HighlightEnabled   = true;

            Size = new Vector2(250f, 40);

            textBox.TextBoard.TextChanged += OnTextChanged;
            MouseInput.CursorEntered      += CursorEnter;
            MouseInput.CursorExited       += CursorExit;
            MouseInput.GainedInputFocus   += GainFocus;
            MouseInput.LostInputFocus     += LoseFocus;
        }
예제 #8
0
        public ColorPickerHSV(HudParentBase parent) : base(parent)
        {
            // Header
            name = new Label()
            {
                Format     = GlyphFormat.Blueish.WithSize(1.08f),
                Text       = "NewColorPicker",
                AutoResize = false,
                Size       = new Vector2(88f, 22f)
            };

            display = new TexturedBox()
            {
                Width = 231f,
                Color = VRageMath.Color.Black
            };

            var dispBorder = new BorderBox(display)
            {
                Color        = VRageMath.Color.White,
                Thickness    = 1f,
                DimAlignment = DimAlignments.Both,
            };

            headerChain = new HudChain(false)
            {
                SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                Height              = 22f,
                Spacing             = 0f,
                CollectionContainer = { name, display }
            };

            // Color picker
            sliderText = new Label[]
            {
                new Label()
                {
                    AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f
                },
                new Label()
                {
                    AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f
                },
                new Label()
                {
                    AutoResize = false, Format = TerminalFormatting.ControlFormat, Height = 47f
                }
            };

            colorNameColumn = new HudChain <HudElementContainer <Label>, Label>(true)
            {
                SizingMode          = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth,
                Width               = 87f,
                Spacing             = 5f,
                CollectionContainer = { sliderText[0], sliderText[1], sliderText[2] }
            };

            sliders = new SliderBox[]
            {
                new SliderBox()
                {
                    Min = 0f, Max = 360f, Height = 47f
                },
                new SliderBox()
                {
                    Min = 0f, Max = 100f, Height = 47f
                },
                new SliderBox()
                {
                    Min = 0f, Max = 100f, Height = 47f
                }
            };

            colorSliderColumn = new HudChain <HudElementContainer <SliderBox>, SliderBox>(true)
            {
                SizingMode          = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth,
                Width               = 231f,
                Spacing             = 5f,
                CollectionContainer = { sliders[0], sliders[1], sliders[2] }
            };

            colorChain = new HudChain(false)
            {
                SizingMode          = HudChainSizingModes.FitChainBoth,
                CollectionContainer =
                {
                    colorNameColumn,
                    colorSliderColumn,
                }
            };

            mainChain = new HudChain(true, this)
            {
                SizingMode          = HudChainSizingModes.FitChainBoth,
                Spacing             = 5f,
                CollectionContainer =
                {
                    headerChain,
                    colorChain,
                }
            };

            Size         = new Vector2(318f, 163f);
            valueBuilder = new StringBuilder();

            UseCursor      = true;
            ShareCursor    = true;
            focusedChannel = -1;
        }
예제 #9
0
        public OnOffButton(HudParentBase parent) : base(parent)
        {
            mouseInput = new MouseInputElement(this);

            background = new TexturedBox(this)
            {
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            bgBorder = new BorderBox(background)
            {
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            on = new LabelBox()
            {
                AutoResize = false,
                Size       = new Vector2(71f, 49f),
                Format     = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center),
                Text       = "On"
            };

            onBorder = new BorderBox(on)
            {
                Thickness    = 2f,
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            off = new LabelBox()
            {
                AutoResize = false,
                Size       = new Vector2(71f, 49f),
                Format     = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center),
                Text       = "Off"
            };

            offBorder = new BorderBox(off)
            {
                Thickness    = 2f,
                DimAlignment = DimAlignments.Both | DimAlignments.IgnorePadding,
            };

            buttonChain = new HudChain(false, bgBorder)
            {
                SizingMode          = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth,
                Padding             = new Vector2(12f, 10f),
                Spacing             = 9f,
                CollectionContainer = { on, off }
            };

            Size = new Vector2(166f, 58f);

            BackgroundColor = TerminalFormatting.Cinder.SetAlphaPct(0.8f);
            HighlightColor  = TerminalFormatting.Atomic;
            FocusColor      = TerminalFormatting.Mint;
            BorderColor     = TerminalFormatting.LimedSpruce;

            UnselectedColor = TerminalFormatting.OuterSpace;
            SelectionColor  = TerminalFormatting.DullMint;

            HighlightEnabled   = true;
            UseFocusFormatting = true;

            mouseInput.LeftClicked += LeftClick;
        }