Пример #1
0
        public static bool PerformAfterschoolPostLoop(GoToSchoolInRabbitHole interaction, AfterschoolActivity activity)
        {
            AfterschoolActivityData data = AfterschoolActivityBooter.GetActivity(activity.CurrentActivityType);

            data.PerformPostLoop(interaction, activity);
            return(true);
        }
Пример #2
0
        public static bool AlreadyHasChildActivity(SimDescription actor)
        {
            if (!actor.Child)
            {
                return(false);
            }

            School school = actor.CareerManager.School;

            if (school != null)
            {
                List <AfterschoolActivity> afterschoolActivities = school.AfterschoolActivities;
                if (afterschoolActivities != null)
                {
                    foreach (AfterschoolActivity activity2 in afterschoolActivities)
                    {
                        AfterschoolActivityData data = AfterschoolActivityBooter.GetActivity(activity2.CurrentActivityType);
                        if (data == null)
                        {
                            continue;
                        }

                        if (data.IsChild)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Пример #3
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");
            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError(file + ": Guid empty");
                return;
            }

            AfterschoolActivityType type = unchecked((AfterschoolActivityType)ResourceUtils.HashString64(guid));

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

            List<string> skills = row.GetStringList("Skills", ',');
            if (skills != null)
            {
                foreach (string skillStr in skills)
                {
                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr);
                    if (skill == SkillNames.None)
                    {
                        BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr);
                        return;
                    }
                    else
                    {
                        data.mActivity.ActivitySkillNameList.Add(skill);
                    }
                }
            }

            if (data.mActivity.ActivitySkillNameList.Count == 0)
            {
                BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill");
                return;
            }

            DaysOfTheWeek days;
            if (!row.TryGetEnum<DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek"));
                return;
            }

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders"));
                return;
            }

            data.mGenders = genders;

            CASAgeGenderFlags ages;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages"));
                return;
            }

            data.mAges = ages;

            if (row.Exists("PreLoop"))
            {
                data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPreLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop"));
                    return;
                }
            }

            if (row.Exists("Loop"))
            {
                data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop"));
                    return;
                }
            }

            if (row.Exists("PostLoop"))
            {
                data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPostLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop"));
                    return;
                }
            }

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
Пример #4
0
        public static InteractionInstance.InsideLoopFunction PerformAfterschoolLoop(GoToSchoolInRabbitHole interaction, AfterschoolActivity activity)
        {
            AfterschoolActivityData data = AfterschoolActivityBooter.GetActivity(activity.CurrentActivityType);

            return(data.LoopDelegate(interaction, activity));
        }