From b9eb7a8445e6534a3d3e6c5c5c9c3d6d9f28d92c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Jul 2017 20:26:55 +0200 Subject: [PATCH] make chat message users open UserProfileOverlay --- osu.Game/Overlays/Chat/ChatLine.cs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 3aaca7593c..c59a589fba 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Chat { @@ -68,6 +69,8 @@ namespace osu.Game.Overlays.Chat private const float message_padding = 200; private const float text_size = 20; + private UserProfileOverlay profileOverlay; + public ChatLine(Message message) { Message = message; @@ -94,15 +97,20 @@ namespace osu.Game.Overlays.Chat TextSize = text_size * 0.75f, Alpha = 0.4f, }, - new OsuSpriteText + new ClickableContainer { - Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.Sender.Username}:", - Colour = getUsernameColour(Message), - TextSize = text_size, + AutoSizeAxes = Axes.Both, Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - } + Child = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + Text = $@"{Message.Sender.Username}:", + Colour = getUsernameColour(Message), + TextSize = text_size, + }, + Action = () => profileOverlay?.ShowUser(Message.Sender), + }, } }, new Container @@ -123,5 +131,11 @@ namespace osu.Game.Overlays.Chat } }; } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(UserProfileOverlay profileOverlay) + { + this.profileOverlay = profileOverlay; + } } }