Esempio n. 1
0
        public Header()
        {
            ExternalLinkButton externalLink;

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

            EdgeEffect = new EdgeEffectParameters
            {
                Colour = Color4.Black.Opacity(0.25f),
                Type   = EdgeEffectType.Shadow,
                Radius = 3,
                Offset = new Vector2(0f, 1f),
            };

            InternalChild = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Direction        = FillDirection.Vertical,
                Children         = new Drawable[]
                {
                    beatmapSetHeader = new BeatmapSetHeader
                    {
                        Ruleset = { BindTarget = ruleset },
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    cover = new UpdateableBeatmapSetCover
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Masking          = true,
                                    },
                                    coverGradient = new Box
                                    {
                                        RelativeSizeAxes = Axes.Both
                                    },
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Padding          = new MarginPadding
                                {
                                    Vertical = BeatmapSetOverlay.Y_PADDING,
                                    Left     = BeatmapSetOverlay.X_PADDING,
                                    Right    = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH,
                                },
                                Children = new Drawable[]
                                {
                                    fadeContent = new FillFlowContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Children         = new Drawable[]
                                        {
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Child            = Picker = new BeatmapPicker(),
                                            },
                                            new FillFlowContainer
                                            {
                                                Direction    = FillDirection.Horizontal,
                                                AutoSizeAxes = Axes.Both,
                                                Margin       = new MarginPadding {
                                                    Top = 15
                                                },
                                                Children = new Drawable[]
                                                {
                                                    title = new OsuSpriteText
                                                    {
                                                        Font = OsuFont.GetFont(size: 30, weight: FontWeight.SemiBold, italics: true)
                                                    },
                                                    externalLink = new ExternalLinkButton
                                                    {
                                                        Anchor = Anchor.BottomLeft,
                                                        Origin = Anchor.BottomLeft,
                                                        Margin = new MarginPadding {
                                                            Left = 3, Bottom = 4
                                                        },                                                   // To better lineup with the font
                                                    },
                                                }
                                            },
                                            artist = new OsuSpriteText
                                            {
                                                Font   = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true),
                                                Margin = new MarginPadding {
                                                    Bottom = 20
                                                }
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Child            = author = new AuthorInfo(),
                                            },
                                            beatmapAvailability = new BeatmapAvailability(),
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Height           = buttons_height,
                                                Margin           = new MarginPadding {
                                                    Top = 10
                                                },
                                                Children = new Drawable[]
                                                {
                                                    favouriteButton = new FavouriteButton
                                                    {
                                                        BeatmapSet = { BindTarget = BeatmapSet }
                                                    },
                                                    downloadButtonsContainer = new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Padding          = new MarginPadding {
                                                            Left = buttons_height + buttons_spacing
                                                        },
                                                        Spacing = new Vector2(buttons_spacing),
                                                    },
                                                },
                                            },
                                        },
                                    },
                                }
                            },
                            loading = new LoadingSpinner
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Scale  = new Vector2(1.5f),
                            },
                            new FillFlowContainer
                            {
                                Anchor       = Anchor.BottomRight,
                                Origin       = Anchor.BottomRight,
                                AutoSizeAxes = Axes.Both,
                                Margin       = new MarginPadding {
                                    Top = BeatmapSetOverlay.Y_PADDING, Right = BeatmapSetOverlay.X_PADDING
                                },
                                Direction = FillDirection.Vertical,
                                Spacing   = new Vector2(10),
                                Children  = new Drawable[]
                                {
                                    onlineStatusPill = new BeatmapSetOnlineStatusPill
                                    {
                                        Anchor      = Anchor.TopRight,
                                        Origin      = Anchor.TopRight,
                                        TextSize    = 14,
                                        TextPadding = new MarginPadding {
                                            Horizontal = 35, Vertical = 10
                                        }
                                    },
                                    Details = new Details(),
                                },
                            },
                        },
                    },
                }
            };

            Picker.Beatmap.ValueChanged += b =>
            {
                Details.Beatmap   = b.NewValue;
                externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
            };
        }
Esempio n. 2
0
File: Header.cs Progetto: ljmf00/osu
        public Header()
        {
            RelativeSizeAxes = Axes.X;
            Height           = 400;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Colour = Color4.Black.Opacity(0.25f),
                Type   = EdgeEffectType.Shadow,
                Radius = 3,
                Offset = new Vector2(0f, 1f),
            };
            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = tabs_height,
                    Children         = new[]
                    {
                        tabsBg = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = tabs_height
                    },
                    Children = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                coverContainer = new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)),
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 20, Bottom = 30, Horizontal = BeatmapSetOverlay.X_PADDING
                            },
                            Child = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 113,
                                        Child            = Picker = new BeatmapPicker(),
                                    },
                                    title = new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-BoldItalic",
                                        TextSize = 37,
                                    },
                                    artist = new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-SemiBoldItalic",
                                        TextSize = 25,
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Margin           = new MarginPadding {
                                            Top = 20
                                        },
                                        Child = author = new AuthorInfo(),
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = buttons_height,
                                        Margin           = new MarginPadding {
                                            Top = 10
                                        },
                                        Children = new Drawable[]
                                        {
                                            new FavouriteButton(),
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Left = buttons_height + buttons_spacing
                                                },
                                                Children = new Drawable[]
                                                {
                                                    noVideoButtons = new Container
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Alpha            = 0f,
                                                        Child            = new DownloadButton("Download", @""),
                                                    },
                                                    videoButtons = new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Spacing          = new Vector2(buttons_spacing),
                                                        Alpha            = 0f,
                                                        Children         = new[]
                                                        {
                                                            new DownloadButton("Download", "with Video"),
                                                            new DownloadButton("Download", "without Video"),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        Details = new Details
                        {
                            Anchor = Anchor.BottomRight,
                            Origin = Anchor.BottomRight,
                            Margin = new MarginPadding {
                                Right = BeatmapSetOverlay.X_PADDING
                            },
                        },
                    },
                },
            };

            Picker.Beatmap.ValueChanged += b => Details.Beatmap = b;
        }
Esempio n. 3
0
        public Header()
        {
            ExternalLinkButton externalLink;

            RelativeSizeAxes = Axes.X;
            Height           = 400;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Colour = Color4.Black.Opacity(0.25f),
                Type   = EdgeEffectType.Shadow,
                Radius = 3,
                Offset = new Vector2(0f, 1f),
            };
            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = tabs_height,
                    Children         = new[]
                    {
                        tabsBg = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = tabs_height
                    },
                    Children = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                cover = new UpdateableBeatmapSetCover
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)),
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 20, Bottom = 30, Horizontal = BeatmapSetOverlay.X_PADDING
                            },
                            Child = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 113,
                                        Child            = Picker = new BeatmapPicker(),
                                    },
                                    new FillFlowContainer
                                    {
                                        Direction    = FillDirection.Horizontal,
                                        AutoSizeAxes = Axes.Both,
                                        Children     = new Drawable[]
                                        {
                                            title = new OsuSpriteText
                                            {
                                                Font     = @"Exo2.0-BoldItalic",
                                                TextSize = 37,
                                            },
                                            externalLink = new ExternalLinkButton
                                            {
                                                Anchor = Anchor.BottomLeft,
                                                Origin = Anchor.BottomLeft,
                                                Margin = new MarginPadding {
                                                    Left = 3, Bottom = 4
                                                },                                                   //To better lineup with the font
                                            },
                                        }
                                    },
                                    artist = new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-SemiBoldItalic",
                                        TextSize = 25,
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Margin           = new MarginPadding {
                                            Top = 20
                                        },
                                        Child = author = new AuthorInfo(),
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = buttons_height,
                                        Margin           = new MarginPadding {
                                            Top = 10
                                        },
                                        Children = new Drawable[]
                                        {
                                            favouriteButton          = new FavouriteButton(),
                                            downloadButtonsContainer = new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Left = buttons_height + buttons_spacing
                                                },
                                                Children = new Drawable[]
                                                {
                                                    noVideoButtons = new Container
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Alpha            = 0f,
                                                    },
                                                    videoButtons = new FillFlowContainer
                                                    {
                                                        RelativeSizeAxes = Axes.Both,
                                                        Spacing          = new Vector2(buttons_spacing),
                                                        Alpha            = 0f,
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor       = Anchor.BottomRight,
                            Origin       = Anchor.BottomRight,
                            AutoSizeAxes = Axes.Both,
                            Margin       = new MarginPadding {
                                Right = BeatmapSetOverlay.X_PADDING
                            },
                            Direction = FillDirection.Vertical,
                            Spacing   = new Vector2(10),
                            Children  = new Drawable[]
                            {
                                onlineStatusPill = new BeatmapSetOnlineStatusPill
                                {
                                    Anchor      = Anchor.TopRight,
                                    Origin      = Anchor.TopRight,
                                    TextSize    = 14,
                                    TextPadding = new MarginPadding {
                                        Horizontal = 25, Vertical = 8
                                    }
                                },
                                Details = new Details(),
                            },
                        },
                    },
                },
            };

            Picker.Beatmap.ValueChanged += b => Details.Beatmap = b;
            Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet?.OnlineBeatmapSetID}#{b?.Ruleset.ShortName}/{b?.OnlineBeatmapID}";
        }