예제 #1
0
        protected override void LoadComplete()
        {
            base.LoadComplete();
            this.FadeInFromZero(200, Easing.Out);

            PreviewPlaying.ValueChanged += playing =>
            {
                PlayButton.FadeTo(playing.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint);
                PreviewBar.FadeTo(playing.NewValue ? 1 : 0, 120, Easing.InOutQuint);
            };
        }
예제 #2
0
        protected override void OnHoverLost(HoverLostEvent e)
        {
            content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
            content.MoveToY(0, hover_transition_time, Easing.OutQuint);
            if (FadePlayButton && !PreviewPlaying.Value)
            {
                PlayButton.FadeOut(120, Easing.InOutQuint);
            }

            base.OnHoverLost(e);
        }
예제 #3
0
        protected override bool OnHover(HoverEvent e)
        {
            content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
            content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
            if (FadePlayButton)
            {
                PlayButton.FadeIn(120, Easing.InOutQuint);
            }

            return(base.OnHover(e));
        }
예제 #4
0
        private void load(OsuColour colours)
        {
            Content.CornerRadius = 4;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black.Opacity(0.5f),
                },
                bottomPanel = new FillFlowContainer
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.TopLeft,
                    Direction        = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Spacing          = new Vector2(0f, vertical_padding),
                    Children         = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Padding      = new MarginPadding {
                                Left = horizontal_padding, Right = horizontal_padding
                            },
                            Direction = FillDirection.Vertical,
                            Children  = new Drawable[]
                            {
                                titleContainer = new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Children     = new Drawable[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                                            Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
                                        },
                                    }
                                },
                                artistContainer = new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Children     = new Drawable[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                                            Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
                                        }
                                    }
                                }
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                progressBar = new Box
                                {
                                    Origin             = Anchor.BottomLeft,
                                    RelativeSizeAxes   = Axes.X,
                                    BypassAutoSizeAxes = Axes.Both,
                                    Size   = new Vector2(0, 3),
                                    Alpha  = 0,
                                    Colour = colours.Yellow,
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding
                                    {
                                        Top    = vertical_padding,
                                        Bottom = vertical_padding,
                                        Left   = horizontal_padding,
                                        Right  = horizontal_padding,
                                    },
                                    Children = new Drawable[]
                                    {
                                        new LinkFlowContainer(s =>
                                        {
                                            s.Shadow = false;
                                            s.Font   = OsuFont.GetFont(size: 14);
                                        }).With(d =>
                                        {
                                            d.AutoSizeAxes = Axes.Both;
                                            d.AddText("mapped by ", t => t.Colour = colours.Gray5);
                                            d.AddUserLink(SetInfo.Metadata.Author);
                                        }),
                                        new Container
                                        {
                                            AutoSizeAxes = Axes.X,
                                            Height       = 14,
                                            Children     = new[]
                                            {
                                                new OsuSpriteText
                                                {
                                                    Text   = SetInfo.Metadata.Source,
                                                    Font   = OsuFont.GetFont(size: 14),
                                                    Shadow = false,
                                                    Colour = colours.Gray5,
                                                    Alpha  = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                                },
                                            },
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.X,
                                            Height       = 20,
                                            Margin       = new MarginPadding {
                                                Top = vertical_padding, Bottom = vertical_padding
                                            },
                                            Spacing  = new Vector2(3),
                                            Children = GetDifficultyIcons(colours),
                                        },
                                    },
                                },
                                new BeatmapPanelDownloadButton(SetInfo)
                                {
                                    Size   = new Vector2(50, 30),
                                    Margin = new MarginPadding(horizontal_padding),
                                    Anchor = Anchor.TopRight,
                                    Origin = Anchor.TopRight,
                                },
                            },
                        },
                    },
                },
                new FillFlowContainer
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Margin       = new MarginPadding {
                        Top = vertical_padding, Right = vertical_padding
                    },
                    Children = new[]
                    {
                        new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0),
                        new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
                    },
                },
                statusContainer = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Margin       = new MarginPadding {
                        Top = 5, Left = 5
                    },
                    Spacing = new Vector2(5),
                },
                playButton = new PlayButton(SetInfo)
                {
                    Margin = new MarginPadding {
                        Top = 5, Left = 10
                    },
                    Size  = new Vector2(30),
                    Alpha = 0,
                },
            });

            if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
            {
                titleContainer.Add(new ExplicitContentBeatmapPill
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Margin = new MarginPadding {
                        Left = 10f, Top = 2f
                    },
                });
            }

            if (SetInfo.OnlineInfo?.TrackId != null)
            {
                artistContainer.Add(new FeaturedArtistBeatmapPill
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Margin = new MarginPadding {
                        Left = 10f, Top = 2f
                    },
                });
            }

            if (SetInfo.OnlineInfo?.HasVideo ?? false)
            {
                statusContainer.Add(new IconPill(FontAwesome.Solid.Film));
            }

            if (SetInfo.OnlineInfo?.HasStoryboard ?? false)
            {
                statusContainer.Add(new IconPill(FontAwesome.Solid.Image));
            }

            statusContainer.Add(new BeatmapSetOnlineStatusPill
            {
                TextSize    = 12,
                TextPadding = new MarginPadding {
                    Horizontal = 10, Vertical = 5
                },
                Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
            });

            PreviewPlaying.ValueChanged += _ => updateStatusContainer();
        }
예제 #5
0
        private void load(OsuColour colours)
        {
            Content.CornerRadius = 5;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Origin         = Anchor.CentreLeft,
                            Anchor         = Anchor.CentreLeft,
                            AutoSizeAxes   = Axes.Both,
                            Direction      = FillDirection.Horizontal,
                            LayoutEasing   = Easing.OutQuint,
                            LayoutDuration = transition_duration,
                            Spacing        = new Vector2(10, 0),
                            Children       = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Vertical,
                                    Children     = new Drawable[]
                                    {
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Children     = new Drawable[]
                                            {
                                                playButton = new PlayButton(SetInfo)
                                                {
                                                    Origin   = Anchor.CentreLeft,
                                                    Anchor   = Anchor.CentreLeft,
                                                    Size     = new Vector2(height / 3),
                                                    FillMode = FillMode.Fit,
                                                    Margin   = new MarginPadding {
                                                        Right = 10
                                                    },
                                                },
                                                new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Vertical,
                                                    Children     = new Drawable[]
                                                    {
                                                        titleContainer = new FillFlowContainer
                                                        {
                                                            AutoSizeAxes = Axes.Both,
                                                            Direction    = FillDirection.Horizontal,
                                                            Children     = new[]
                                                            {
                                                                new OsuSpriteText
                                                                {
                                                                    Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                                                                    Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
                                                                },
                                                            }
                                                        },
                                                        new OsuSpriteText
                                                        {
                                                            Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                                                            Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
                                                        },
                                                    }
                                                },
                                            }
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Children     = new Drawable[]
                                            {
                                                statusContainer = new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Margin       = new MarginPadding {
                                                        Vertical = vertical_padding, Horizontal = 5
                                                    },
                                                    Spacing = new Vector2(5),
                                                },
                                                new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.X,
                                                    Height       = 20,
                                                    Margin       = new MarginPadding {
                                                        Top = vertical_padding, Bottom = vertical_padding
                                                    },
                                                    Spacing  = new Vector2(3),
                                                    Children = GetDifficultyIcons(colours),
                                                },
                                            },
                                        },
                                    },
                                },
                            }
                        },
                        new FillFlowContainer
                        {
                            Anchor       = Anchor.TopRight,
                            Origin       = Anchor.TopRight,
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Children     = new Drawable[]
                            {
                                new Container
                                {
                                    Anchor       = Anchor.CentreRight,
                                    Origin       = Anchor.CentreRight,
                                    AutoSizeAxes = Axes.Both,
                                    Child        = DownloadButton = new BeatmapPanelDownloadButton(SetInfo)
                                    {
                                        Size   = new Vector2(height - vertical_padding * 3),
                                        Margin = new MarginPadding {
                                            Left = vertical_padding * 2, Right = vertical_padding
                                        },
                                    },
                                },
                                new FillFlowContainer
                                {
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Vertical,
                                    Children     = new Drawable[]
                                    {
                                        new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0),
                                        new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
                                        new LinkFlowContainer(s =>
                                        {
                                            s.Shadow = false;
                                            s.Font   = OsuFont.GetFont(size: 14);
                                        })
                                        {
                                            Anchor       = Anchor.TopRight,
                                            Origin       = Anchor.TopRight,
                                            AutoSizeAxes = Axes.Both,
                                        }.With(d =>
                                        {
                                            d.AutoSizeAxes = Axes.Both;
                                            d.AddText("mapped by ");
                                            d.AddUserLink(SetInfo.Metadata.Author);
                                        }),
                                        new OsuSpriteText
                                        {
                                            Text   = SetInfo.Metadata.Source,
                                            Anchor = Anchor.TopRight,
                                            Origin = Anchor.TopRight,
                                            Font   = OsuFont.GetFont(size: 14),
                                            Alpha  = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                progressBar = new Box
                {
                    Anchor             = Anchor.BottomLeft,
                    Origin             = Anchor.BottomLeft,
                    RelativeSizeAxes   = Axes.X,
                    BypassAutoSizeAxes = Axes.Y,
                    Size   = new Vector2(0, 3),
                    Alpha  = 0,
                    Colour = colours.Yellow,
                },
            });

            if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
            {
                titleContainer.Add(new ExplicitContentBeatmapPill
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Margin = new MarginPadding {
                        Left = 10f, Top = 2f
                    },
                });
            }

            if (SetInfo.OnlineInfo?.HasVideo ?? false)
            {
                statusContainer.Add(new IconPill(FontAwesome.Solid.Film)
                {
                    IconSize = new Vector2(20)
                });
            }

            if (SetInfo.OnlineInfo?.HasStoryboard ?? false)
            {
                statusContainer.Add(new IconPill(FontAwesome.Solid.Image)
                {
                    IconSize = new Vector2(20)
                });
            }

            statusContainer.Add(new BeatmapSetOnlineStatusPill
            {
                TextSize    = 12,
                TextPadding = new MarginPadding {
                    Horizontal = 10, Vertical = 4
                },
                Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
            });
        }