diff --git a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs
index 883f0c5e3f..838347800f 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs
@@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online
{
typeof(HistoricalSection),
typeof(PaginatedMostPlayedBeatmapContainer),
- typeof(DrawableMostPlayedRow),
+ typeof(DrawableMostPlayedBeatmap),
typeof(DrawableProfileRow)
};
diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
index 16326900f1..13b547eed3 100644
--- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
+++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
@@ -4,26 +4,23 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Framework.Localisation;
using osu.Game.Beatmaps;
-using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
-using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Profile.Sections
{
///
/// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see ).
///
- public class BeatmapMetadataContainer : OsuHoverContainer
+ public abstract class BeatmapMetadataContainer : OsuHoverContainer
{
private readonly BeatmapInfo beatmap;
- public BeatmapMetadataContainer(BeatmapInfo beatmap)
+ protected BeatmapMetadataContainer(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
+
AutoSizeAxes = Axes.Both;
- TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}";
}
[BackgroundDependencyLoader(true)]
@@ -40,23 +37,10 @@ namespace osu.Game.Overlays.Profile.Sections
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
- Children = new Drawable[]
- {
- new OsuSpriteText
- {
- Text = new LocalisedString((
- $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
- $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
- Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
- },
- new OsuSpriteText
- {
- Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
- Padding = new MarginPadding { Top = 3 },
- Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
- },
- },
+ Children = CreateText(beatmap),
};
}
+
+ protected abstract Drawable[] CreateText(BeatmapInfo beatmap);
}
}
diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs
new file mode 100644
index 0000000000..0206c4e13b
--- /dev/null
+++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs
@@ -0,0 +1,182 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Localisation;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.Drawables;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Containers;
+using osu.Game.Graphics.Sprites;
+using osuTK;
+using System.Collections.Generic;
+using osu.Framework.Graphics.Cursor;
+
+namespace osu.Game.Overlays.Profile.Sections.Historical
+{
+ public class DrawableMostPlayedBeatmap : OsuHoverContainer
+ {
+ private const int cover_width = 100;
+ private const int corner_radius = 6;
+ private const int height = 50;
+
+ private readonly BeatmapInfo beatmap;
+ private readonly int playCount;
+
+ private Box background;
+
+ protected override IEnumerable EffectTargets => new[] { background };
+
+ public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
+ {
+ this.beatmap = beatmap;
+ this.playCount = playCount;
+ Enabled.Value = true; //manually enabled, because we have no action
+
+ RelativeSizeAxes = Axes.X;
+ Height = height;
+
+ Masking = true;
+ CornerRadius = corner_radius;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ IdleColour = colours.GreySeafoam;
+ HoverColour = colours.GreySeafoamLight;
+
+ Children = new Drawable[]
+ {
+ new UpdateableBeatmapSetCover
+ {
+ RelativeSizeAxes = Axes.Y,
+ Width = cover_width,
+ BeatmapSet = beatmap.BeatmapSet,
+ CoverType = BeatmapSetCoverType.List,
+ },
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding { Left = cover_width - corner_radius },
+ Children = new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ CornerRadius = corner_radius,
+ Children = new Drawable[]
+ {
+ background = new Box { RelativeSizeAxes = Axes.Both },
+ new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Padding = new MarginPadding(10),
+ Children = new Drawable[]
+ {
+ new FillFlowContainer
+ {
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Vertical,
+ Children = new Drawable[]
+ {
+ new MostPlayedBeatmapMetadataContainer(beatmap),
+ new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
+ {
+ AutoSizeAxes = Axes.Both,
+ Direction = FillDirection.Horizontal,
+ Colour = colours.GreySeafoamLighter
+ }.With(d =>
+ {
+ d.AddText("mapped by ");
+ d.AddUserLink(beatmap.Metadata.Author);
+ }),
+ }
+ },
+ new PlayCountText(playCount)
+ {
+ Anchor = Anchor.CentreRight,
+ Origin = Anchor.CentreRight
+ },
+ }
+ },
+ }
+ }
+ }
+ }
+ };
+ }
+
+ private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
+ {
+ public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
+ : base(beatmap)
+ {
+ }
+
+ protected override Drawable[] CreateText(BeatmapInfo beatmap) => new Drawable[]
+ {
+ new OsuSpriteText
+ {
+ Text = new LocalisedString((
+ $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
+ $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
+ Font = OsuFont.GetFont(weight: FontWeight.Bold)
+ },
+ new OsuSpriteText
+ {
+ Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
+ Font = OsuFont.GetFont(weight: FontWeight.Regular)
+ },
+ };
+ }
+
+ private class PlayCountText : CompositeDrawable, IHasTooltip
+ {
+ public string TooltipText => "times played";
+
+ public PlayCountText(int playCount)
+ {
+ AutoSizeAxes = Axes.Both;
+
+ InternalChild = new FillFlowContainer
+ {
+ Anchor = Anchor.CentreRight,
+ Origin = Anchor.CentreRight,
+ AutoSizeAxes = Axes.Both,
+ Spacing = new Vector2(5, 0),
+ Children = new Drawable[]
+ {
+ new SpriteIcon
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ Size = new Vector2(12),
+ Icon = FontAwesome.Solid.Play,
+ },
+ new OsuSpriteText
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ Text = playCount.ToString(),
+ Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular),
+ },
+ }
+ };
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ Colour = colours.Yellow;
+ }
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs
deleted file mode 100644
index 1b286f92d3..0000000000
--- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using osu.Framework.Allocation;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
-using osu.Game.Beatmaps;
-using osu.Game.Beatmaps.Drawables;
-using osu.Game.Graphics;
-using osu.Game.Graphics.Containers;
-using osu.Game.Graphics.Sprites;
-using osuTK;
-
-namespace osu.Game.Overlays.Profile.Sections.Historical
-{
- public class DrawableMostPlayedRow : DrawableProfileRow
- {
- private readonly BeatmapInfo beatmap;
- private readonly int playCount;
-
- public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount)
- {
- this.beatmap = beatmap;
- this.playCount = playCount;
- }
-
- protected override Drawable CreateLeftVisual() => new UpdateableBeatmapSetCover
- {
- Anchor = Anchor.CentreLeft,
- Origin = Anchor.CentreLeft,
- Size = new Vector2(80, 50),
- BeatmapSet = beatmap.BeatmapSet,
- CoverType = BeatmapSetCoverType.List,
- };
-
- [BackgroundDependencyLoader]
- private void load()
- {
- LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap));
- LeftFlowContainer.Add(new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
- {
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Direction = FillDirection.Horizontal,
- }.With(d =>
- {
- d.AddText("mapped by ");
- d.AddUserLink(beatmap.Metadata.Author);
- }));
-
- RightFlowContainer.Add(new FillFlowContainer
- {
- Anchor = Anchor.TopRight,
- Origin = Anchor.TopRight,
- AutoSizeAxes = Axes.Both,
- Direction = FillDirection.Horizontal,
- Children = new[]
- {
- new OsuSpriteText
- {
- Anchor = Anchor.BottomRight,
- Origin = Anchor.BottomRight,
- Text = playCount.ToString(),
- Font = OsuFont.GetFont(size: 18, weight: FontWeight.SemiBold, italics: true)
- },
- new OsuSpriteText
- {
- Anchor = Anchor.BottomRight,
- Origin = Anchor.BottomRight,
- Text = @"times played ",
- Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
- },
- }
- });
- }
- }
-}
diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs
index 9409cd9aeb..23072f8d90 100644
--- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs
+++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs
@@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
foreach (var beatmap in beatmaps)
{
- ItemsContainer.Add(new DrawableMostPlayedRow(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
+ ItemsContainer.Add(new DrawableMostPlayedBeatmap(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
}
});
diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
index b77357edd8..e54ce44ca2 100644
--- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
+++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
@@ -10,6 +10,8 @@ using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
+using osu.Game.Beatmaps;
+using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
@@ -51,7 +53,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
RightFlowContainer.Insert(1, text);
- LeftFlowContainer.Add(new BeatmapMetadataContainer(Score.Beatmap));
+ LeftFlowContainer.Add(new ProfileScoreBeatmapMetadataContainer(Score.Beatmap));
LeftFlowContainer.Add(new DrawableDate(Score.Date));
foreach (Mod mod in Score.Mods)
@@ -64,5 +66,30 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Width = 60,
FillMode = FillMode.Fit,
};
+
+ private class ProfileScoreBeatmapMetadataContainer : BeatmapMetadataContainer
+ {
+ public ProfileScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
+ : base(beatmap)
+ {
+ }
+
+ protected override Drawable[] CreateText(BeatmapInfo beatmap) => new Drawable[]
+ {
+ new OsuSpriteText
+ {
+ Text = new LocalisedString((
+ $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
+ $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
+ Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
+ },
+ new OsuSpriteText
+ {
+ Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
+ Padding = new MarginPadding { Top = 3 },
+ Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
+ },
+ };
+ }
}
}