コード例 #1
0
        public override bool InRabbitHole()
        {
            try
            {
                OpportunityDialog.MaptagObjectInfo info;
                if (!UIUtils.IsOkayToStartModalDialog() || !Sims3.Gameplay.ActiveCareer.ActiveCareer.CanAddActiveCareer(Actor.SimDescription, CareerToSet))
                {
                    return(false);
                }

                SkillBasedCareerStaticData occupationStaticData = Occupation.GetOccupationStaticData(CareerToSet) as SkillBasedCareerStaticData;
                Occupation staticOccupation    = CareerManager.GetStaticOccupation(CareerToSet);
                string     localizedCareerName = Occupation.GetLocalizedCareerName(CareerToSet, Actor.SimDescription);
                string     description         = Common.LocalizeEAString(Actor.IsFemale, occupationStaticData.CareerDescriptionLocalizationKey, new object[0x0]);
                string     reward = string.Empty;
                foreach (string str4 in staticOccupation.ResponsibilitiesLocalizationKeys)
                {
                    reward = reward + Common.LocalizeEAString(Actor.IsFemale, str4, new object[0x0]) + Common.NewLine;
                }
                info.mLotId          = 0x0L;
                info.mMapTag         = null;
                info.mObjectGuid     = ObjectGuid.InvalidObjectGuid;
                info.mHouseholdLotId = ulong.MaxValue;
                bool flag = OpportunityDialog.Show(ThumbnailKey.kInvalidThumbnailKey, Actor.ObjectId, ObjectGuid.InvalidObjectGuid, Actor.Name, OpportunityDialog.OpportunityType.SkillBasedCareer, localizedCareerName, description, string.Empty, reward, info, true, OpportunityDialog.DescriptionBackgroundType.NotSet, Actor.IsFemale, false);
                if (flag)
                {
                    AcquireOccupationParameters occupationParameters = new AcquireOccupationParameters(CareerToSet, true, false);

                    OmniCareer tempCareer = new OmniCareer();
                    tempCareer.mCareerGuid = staticOccupation.Guid;

                    occupationParameters.Location        = new CareerLocation();
                    occupationParameters.Location.Career = tempCareer;

                    return(Actor.AcquireOccupation(occupationParameters));
                }
                return(flag);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }