mirror of
https://github.com/ppy/osu
synced 2025-01-29 01:03:01 +00:00
Scroll chat to end of buffer when posting a new message
This commit is contained in:
parent
bc71ff76b1
commit
70ee7e4afd
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Chat
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
scrollToEnd();
|
||||
ScrollToEnd();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Chat
|
||||
if (!IsLoaded) return;
|
||||
|
||||
if (scroll.IsScrolledToEnd(10) || !flow.Children.Any())
|
||||
scrollToEnd();
|
||||
ScrollToEnd();
|
||||
|
||||
var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
|
||||
int count = staleMessages.Length - Channel.MAX_HISTORY;
|
||||
@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Chat
|
||||
flow.Children.FirstOrDefault(c => c.Message == removed)?.FadeColour(Color4.Red, 400).FadeOut(600).Expire();
|
||||
}
|
||||
|
||||
private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
||||
public void ScrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
||||
|
||||
private class ChatLineContainer : FillFlowContainer<ChatLine>
|
||||
{
|
||||
|
@ -475,6 +475,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
if (target == null) return;
|
||||
|
||||
currentChannelContainer.Child.ScrollToEnd();
|
||||
|
||||
if (!api.IsLoggedIn)
|
||||
{
|
||||
target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!"));
|
||||
|
Loading…
Reference in New Issue
Block a user