Remove a few custom user link implementations (#4789)

Remove a few custom user link implementations

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert
2019-05-16 15:27:30 +09:00
committed by GitHub
3 changed files with 33 additions and 67 deletions

View File

@ -15,6 +15,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
{ {
@ -119,28 +120,16 @@ namespace osu.Game.Overlays.Direct
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new LinkFlowContainer(s =>
{ {
AutoSizeAxes = Axes.Both, s.Shadow = false;
Direction = FillDirection.Horizontal, s.Font = OsuFont.GetFont(size: 14);
Children = new[] }).With(d =>
{ {
new OsuSpriteText d.AutoSizeAxes = Axes.Both;
{ d.AddText("mapped by ", t => t.Colour = colours.Gray5);
Text = "mapped by ", d.AddUserLink(SetInfo.Metadata.Author);
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,
},
},
},
new Container new Container
{ {
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
{ {
@ -86,8 +87,9 @@ namespace osu.Game.Overlays.Direct
{ {
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Size = new Vector2(height / 2), Size = new Vector2(height / 3),
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
Margin = new MarginPadding { Right = 10 },
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -150,7 +152,7 @@ namespace osu.Game.Overlays.Direct
Child = new DownloadButton(SetInfo) Child = new DownloadButton(SetInfo)
{ {
Size = new Vector2(height - vertical_padding * 3), Size = new Vector2(height - vertical_padding * 3),
Margin = new MarginPadding { Left = vertical_padding, Right = vertical_padding }, Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding },
}, },
}, },
new FillFlowContainer new FillFlowContainer
@ -163,26 +165,21 @@ namespace osu.Game.Overlays.Direct
{ {
new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0), new Statistic(FontAwesome.Solid.PlayCircle, SetInfo.OnlineInfo?.PlayCount ?? 0),
new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0), new Statistic(FontAwesome.Solid.Heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
new FillFlowContainer new LinkFlowContainer(s =>
{
s.Shadow = false;
s.Font = OsuFont.GetFont(size: 14);
})
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, }.With(d =>
Children = new[] {
{ d.AutoSizeAxes = Axes.Both;
new OsuSpriteText d.AddText("mapped by ");
{ d.AddUserLink(SetInfo.Metadata.Author);
Text = "mapped by ", }),
Font = OsuFont.GetFont(size: 14)
},
new OsuSpriteText
{
Text = SetInfo.Metadata.Author.Username,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
},
},
},
new OsuSpriteText new OsuSpriteText
{ {
Text = SetInfo.Metadata.Source, Text = SetInfo.Metadata.Source,

View File

@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{ {
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
private readonly int playCount; private readonly int playCount;
private OsuHoverContainer mapperContainer;
public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount) public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount)
{ {
@ -34,36 +33,20 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CoverType = BeatmapSetCoverType.List, CoverType = BeatmapSetCoverType.List,
}; };
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader]
private void load(UserProfileOverlay profileOverlay) private void load()
{ {
LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap)); LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap));
LeftFlowContainer.Add(new FillFlowContainer LeftFlowContainer.Add(new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new Drawable[] }.With(d =>
{ {
new OsuSpriteText d.AddText("mapped by ");
{ d.AddUserLink(beatmap.Metadata.Author);
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)
}
}
},
}
});
RightFlowContainer.Add(new FillFlowContainer RightFlowContainer.Add(new FillFlowContainer
{ {
@ -89,9 +72,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
}, },
} }
}); });
if (profileOverlay != null)
mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author);
} }
} }
} }