1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

FIx code quality

This commit is contained in:
normalid 2024-07-27 18:48:45 +08:00
parent 7f4bfb25a9
commit 73a98b45e9
3 changed files with 8 additions and 6 deletions

View File

@ -4,15 +4,11 @@
using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Testing;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Chat;
using osu.Game.Overlays;
using osu.Game.Overlays.Chat;
namespace osu.Game.Tests.Visual.Online
@ -47,6 +43,7 @@ namespace osu.Game.Tests.Visual.Online
Id = 3,
Username = "LocalUser"
};
string uuid = Guid.NewGuid().ToString();
AddStep("add local echo message", () => channel.AddLocalEcho(new LocalEchoMessage
{
@ -104,7 +101,7 @@ namespace osu.Game.Tests.Visual.Online
int messageCount = 1;
AddRepeatStep($"add messages", () =>
AddRepeatStep("add messages", () =>
{
channel.AddNewMessages(new Message(messageCount)
{
@ -116,7 +113,6 @@ namespace osu.Game.Tests.Visual.Online
messageCount++;
}, 10);
AddUntilStep("10 message present", () => drawableChannel.ChildrenOfType<ChatLine>().Count() == 10);
int checkCount = 0;

View File

@ -81,12 +81,14 @@ namespace osu.Game.Overlays.Chat
alteringBackground = value;
if (background == null)
{
AddInternal(background = new Box
{
BypassAutoSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
});
}
background.Alpha = value ? 0.04f : 0f;
}

View File

@ -107,8 +107,12 @@ namespace osu.Game.Overlays.Chat
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)