mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Show mapper's profile when clicking on avatar in BeatmapSetOverlay
This commit is contained in:
parent
04f3802cc0
commit
92c3d722b4
@ -188,11 +188,11 @@ namespace osu.Game
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Depth = -1
|
||||
}, overlayContent.Add);
|
||||
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add);
|
||||
LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -2 }, mainContent.Add);
|
||||
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -3 }, mainContent.Add);
|
||||
LoadComponentAsync(musicController = new MusicController
|
||||
{
|
||||
Depth = -3,
|
||||
Depth = -4,
|
||||
Position = new Vector2(0, Toolbar.HEIGHT),
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
@ -200,7 +200,7 @@ namespace osu.Game
|
||||
|
||||
LoadComponentAsync(notificationOverlay = new NotificationOverlay
|
||||
{
|
||||
Depth = -3,
|
||||
Depth = -4,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}, overlayContent.Add);
|
||||
|
@ -9,6 +9,9 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -17,8 +20,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
private const float height = 50;
|
||||
|
||||
private readonly UpdateableAvatar avatar;
|
||||
private readonly ClickableArea clickableArea;
|
||||
private readonly FillFlowContainer fields;
|
||||
|
||||
private UserProfileOverlay profile;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
@ -31,6 +37,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
var i = BeatmapSet.OnlineInfo;
|
||||
|
||||
avatar.User = i.Author;
|
||||
clickableArea.Action = () => profile?.ShowUser(avatar.User);
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("made by", i.Author.Username, @"Exo2.0-RegularItalic"),
|
||||
@ -58,11 +66,15 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
avatar = new UpdateableAvatar
|
||||
clickableArea = new ClickableArea
|
||||
{
|
||||
Size = new Vector2(height),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
CornerRadius = 3,
|
||||
Masking = true,
|
||||
Child = avatar = new UpdateableAvatar
|
||||
{
|
||||
Size = new Vector2(height),
|
||||
},
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
@ -80,6 +92,13 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(UserProfileOverlay profile)
|
||||
{
|
||||
this.profile = profile;
|
||||
clickableArea.Action = () => profile?.ShowUser(avatar.User);
|
||||
}
|
||||
|
||||
private class Field : FillFlowContainer
|
||||
{
|
||||
public Field(string first, string second, string secondFont)
|
||||
@ -103,5 +122,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class ClickableArea : OsuClickableContainer, IHasTooltip
|
||||
{
|
||||
public string TooltipText => @"View Profile";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user