当前位置: 首页>>代码示例>>C#>>正文


C# Sim.GetSituationOfType方法代码示例

本文整理汇总了C#中Sim.GetSituationOfType方法的典型用法代码示例。如果您正苦于以下问题:C# Sim.GetSituationOfType方法的具体用法?C# Sim.GetSituationOfType怎么用?C# Sim.GetSituationOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sim的用法示例。


在下文中一共展示了Sim.GetSituationOfType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestLetsStartGroup

        public static bool TestLetsStartGroup(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool isDate)
        {
            try
            {
                OccultImaginaryFriend friend;
                Service service = target.Service;
                if (((target.Service is GrimReaper) || (service is Butler)) || (target.IsNPC && target.SimDescription.IsGhost))
                {
                    return false;
                }
                else if (OccultImaginaryFriend.TryGetOccultFromSim(target, out friend) && !friend.IsReal)
                {
                    return false;
                }
                else if (Punishment.IsSimGrounded(actor) || Punishment.IsSimGrounded(target))
                {
                    return false;
                }

                GroupingSituation situationOfType = actor.GetSituationOfType<GroupingSituation>();
                if (situationOfType != null)
                {
                    if (situationOfType.IsSimInGroup(target))
                    {
                        return false;
                    }
                    else if (actor.HasTrait(TraitNames.Loner) && (situationOfType.Count >= GroupingSituation.kNumSimBeforeLonerQuits))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GroupingSituation.LocalizeString("FormDisabledForLoner", new object[0x0]));
                        return false;
                    }
                    else if (situationOfType.RomanticGrouping)
                    {
                        return false;
                    }
                    else if (isDate)
                    {
                        return false;
                    }
                    // Custom IsValidDateOrGroup
                    else if (!IsValidDateOrGroup(actor, target, isDate))
                    {
                        return false;
                    }

                    return !situationOfType.MaxGroupSizedReached();
                }

                if (actor.Household == target.Household)
                {
                    situationOfType = target.GetSituationOfType<GroupingSituation>();
                    if (situationOfType != null)
                    {
                        // Custom IsValidDateOrGroup
                        return (((!situationOfType.RomanticGrouping && !isDate) && IsValidDateOrGroup(actor, target, isDate)) && !situationOfType.MaxGroupSizedReached());
                    }
                }

                Sim sim = null;
                foreach (Sim sim2 in actor.Household.Sims)
                {
                    if (sim2 != actor)
                    {
                        situationOfType = sim2.GetSituationOfType<GroupingSituation>();
                        if ((situationOfType != null) && (situationOfType.Leader == sim2))
                        {
                            sim = sim2;
                            break;
                        }
                    }
                }

                // Custom IsValidDateOrGroup
                if (!IsValidDateOrGroup(actor, target, isDate))
                {
                    return false;
                }
                else if (sim != null)
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(actor.IsFemale, "Gameplay/Excel/Notifications/Notifications:GroupingAlreadyStarted", new object[] { sim }));
                    return false;
                }

                TraitManager traitManager = actor.TraitManager;
                if ((isDate && (traitManager != null)) && !traitManager.HasElement(TraitNames.HopelessRomantic))
                {
                    Relationship relationship = Relationship.Get(actor, target, false);
                    if ((relationship != null) && (SimClock.ElapsedTime(TimeUnit.Hours, relationship.WhenLastHadBadDate) < GroupingSituation.kBadDateCooldownTime))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GroupingSituation.LocalizeString("BadDateCooldownTooltip", new object[0x0]));
                        return false;
                    }
                }
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
//.........这里部分代码省略.........
开发者ID:Robobeurre,项目名称:NRaas,代码行数:101,代码来源:CommonSocials.cs

示例2: GetAllInteractionsForPieMenu

        public static IEnumerable<InteractionObjectPair> GetAllInteractionsForPieMenu(SocialComponent ths, Sim actor)
        {
            Sim mSim = ths.mSim;
            Relationship r = Relationship.Get(mSim, actor, false);
            if ((r == null) || (r.LTR.CurrentLTR == LongTermRelationshipTypes.Stranger))
            {
                sMsg += Common.NewLine + "NewConversation2";

                return SocialsForNewConversation(ths, actor, mSim, false);
            }
            if (ths.mSim.NeedsToBeGreeted(actor))
            {
                sMsg += Common.NewLine + "Greeting2";

                return ths.SocialsForGreeting(actor, ths.mSim);
            }
            LTRData data = LTRData.Get(r.LTR.CurrentLTR);
            bool flag = false;
            GroupingSituation situationOfType = actor.GetSituationOfType<GroupingSituation>();
            if (situationOfType != null)
            {
                flag = situationOfType.IsSimInGroup(mSim);
            }
            DateAndTime whenLastTalked = Relationship.GetWhenLastTalked(actor, mSim);
            if (((!flag && (actor.Conversation == null)) && ((actor.Household != mSim.Household) && (data.HowWellWeKnowEachOther <= 0x1))) && (SimClock.ElapsedTime(TimeUnit.Hours, whenLastTalked) > 24f))
            {
                sMsg += Common.NewLine + "NewConversation3";

                return SocialsForNewConversation(ths, actor, mSim, false);
            }
            if (!CelebrityManager.CanSocialize(actor, mSim))
            {
                sMsg += Common.NewLine + "Impress";

                return SocialComponent.SocialsForImpressCelebrity(actor, mSim);
            }

            sMsg += Common.NewLine + "All";

            return GetUnfilteredSocials(ths, actor, mSim, r);
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:41,代码来源:TestPopupMenu.cs

示例3: TestAskNPCToStayOver

        public static bool TestAskNPCToStayOver(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                OccultImaginaryFriend friend;
                if (isAutonomous)
                {
                    return false;
                }
                else if (!actor.IsAtHome)
                {
                    return false;
                }
                else if (actor.LotCurrent != target.LotCurrent)
                {
                    return false;
                }
                else if (actor.LotHome == target.LotHome)
                {
                    return false;
                }
                else if (!actor.IsSelectable)
                {
                    return false;
                }
                else if (!SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, VisitSituation.AskToStayOverTimeStart, VisitSituation.AskToStayOverTimeEnd))
                {
                    return false;
                }
                else if (target.Service != null)
                {
                    return false;
                }
                else if (!target.IsGreetedOnLot(actor.LotCurrent))
                {
                    return false;
                }
                else if (OccultImaginaryFriend.TryGetOccultFromSim(target, out friend) && !friend.IsReal)
                {
                    return false;
                }

                Relationship relationship = Relationship.Get(actor, target, false);
                if ((relationship != null) && (((relationship.mWhenAllowedToStayOverSimA.Ticks != 0x0L) && (SimClock.ElapsedTime(TimeUnit.Days, relationship.mWhenAllowedToStayOverSimA) < VisitSituation.AskToStayOverDaysPermission)) || ((relationship.mWhenAllowedToStayOverSimB.Ticks != 0x0L) && (SimClock.ElapsedTime(TimeUnit.Days, relationship.mWhenAllowedToStayOverSimB) < VisitSituation.AskToStayOverDaysPermission))))
                {
                    return false;
                }

                SimDescription targetSim = target.SimDescription;
                SimDescription actorSim = actor.SimDescription;
                if (actorSim.Child && !targetSim.Child) //|| (actorSim.Teen && !targetSim.Teen)) || (actorSim.YoungAdultOrAbove && !targetSim.YoungAdultOrAbove))
                {
                    return false;
                }

                SlumberParty situationOfType = target.GetSituationOfType<SlumberParty>();
                if ((situationOfType != null) && situationOfType.Guests.Contains(target))
                {
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:68,代码来源:CommonSocials.cs


注:本文中的Sim.GetSituationOfType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。