From 3883f4a74642b999c162d81d33be12f7b7c755b2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 16 Jun 2017 16:23:20 +0800 Subject: [PATCH] Show profile when click on user panel. --- osu.Game/OsuGame.cs | 1 + osu.Game/Users/UserPanel.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 62f9164fdd..4692c89048 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -208,6 +208,7 @@ protected override void LoadComplete() Dependencies.Cache(settings); Dependencies.Cache(social); Dependencies.Cache(chat); + Dependencies.Cache(userProfile); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 19ed2c3394..c0adaa19fb 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; namespace osu.Game.Users { @@ -21,6 +22,7 @@ public class UserPanel : Container private const float status_height = 30; private OsuColour colours; + private UserProfileOverlay profile; private readonly Container statusBar; private readonly Box statusBg; @@ -74,7 +76,7 @@ public UserPanel(User user) Radius = 4, }, }, - new Container + new ClickableContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = height - status_height - content_padding }, @@ -114,6 +116,7 @@ public UserPanel(User user) }, }, }, + Action = () => profile?.ShowUser(user) }, }, }, @@ -159,10 +162,11 @@ public UserPanel(User user) }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + [BackgroundDependencyLoader(permitNulls:true)] + private void load(OsuColour colours, UserProfileOverlay profile) { this.colours = colours; + this.profile = profile; Status.ValueChanged += displayStatus; }