mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Add user colour support.
This commit is contained in:
parent
3129708ccb
commit
dda3fb85ee
@ -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,
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user