mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:52:55 +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)
|
public MatchMessage(Message message, LadderInfo info)
|
||||||
: base(message)
|
: base(message)
|
||||||
{
|
{
|
||||||
if (info.CurrentMatch.Value == null) return;
|
if (info.CurrentMatch.Value is TournamentMatch match)
|
||||||
|
{
|
||||||
if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
if (match.Team1.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
||||||
UsernameColour = TournamentGame.COLOUR_RED;
|
UsernameColour = TournamentGame.COLOUR_RED;
|
||||||
else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
else if (match.Team2.Value.Players.Any(u => u.OnlineID == Message.Sender.OnlineID))
|
||||||
UsernameColour = TournamentGame.COLOUR_BLUE;
|
UsernameColour = TournamentGame.COLOUR_BLUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user