mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 12:32:58 +08:00
Remove adjacent day separators
This commit is contained in:
parent
b06e70e546
commit
54befb6f8f
@ -108,13 +108,27 @@ namespace osu.Game.Overlays.Chat
|
|||||||
var staleMessages = chatLines.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
|
var staleMessages = chatLines.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
|
||||||
int count = staleMessages.Length - Channel.MAX_HISTORY;
|
int count = staleMessages.Length - Channel.MAX_HISTORY;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
if (count > 0)
|
||||||
|
{
|
||||||
|
void expireAndAdjustScroll(Drawable d)
|
||||||
{
|
{
|
||||||
var d = staleMessages[i];
|
|
||||||
scroll.OffsetScrollPosition(-d.DrawHeight);
|
scroll.OffsetScrollPosition(-d.DrawHeight);
|
||||||
d.Expire();
|
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)
|
if (shouldScrollToEnd)
|
||||||
scrollToEnd();
|
scrollToEnd();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user