diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index bfbcf3d707..59e83fd385 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -55,6 +55,9 @@ namespace osu.Game.Online.Chat.Drawables private Color4 getUsernameColour(Message message) { + if (!string.IsNullOrEmpty(message.Sender?.Colour)) + return OsuColour.FromHex(message.Sender.Colour); + //todo: use User instead of Message when user_id is correctly populated. return username_colours[message.UserId % username_colours.Length]; } @@ -91,7 +94,7 @@ namespace osu.Game.Online.Chat.Drawables new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.User.Username}:", + Text = $@"{Message.Sender.Username}:", Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 2404bbe109..372e43be38 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Chat public readonly long Id; //todo: this should be inside sender. - [JsonProperty(@"user_id")] + [JsonProperty(@"sender_id")] public int UserId; [JsonProperty(@"target_type")] @@ -30,7 +30,7 @@ namespace osu.Game.Online.Chat public string Content; [JsonProperty(@"sender")] - public User User; + public User Sender; [JsonConstructor] public Message() diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5b9d30ee8e..9b3cdaf49d 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays var message = new Message { - User = api.LocalUser.Value, + Sender = api.LocalUser.Value, Timestamp = DateTimeOffset.Now, TargetType = TargetType.Channel, //TODO: read this from currentChannel TargetId = currentChannel.Id,