internal LobbyMember Add(AccountHandle handle) { if (!_members.TryGetValue(handle, out LobbyMember player)) { player = new LobbyMember(_lobby, handle); _members.Add(handle, player); OnMemberJoin?.Invoke(player); return(player); } throw new Exception("Cannot add a member that already exists in the lobby."); }
internal LobbyMember GetOrAdd(AccountHandle handle) { LobbyMember player; if (!_members.TryGetValue(handle, out player)) { player = new LobbyMember(_lobby, handle); _members.Add(handle, player); OnMemberJoin?.Invoke(player); } return(player); }