1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Use alternative guard

Early-returning from ctors feels pretty bad. Also saves on some
nested accesses.
This commit is contained in:
Bartłomiej Dach 2023-06-25 17:36:44 +02:00
parent e02a06e3e5
commit 9862992af0
No known key found for this signature in database

View File

@ -90,12 +90,13 @@ namespace osu.Game.Tournament.Components
public MatchMessage(Message message, LadderInfo info)
: base(message)
{
if (info.CurrentMatch.Value == null) return;
if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
UsernameColour = TournamentGame.COLOUR_RED;
else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
UsernameColour = TournamentGame.COLOUR_BLUE;
if (info.CurrentMatch.Value is TournamentMatch match)
{
if (match.Team1.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
UsernameColour = TournamentGame.COLOUR_RED;
else if (match.Team2.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
UsernameColour = TournamentGame.COLOUR_BLUE;
}
}
}
}