Пример #1
0
        public string GetName()
        {
            PlayerReference playerReference = GetPlayerReference();

            if (playerReference != null)
            {
                return(playerReference.Name);
            }

            return("");
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }