Refactor ChatLine and fix DrawableChannel flow padding

Refactors `ChatLine` component to use more sensible override properties
and layout using grid container. Moves creation of username component
into its own method to simplify BDL.

Updates padding of base `DrawableChannel` flow padding.

Removes usage of `ChatOverlayDrawableChannel` since it's overrides are
no longer needed.

Updates usage of `StandAloneChatDisplay` to use new override properties
of `DrawableChannel`.
This commit is contained in:
Jai Sharma
2022-06-07 01:37:46 +01:00
parent 137ad74091
commit 2f635fa854
7 changed files with 114 additions and 158 deletions

View File

@ -160,13 +160,6 @@ namespace osu.Game.Online.Chat
{
}
[BackgroundDependencyLoader]
private void load()
{
// TODO: Remove once DrawableChannel & ChatLine padding is fixed
ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 };
}
protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m);
protected override DaySeparator CreateDaySeparator(DateTimeOffset time) => new StandAloneDaySeparator(time);
@ -176,8 +169,8 @@ namespace osu.Game.Online.Chat
{
protected override float TextSize => 14;
protected override float LineHeight => 1;
protected override float Spacing => 10;
protected override float DateAlign => 120;
protected override float Spacing => 5;
protected override float DateAlign => 125;
public StandAloneDaySeparator(DateTimeOffset time)
: base(time)
@ -189,17 +182,15 @@ namespace osu.Game.Online.Chat
{
Height = 25;
Colour = colours.Yellow;
// TODO: Remove once DrawableChannel & ChatLine padding is fixed
Padding = new MarginPadding { Horizontal = 10 };
}
}
protected class StandAloneMessage : ChatLine
{
protected override float TextSize => 15;
protected override float HorizontalPadding => 10;
protected override float MessagePadding => 120;
protected override float TimestampPadding => 50;
protected override float Spacing => 5;
protected override float TimestampWidth => 45;
protected override float UsernameWidth => 75;
public StandAloneMessage(Message message)
: base(message)