From 77263bd56e9cc89cdd4fc53e6b2f6f1419584672 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 May 2019 18:11:32 +0900 Subject: [PATCH] Linkify more user links --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 31 ++++++---------- .../Historical/DrawableMostPlayedRow.cs | 36 +++++-------------- 2 files changed, 18 insertions(+), 49 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb73a50f99..5756a4593d 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -15,6 +15,7 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Direct { @@ -119,28 +120,16 @@ private void load(OsuColour colours) }, Children = new Drawable[] { - new FillFlowContainer + new LinkFlowContainer(s => { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "mapped by ", - Font = OsuFont.GetFont(size: 14), - Shadow = false, - Colour = colours.Gray5, - }, - new OsuSpriteText - { - Text = SetInfo.Metadata.Author.Username, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true), - Shadow = false, - Colour = colours.BlueDark, - }, - }, - }, + 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, diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs index b0609e685e..1b286f92d3 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs @@ -17,7 +17,6 @@ public class DrawableMostPlayedRow : DrawableProfileRow { private readonly BeatmapInfo beatmap; private readonly int playCount; - private OsuHoverContainer mapperContainer; public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount) { @@ -34,36 +33,20 @@ public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount) CoverType = BeatmapSetCoverType.List, }; - [BackgroundDependencyLoader(true)] - private void load(UserProfileOverlay profileOverlay) + [BackgroundDependencyLoader] + private void load() { LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap)); - LeftFlowContainer.Add(new FillFlowContainer + LeftFlowContainer.Add(new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = @"mapped by ", - Font = OsuFont.GetFont(size: 12) - }, - mapperContainer = new OsuHoverContainer - { - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = beatmap.Metadata.AuthorString, - Font = OsuFont.GetFont(size: 12, weight: FontWeight.Medium, italics: true) - } - } - }, - } - }); + }.With(d => + { + d.AddText("mapped by "); + d.AddUserLink(beatmap.Metadata.Author); + })); RightFlowContainer.Add(new FillFlowContainer { @@ -89,9 +72,6 @@ private void load(UserProfileOverlay profileOverlay) }, } }); - - if (profileOverlay != null) - mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author); } } }