Ejemplo n.º 1
0
        public TestSceneExpandingBar()
        {
            Container    container;
            ExpandingBar expandingBar;

            Add(container = new Container
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Children = new Drawable[]
                {
                    new Box
                    {
                        Colour           = Color4.Gray,
                        Alpha            = 0.5f,
                        RelativeSizeAxes = Axes.Both,
                    },
                    expandingBar = new ExpandingBar
                    {
                        Anchor        = Anchor.Centre,
                        ExpandedSize  = 10,
                        CollapsedSize = 2,
                        Colour        = Color4.DeepSkyBlue,
                    }
                }
            });

            AddStep(@"Collapse", () => expandingBar.Collapse());
            AddStep(@"Expand", () => expandingBar.Expand());
            AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
            AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
            AddStep(@"Anchor top", () => expandingBar.Anchor           = Anchor.TopCentre);
            AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes   = Axes.Y);
            AddStep(@"Anchor left", () => expandingBar.Anchor          = Anchor.CentreLeft);
        }
Ejemplo n.º 2
0
        private void load(OverlayColourProvider colourProvider)
        {
            Size    = new Vector2(stream.IsFeatured ? badge_width * 2 : badge_width, 60);
            Padding = new MarginPadding(5);

            AddRange(new Drawable[]
            {
                text = new FillFlowContainer <SpriteText>
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Margin       = new MarginPadding {
                        Top = 6
                    },
                    Children = new[]
                    {
                        new OsuSpriteText
                        {
                            Text = stream.DisplayName,
                            Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black),
                        },
                        new OsuSpriteText
                        {
                            Text = stream.LatestBuild.DisplayVersion,
                            Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
                        },
                        new OsuSpriteText
                        {
                            Text   = stream.LatestBuild.Users > 0 ? $"{"user".ToQuantity(stream.LatestBuild.Users, "N0")} online" : null,
                            Font   = OsuFont.GetFont(size: 10),
                            Colour = colourProvider.Foreground1
                        },
                    }
                },
                expandingBar = new ExpandingBar
                {
                    Anchor        = Anchor.TopCentre,
                    Colour        = stream.Colour,
                    ExpandedSize  = 4,
                    CollapsedSize = 2,
                    Expanded      = true
                },
                new HoverClickSounds()
            });

            SelectedTab.BindValueChanged(_ => updateState(), true);
        }
Ejemplo n.º 3
0
        private void load(OverlayColourProvider colourProvider, OsuColour colours)
        {
            AddRange(new Drawable[]
            {
                text = new FillFlowContainer <SpriteText>
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Margin       = new MarginPadding {
                        Top = 6
                    },
                    Children = new[]
                    {
                        new OsuSpriteText
                        {
                            Text = MainText,
                            Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black),
                        },
                        new OsuSpriteText
                        {
                            Text = AdditionalText,
                            Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
                        },
                        new OsuSpriteText
                        {
                            Text   = InfoText,
                            Font   = OsuFont.GetFont(size: 10),
                            Colour = colourProvider.Foreground1
                        },
                    }
                },
                expandingBar = new ExpandingBar
                {
                    Anchor        = Anchor.TopCentre,
                    Colour        = GetBarColour(colours),
                    ExpandedSize  = 4,
                    CollapsedSize = 2,
                    Expanded      = true
                },
                new HoverClickSounds()
            });

            SelectedItem.BindValueChanged(_ => updateState(), true);
        }