示例#1
0
        public bool ContainsCharacterWithAge(CharacterAge age)
        {
            var characterDetails = m_project.AllCharacterDetailDictionary;

            return(CharacterIds.Any(c =>
            {
                if (CharacterVerseData.IsCharacterStandard(c))
                {
                    return age == CharacterAge.Adult;
                }

                return characterDetails[c].Age == age;
            }));
        }
示例#2
0
        public bool ContainsCharacterWithGender(CharacterGender gender)
        {
            var characterDetails = m_project.AllCharacterDetailDictionary;

            return(CharacterIds.Any(c =>
            {
                if (CharacterVerseData.IsCharacterStandard(c))
                {
                    return gender == CharacterGender.Either;
                }

                return characterDetails[c].Gender == gender;
            }));
        }
示例#3
0
        /// <summary>
        /// We used to use this in character group generation. We no longer use it, but since there are a lot of tests for it and it might
        /// be useful in the future, we'll keep it around for now.
        /// </summary>
        public bool Matches(CharacterDetail character, CharacterGenderMatchingOptions genderMatchingOptions, CharacterAgeMatchingOptions ageMatchingOptions)
        {
            if (!CharacterIds.Any())
            {
                return(false);                // Probably a group set aside for a special purpose in the group generator (e.g., narrator)
            }
            if (CharacterVerseData.IsCharacterStandard(character.CharacterId))
            {
                switch (CharacterVerseData.GetStandardCharacterType(character.CharacterId))
                {
                case CharacterVerseData.StandardCharacter.Narrator:
                    return(CharacterIds.All(i => CharacterVerseData.GetStandardCharacterType(i) == CharacterVerseData.StandardCharacter.Narrator));

                default:
                    return(CharacterIds.All(i =>
                    {
                        var type = CharacterVerseData.GetStandardCharacterType(i);
                        return type != CharacterVerseData.StandardCharacter.Narrator && type != CharacterVerseData.StandardCharacter.NonStandard;
                    }));
                }
            }
            if (CharacterIds.Any(i => CharacterVerseData.IsCharacterStandard(i)))
            {
                return(false);
            }

            bool result = true;

            var characterDetails = m_project.AllCharacterDetailDictionary;

            result &= CharacterIds.All(i =>
            {
                CharacterGender gender = characterDetails[i].Gender;
                return(genderMatchingOptions.Matches(character.Gender, gender));
            });

            result &= CharacterIds.All(i =>
            {
                CharacterAge age = characterDetails[i].Age;
                return(ageMatchingOptions.Matches(character.Age, age));
            });

            return(result);
        }
示例#4
0
        public bool ContainsOnlyCharactersWithAge(CharacterAge age)
        {
            var characterDetails = m_project.AllCharacterDetailDictionary;

            return(CharacterIds.All(c =>
            {
                if (CharacterVerseData.IsCharacterStandard(c))
                {
                    return age == CharacterAge.Adult;
                }

                CharacterDetail characterDetail;
                if (!characterDetails.TryGetValue(c, out characterDetail))
                {
                    return false;
                }
                return characterDetail.Age == age;
            }));
        }
示例#5
0
        public bool ContainsCharacterWithGender(CharacterGender gender)
        {
            var characterDetails = m_project.AllCharacterDetailDictionary;

            return(CharacterIds.Any(c =>
            {
                if (CharacterVerseData.IsCharacterStandard(c))
                {
                    return gender == CharacterGender.Either;
                }

                CharacterDetail characterDetail;
                if (!characterDetails.TryGetValue(c, out characterDetail))
                {
                    return false;
                }
                return characterDetail.Gender == gender;
            }));
        }