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:
parent
e02a06e3e5
commit
9862992af0
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user