/// <summary>
/// Adds a user to his/her Match.
/// If it doesn't exist yet then it will be created.
/// </summary>
/// <param name="user">The user (that was just created), to be added to the match.</param>
private void AddToMatch(User user)
{
Match match;
// Try and find match
if (_matches.TryGetValue(user.MatchId, out match))
{
match.AddUser(user);
if (DEBUG)
Console.WriteLine("DEBUG: Added " + user.Username + " to match");
}
// Match not found, create it
else
{
match = new Match()
{
ID = user.MatchId
};
match.AddUser(user);
_matches.TryAdd(user.MatchId, match);
if (DEBUG)
Console.WriteLine("DEBUG: Created new match and added " + user.Username + " to it.");
}
}