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

Remove adjacent day separators

This commit is contained in:
Dean Herbert 2019-10-29 15:45:41 +09:00
parent b06e70e546
commit 54befb6f8f

View File

@ -108,11 +108,25 @@ namespace osu.Game.Overlays.Chat
var staleMessages = chatLines.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
int count = staleMessages.Length - Channel.MAX_HISTORY;
for (int i = 0; i < count; i++)
if (count > 0)
{
var d = staleMessages[i];
scroll.OffsetScrollPosition(-d.DrawHeight);
d.Expire();
void expireAndAdjustScroll(Drawable d)
{
scroll.OffsetScrollPosition(-d.DrawHeight);
d.Expire();
}
for (int i = 0; i < count; i++)
expireAndAdjustScroll(staleMessages[i]);
// remove all adjacent day separators after stale message removal
for (int i = 0; i < ChatLineFlow.Count - 1; i++)
{
if (!(ChatLineFlow[i] is DaySeparator)) break;
if (!(ChatLineFlow[i + 1] is DaySeparator)) break;
expireAndAdjustScroll(ChatLineFlow[i]);
}
}
if (shouldScrollToEnd)