mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 06:13:04 +08:00
Implement chatline background altering
This commit is contained in:
parent
565107205c
commit
c2711d0c4e
@ -69,6 +69,29 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private Container? highlight;
|
private Container? highlight;
|
||||||
|
|
||||||
|
private Drawable? background;
|
||||||
|
|
||||||
|
private bool alteringBackground;
|
||||||
|
|
||||||
|
public bool AlteringBackground
|
||||||
|
{
|
||||||
|
get => alteringBackground;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
alteringBackground = value;
|
||||||
|
|
||||||
|
if (background == null)
|
||||||
|
AddInternal(background = new Box
|
||||||
|
{
|
||||||
|
BypassAutoSizeAxes = Axes.Both,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
});
|
||||||
|
|
||||||
|
background.Alpha = value ? 0.04f : 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The colour used to paint the author's username.
|
/// The colour used to paint the author's username.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -104,6 +104,13 @@ namespace osu.Game.Overlays.Chat
|
|||||||
highlightedMessage.Value = null;
|
highlightedMessage.Value = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private void processMessageBackgroundAltering()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ChatLineFlow.Count(); i++)
|
||||||
|
if (ChatLineFlow[i] is ChatLine chatline)
|
||||||
|
chatline.AlteringBackground = i % 2 == 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
@ -158,6 +165,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
scroll.ScrollToEnd();
|
scroll.ScrollToEnd();
|
||||||
|
|
||||||
processMessageHighlighting();
|
processMessageHighlighting();
|
||||||
|
processMessageBackgroundAltering();
|
||||||
});
|
});
|
||||||
|
|
||||||
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user