コード例 #1
0
        public uint ChooseRandomLifetimeWish(DreamsAndPromisesManager ths)
        {
            List <IInitialMajorWish> topMajorDreamMatches = DreamsAndPromisesManager.GetTopMajorDreamMatches(ths.mActor.SimDescription);

            for (int i = topMajorDreamMatches.Count - 1; i >= 0; i--)
            {
                if (HasValue <DisallowLTWOption, LifetimeWant>((LifetimeWant)topMajorDreamMatches[i].PrimitiveId))
                {
                    topMajorDreamMatches.RemoveAt(i);
                }
            }

            if (topMajorDreamMatches.Count > 0x0)
            {
                return(RandomUtil.GetRandomObjectFromList <IInitialMajorWish>(topMajorDreamMatches).PrimitiveId);
            }

            return(0x0);
        }
コード例 #2
0
        public static bool SetLifetimeWant(SimDescription me)
        {
            List <IInitialMajorWish> topMajorDreamMatches = DreamsAndPromisesManager.GetTopMajorDreamMatches(me);
            List <IInitialMajorWish> allMajorDreamMatches = DreamsAndPromisesManager.GetAllMajorDreamMatches(me);

            if ((topMajorDreamMatches.Count > 0x0) || (allMajorDreamMatches.Count > 0x0))
            {
                uint oldLifetimeWish = me.LifetimeWish;
                uint newLifetimeWish = LifetimeWishSelectionDialog.Show(me, Localization.LocalizeString("Ui/Caption/LifetimeWishSelectionDialog:InitialCaption", new object[0x0]), topMajorDreamMatches, allMajorDreamMatches, true);
                if ((oldLifetimeWish != newLifetimeWish) && (newLifetimeWish != 0x0))
                {
                    me.HasCompletedLifetimeWish = false;
                    me.LifetimeWish             = newLifetimeWish;

                    if (me.CreatedSim.DreamsAndPromisesManager != null)
                    {
                        me.CreatedSim.DreamsAndPromisesManager.TryAddLifetimeWish();
                        return(true);
                    }
                }
            }

            return(false);
        }