예제 #1
0
파일: Player.cs 프로젝트: Gherks/slask
        public string GetName()
        {
            PlayerReference playerReference = GetPlayerReference();

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

            return("");
        }
예제 #2
0
파일: Tournament.cs 프로젝트: Gherks/slask
        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
파일: Tournament.cs 프로젝트: Gherks/slask
        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
파일: Tournament.cs 프로젝트: Gherks/slask
        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
파일: Tournament.cs 프로젝트: Gherks/slask
        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);
        }