示例#1
0
        public SliderBar(HudParentBase parent) : base(parent)
        {
            bar    = new TexturedBox(this);
            slider = new TexturedBox(bar)
            {
                UseCursor = true, ShareCursor = true
            };
            mouseInput = new MouseInputElement(this)
            {
                DimAlignment = DimAlignments.Both
            };

            _barSize      = new Vector2(100f, 12f);
            _sliderSize   = new Vector2(6f, 12f);
            SliderVisible = true;

            bar.Size    = _barSize;
            slider.Size = _sliderSize;

            SliderColor     = new Color(180, 180, 180, 255);
            BarColor        = new Color(140, 140, 140, 255);
            SliderHighlight = new Color(200, 200, 200, 255);
            EnableHighlight = true;

            _min = 0f;
            _max = 1f;

            Current = 0f;
            Percent = 0f;
        }
示例#2
0
        public Button(HudParentBase parent) : base(parent)
        {
            _mouseInput      = new MouseInputElement(this);
            HighlightColor   = new Color(125, 125, 125, 255);
            HighlightEnabled = true;

            _mouseInput.CursorEntered += CursorEnter;
            _mouseInput.CursorExited  += CursorExit;
        }
        public LabelBoxButton(HudParentBase parent) : base(parent)
        {
            _mouseInput      = new MouseInputElement(this);
            Color            = Color.DarkGray;
            HighlightColor   = Color.Gray;
            HighlightEnabled = true;

            _mouseInput.CursorEntered += CursorEnter;
            _mouseInput.CursorExited  += CursorExit;
        }
示例#4
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();
        }
示例#5
0
            public TreeBoxDisplay(HudParentBase parent = null) : base(parent)
            {
                background = new TexturedBox(this)
                {
                    Color        = TerminalFormatting.EbonyClay,
                    DimAlignment = DimAlignments.Both,
                };

                name = new Label()
                {
                    AutoResize = false,
                    Padding    = new Vector2(10f, 0f),
                    Format     = GlyphFormat.Blueish.WithSize(1.1f),
                };

                divider = new TexturedBox()
                {
                    Padding = new Vector2(2f, 6f),
                    Size    = new Vector2(2f, 39f),
                    Color   = new Color(104, 113, 120),
                };

                arrow = new TexturedBox()
                {
                    Width        = 20f,
                    Padding      = new Vector2(8f, 0f),
                    MatAlignment = MaterialAlignment.FitHorizontal,
                    Color        = new Color(227, 230, 233),
                    Material     = rightArrow,
                };

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

                mouseInput = new MouseInputElement(this)
                {
                    DimAlignment = DimAlignments.Both
                };
            }
示例#6
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;
        }