Linkify more user links

This commit is contained in:
smoogipoo 2019-05-14 18:11:32 +09:00
parent b2fe9dd1a0
commit 77263bd56e
2 changed files with 18 additions and 49 deletions

View File

@ -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,

View File

@ -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);
}
}
}