Esempio n. 1
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;
        }
Esempio n. 2
0
 public LabelButton(HudParentBase parent) : base(parent)
 {
     _mouseInput = new MouseInputElement(this);
 }