1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:33:05 +08:00

Fix DrawableChannel async flow

This commit is contained in:
Dean Herbert 2019-06-20 23:01:39 +09:00
parent 4ef165fdac
commit 4a25a84975
2 changed files with 16 additions and 8 deletions

View File

@ -130,6 +130,11 @@ namespace osu.Game.Online.Chat
public StandAloneDrawableChannel(Channel channel) public StandAloneDrawableChannel(Channel channel)
: base(channel) : base(channel)
{
}
[BackgroundDependencyLoader]
private void load()
{ {
ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 }; ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 };
} }

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using osu.Framework.Allocation;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -17,15 +18,18 @@ namespace osu.Game.Overlays.Chat
public class DrawableChannel : Container public class DrawableChannel : Container
{ {
public readonly Channel Channel; public readonly Channel Channel;
protected readonly ChatLineContainer ChatLineFlow; protected ChatLineContainer ChatLineFlow;
private readonly OsuScrollContainer scroll; private OsuScrollContainer scroll;
public DrawableChannel(Channel channel) public DrawableChannel(Channel channel)
{ {
Channel = channel; Channel = channel;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[] Children = new Drawable[]
{ {
scroll = new OsuScrollContainer scroll = new OsuScrollContainer
@ -48,18 +52,17 @@ namespace osu.Game.Overlays.Chat
}, },
} }
}; };
}
protected override void LoadComplete()
{
base.LoadComplete();
newMessagesArrived(Channel.Messages); newMessagesArrived(Channel.Messages);
Channel.NewMessagesArrived += newMessagesArrived; Channel.NewMessagesArrived += newMessagesArrived;
Channel.MessageRemoved += messageRemoved; Channel.MessageRemoved += messageRemoved;
Channel.PendingMessageResolved += pendingMessageResolved; Channel.PendingMessageResolved += pendingMessageResolved;
}
protected override void LoadComplete()
{
base.LoadComplete();
scrollToEnd(); scrollToEnd();
} }