1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 18:13:09 +08:00

Fix typos and visuals

This commit is contained in:
Dean Herbert 2024-07-29 20:16:41 +09:00
parent 5ec46a79b4
commit 997b3eb498
No known key found for this signature in database
3 changed files with 68 additions and 66 deletions

View File

@ -115,7 +115,7 @@ namespace osu.Game.Tests.Visual.Online
AddRepeatStep("check background", () =>
{
// +1 because the day separator take one index
Assert.AreEqual((checkCount + 1) % 2 == 0, drawableChannel.ChildrenOfType<ChatLine>().ToList()[checkCount].AlteringBackground);
Assert.AreEqual((checkCount + 1) % 2 == 0, drawableChannel.ChildrenOfType<ChatLine>().ToList()[checkCount].AlternatingBackground);
checkCount++;
}, 10);
}

View File

@ -70,14 +70,14 @@ namespace osu.Game.Overlays.Chat
private Drawable? background;
private bool alteringBackground;
private bool alternatingBackground;
public bool AlteringBackground
public bool AlternatingBackground
{
get => alteringBackground;
get => alternatingBackground;
set
{
alteringBackground = value;
alternatingBackground = value;
updateBackground();
}
}
@ -115,7 +115,21 @@ namespace osu.Game.Overlays.Chat
configManager.BindWith(OsuSetting.Prefer24HourTime, prefer24HourTime);
prefer24HourTime.BindValueChanged(_ => updateTimestamp());
InternalChild = new GridContainer
InternalChildren = new[]
{
background = new Container
{
Masking = true,
Blending = BlendingParameters.Additive,
CornerRadius = 4,
RelativeSizeAxes = Axes.Both,
Child = new Box
{
Colour = Color4.White,
RelativeSizeAxes = Axes.Both,
},
},
new GridContainer
{
Margin = new MarginPadding
{
@ -161,7 +175,10 @@ namespace osu.Game.Overlays.Chat
}
},
}
}
};
updateBackground();
}
protected override void LoadComplete()
@ -279,23 +296,8 @@ namespace osu.Game.Overlays.Chat
private void updateBackground()
{
if (alteringBackground)
{
if (background?.IsAlive != true)
{
AddInternal(background = new Circle
{
MaskingSmoothness = 2.5f,
Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
});
}
background.Alpha = 0.04f;
}
else
background?.Expire();
if (background != null)
background.Alpha = alternatingBackground ? 0.03f : 0;
}
}
}

View File

@ -104,13 +104,13 @@ namespace osu.Game.Overlays.Chat
highlightedMessage.Value = null;
});
private void processChatlineBackgroundAltering()
private void updateBackgroundAlternating()
{
for (int i = 0; i < ChatLineFlow.Count; i++)
{
if (ChatLineFlow[i] is ChatLine chatline)
{
chatline.AlteringBackground = i % 2 == 0;
chatline.AlternatingBackground = i % 2 == 0;
}
}
}
@ -169,7 +169,7 @@ namespace osu.Game.Overlays.Chat
scroll.ScrollToEnd();
processMessageHighlighting();
processChatlineBackgroundAltering();
updateBackgroundAlternating();
});
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>