public void AddPlayer(LeaderboardPlayer player) { var existing = GetPlayerByUniqueId(player.UniqueId); if (null == existing) { Leaders.Add(player); } else if (existing == player) { } else { // Merge the existing user } }
public Session(ILeaderboardService leaderboardService, string gameId) { // also noted int MachineInfo - this might be the most difficult thing to port. See MachineInfo for details SessionBeginTime = DateTime.Now; LeaderboardService = leaderboardService; UserId = MachineInfo.GetMacAddress(); var leaderboard = leaderboardService.GetLeaderboardByGameId(gameId); Player = leaderboard.GetPlayerByUniqueId(UserId); if (null == Player) { Player = new LeaderboardPlayer() { UniqueId = UserId } } ; leaderboard.AddPlayer(Player); }