mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:02:54 +08:00
Fix background alternating not updating on message removal
This commit is contained in:
parent
997b3eb498
commit
5bc02cc1c6
@ -77,6 +77,9 @@ namespace osu.Game.Overlays.Chat
|
||||
get => alternatingBackground;
|
||||
set
|
||||
{
|
||||
if (alternatingBackground == value)
|
||||
return;
|
||||
|
||||
alternatingBackground = value;
|
||||
updateBackground();
|
||||
}
|
||||
@ -122,6 +125,7 @@ namespace osu.Game.Overlays.Chat
|
||||
Masking = true,
|
||||
Blending = BlendingParameters.Additive,
|
||||
CornerRadius = 4,
|
||||
Alpha = 0,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new Box
|
||||
{
|
||||
|
@ -84,6 +84,17 @@ namespace osu.Game.Overlays.Chat
|
||||
highlightedMessage.BindValueChanged(_ => processMessageHighlighting(), true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
for (int i = 0; i < ChatLineFlow.Count; i++)
|
||||
{
|
||||
if (ChatLineFlow[i] is ChatLine chatline)
|
||||
chatline.AlternatingBackground = i % 2 == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes any pending message in <see cref="highlightedMessage"/>.
|
||||
/// </summary>
|
||||
@ -104,17 +115,6 @@ namespace osu.Game.Overlays.Chat
|
||||
highlightedMessage.Value = null;
|
||||
});
|
||||
|
||||
private void updateBackgroundAlternating()
|
||||
{
|
||||
for (int i = 0; i < ChatLineFlow.Count; i++)
|
||||
{
|
||||
if (ChatLineFlow[i] is ChatLine chatline)
|
||||
{
|
||||
chatline.AlternatingBackground = i % 2 == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
@ -169,7 +169,6 @@ namespace osu.Game.Overlays.Chat
|
||||
scroll.ScrollToEnd();
|
||||
|
||||
processMessageHighlighting();
|
||||
updateBackgroundAlternating();
|
||||
});
|
||||
|
||||
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
||||
|
Loading…
Reference in New Issue
Block a user