mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 14:55:37 +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;
|
get => alternatingBackground;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (alternatingBackground == value)
|
||||||
|
return;
|
||||||
|
|
||||||
alternatingBackground = value;
|
alternatingBackground = value;
|
||||||
updateBackground();
|
updateBackground();
|
||||||
}
|
}
|
||||||
@ -122,6 +125,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
Masking = true,
|
Masking = true,
|
||||||
Blending = BlendingParameters.Additive,
|
Blending = BlendingParameters.Additive,
|
||||||
CornerRadius = 4,
|
CornerRadius = 4,
|
||||||
|
Alpha = 0,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
|
@ -84,6 +84,17 @@ namespace osu.Game.Overlays.Chat
|
|||||||
highlightedMessage.BindValueChanged(_ => processMessageHighlighting(), true);
|
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>
|
/// <summary>
|
||||||
/// Processes any pending message in <see cref="highlightedMessage"/>.
|
/// Processes any pending message in <see cref="highlightedMessage"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -104,17 +115,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
highlightedMessage.Value = null;
|
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)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
@ -169,7 +169,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
scroll.ScrollToEnd();
|
scroll.ScrollToEnd();
|
||||||
|
|
||||||
processMessageHighlighting();
|
processMessageHighlighting();
|
||||||
updateBackgroundAlternating();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user