From 4a25a84975cfe994d2870b29e5d9b89d072bacd4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jun 2019 23:01:39 +0900 Subject: [PATCH] Fix DrawableChannel async flow --- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 5 +++++ osu.Game/Overlays/Chat/DrawableChannel.cs | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index ae4a056033..9dab2f2aba 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -130,6 +130,11 @@ namespace osu.Game.Online.Chat public StandAloneDrawableChannel(Channel channel) : base(channel) + { + } + + [BackgroundDependencyLoader] + private void load() { ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; } diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 7d28df3210..8d56e250fc 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using osu.Framework.Allocation; using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,15 +18,18 @@ namespace osu.Game.Overlays.Chat public class DrawableChannel : Container { public readonly Channel Channel; - protected readonly ChatLineContainer ChatLineFlow; - private readonly OsuScrollContainer scroll; + protected ChatLineContainer ChatLineFlow; + private OsuScrollContainer scroll; public DrawableChannel(Channel channel) { Channel = channel; - RelativeSizeAxes = Axes.Both; + } + [BackgroundDependencyLoader] + private void load() + { Children = new Drawable[] { scroll = new OsuScrollContainer @@ -48,18 +52,17 @@ namespace osu.Game.Overlays.Chat }, } }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); newMessagesArrived(Channel.Messages); Channel.NewMessagesArrived += newMessagesArrived; Channel.MessageRemoved += messageRemoved; Channel.PendingMessageResolved += pendingMessageResolved; + } + protected override void LoadComplete() + { + base.LoadComplete(); scrollToEnd(); }