public string GetName() { PlayerReference playerReference = GetPlayerReference(); if (playerReference != null) { return(playerReference.Name); } return(""); }
public List <PlayerReference> GetPlayerReferencesByNames(List <string> playerReferenceNames) { List <PlayerReference> playerReferences = new List <PlayerReference>(); foreach (string playerReferenceName in playerReferenceNames) { PlayerReference playerReference = GetPlayerReferenceByName(playerReferenceName); if (playerReference != null) { playerReferences.Add(playerReference); } } return(playerReferences); }
public List <PlayerReference> GetPlayerReferencesByIds(List <Guid> playerReferenceIds) { List <PlayerReference> playerReferences = new List <PlayerReference>(); foreach (Guid playerReferenceId in playerReferenceIds) { PlayerReference playerReference = GetPlayerReferenceById(playerReferenceId); if (playerReference != null) { playerReferences.Add(playerReference); } } return(playerReferences); }
public PlayerReference RegisterPlayerReference(string name) { bool tournamentHasNotBegun = GetPlayState() == PlayStateEnum.NotBegun; bool nameIsNotRegistered = !PlayerReferences.Any(playerReference => playerReference.Name == name); bool nameIsNotEmpty = name.Length != 0; if (tournamentHasNotBegun && nameIsNotRegistered && nameIsNotEmpty) { PlayerReferences.Add(PlayerReference.Create(name, this)); OnPlayerReferencesChanged(); return(PlayerReferences.Last()); } return(null); }
public bool ExcludePlayerReference(string name) { bool tournamentHasNotBegun = GetPlayState() == PlayStateEnum.NotBegun; bool nameIsNotEmpty = name.Length != 0; if (tournamentHasNotBegun && nameIsNotEmpty) { PlayerReference playerReference = PlayerReferences.FirstOrDefault(playerReference => playerReference.Name == name); bool playerReferenceExistInRound = playerReference != null; if (playerReferenceExistInRound) { playerReference.MarkForDeletion(); PlayerReferences.Remove(playerReference); OnPlayerReferencesChanged(); return(true); } } return(false); }