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:
parent
b06e70e546
commit
54befb6f8f
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user