Add truncatino of long usernames in chat

This commit is contained in:
Dean Herbert
2019-09-06 19:00:49 +09:00
parent e5c3a906d7
commit 374479f837
2 changed files with 116 additions and 2 deletions

View File

@ -31,6 +31,8 @@ namespace osu.Game.Overlays.Chat
protected virtual float MessagePadding => default_message_padding;
private const float timestamp_padding = 70;
private const float default_horizontal_padding = 15;
protected virtual float HorizontalPadding => default_horizontal_padding;
@ -87,7 +89,10 @@ namespace osu.Game.Overlays.Chat
{
Shadow = false,
Colour = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length],
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
Truncate = true,
EllipsisString = ".. :",
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true),
RelativeSizeAxes = Axes.Both,
};
if (hasBackground)
@ -141,7 +146,8 @@ namespace osu.Game.Overlays.Chat
},
new MessageSender(message.Sender)
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = timestamp_padding },
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Child = effectedUsername,