public override void OnPlayerConnect(Player plr, bool gameRunning) { PlayerMatchData d = GetPlayerMatchData(plr); if (d != null) { d.IsOnline = true; } else { Logger.Warn("Reconnected player " + plr.Data.Name + " but has no data in tournament"); } }
protected void SetPlayedTogether(Player plr1, Player plr2) { PlayerMatchData d = GetPlayerMatchData(plr1); if (d != null) { d.playedWith.Add(plr2.Data.HashId); } plr1.Data.PlayedMatches += 1; d = GetPlayerMatchData(plr2); if (d != null) { d.playedWith.Add(plr1.Data.HashId); } plr2.Data.PlayedMatches += 1; }
public override void OnPlayerLeave(Player plr, bool gameRunning) { PlayerMatchData d = GetPlayerMatchData(plr); if (d != null) { if (plr.IsActivePlayer() && gameRunning) { Player otherPlr = players.Find(p => p.IsActivePlayer() && p.Data.Id != plr.Data.Id); SetPlayedTogether(plr, otherPlr); GetPlayerMatchData(otherPlr).WonGames++; otherPlr.Data.WonMatches++; } d.IsOnline = false; } else { Logger.Warn("Left player " + plr.Data.Name + " but has no data in tournament"); } }