Example #1
0
        private void load(OsuColour colours)
        {
            Margin = new MarginPadding {
                Vertical = 5
            };

            Origin = Anchor.BottomCentre;
            Anchor = Anchor.BottomCentre;

            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            Color4 colour = samplePoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                volumeBox = new Circle
                {
                    CornerRadius = 5,
                    Anchor       = Anchor.BottomCentre,
                    Origin       = Anchor.BottomCentre,
                    Y            = -20,
                    Width        = 10,
                    Colour       = colour,
                },
                new Container
                {
                    AutoSizeAxes = Axes.X,
                    Height       = 16,
                    Masking      = true,
                    CornerRadius = 8,
                    Anchor       = Anchor.BottomCentre,
                    Origin       = Anchor.BottomCentre,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colour,
                            RelativeSizeAxes = Axes.Both,
                        },
                        text = new OsuSpriteText
                        {
                            Anchor  = Anchor.Centre,
                            Origin  = Anchor.Centre,
                            Padding = new MarginPadding(5),
                            Font    = OsuFont.Default.With(size: 12, weight: FontWeight.SemiBold),
                            Colour  = colours.B5,
                        }
                    }
                },
            };

            volume.BindValueChanged(volume => volumeBox.Height = max_volume_height * volume.NewValue / 100f, true);
            bank.BindValueChanged(bank => text.Text            = bank.NewValue, true);
        }
Example #2
0
        private void load(OsuColour colours)
        {
            Origin = Anchor.TopLeft;
            Anchor = Anchor.TopLeft;

            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            Color4 colour = samplePoint.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 20,
                    Children         = new Drawable[]
                    {
                        volumeBox = new Box
                        {
                            X                = 2,
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            Colour           = ColourInfo.GradientVertical(colour, Color4.Black),
                            RelativeSizeAxes = Axes.Both,
                        },
                        new Box
                        {
                            Colour           = colour.Lighten(0.2f),
                            Width            = 2,
                            RelativeSizeAxes = Axes.Y,
                        },
                    }
                },
                text = new OsuSpriteText
                {
                    X        = 2,
                    Y        = -5,
                    Anchor   = Anchor.BottomLeft,
                    Alpha    = 0.9f,
                    Rotation = -90,
                    Font     = OsuFont.Default.With(weight: FontWeight.SemiBold)
                }
            };

            volume.BindValueChanged(volume => volumeBox.Height = volume.NewValue / 100f, true);
            bank.BindValueChanged(bank => text.Text            = bank.NewValue, true);
        }