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


C# Sim.GetRelationship方法代码示例

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


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

示例1: CanShareBed

        public static bool CanShareBed(Sim newSim, Sim simUsingBed, CommodityKind use, bool isTent)
        {
            try
            {
                if ((simUsingBed != null) && (simUsingBed != newSim))
                {
                    Relationship relationship = newSim.GetRelationship(simUsingBed, false);
                    if (relationship == null) return false;

                    if ((relationship.LTR == null) || (relationship.LTR.SimWasBetrayed(newSim)) || (relationship.LTR.SimWasBetrayed(simUsingBed)))
                    {
                        return false;
                    }

                    if (simUsingBed.InteractionQueue != null)
                    {
                        WooHoo runningInteraction = simUsingBed.InteractionQueue.RunningInteraction as WooHoo;
                        if ((runningInteraction != null) && (newSim != runningInteraction.Target))
                        {
                            return false;
                        }
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                Common.Exception(newSim, e);
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:32,代码来源:BedController.cs

示例2: DoAcceptReject

        public new static void DoAcceptReject(Sim actor, Sim target, Sim.GiveGift inst)
        {
            GameObject gift = inst.Gift;
            string message = "";
            string stingName = null;
            if (inst.RejectFromSpoiled)
            {
                if (DoesSimAlreadyOwnObject(target, gift))
                {
                    message = GiveGiftLocalizeString(target.IsFemale, "SpoiledAlreadyHave", new object[0x0]);
                }
                else
                {
                    message = GiveGiftLocalizeString(target.IsFemale, "SpoiledTooCheap", new object[0x0]);
                }
                InteractionInstance instance = Sim.GiveGiftTantrum.Singleton.CreateInstance(target, target, target.InheritedPriority(), false, true);
                target.InteractionQueue.PushAsContinuation(instance, true);
            }
            else
            {
                Relationship relationship = actor.GetRelationship(target, false);
                float liking = relationship.LTR.Liking;
                float num2 = 0f;
                List<TraitNames> randomList = new List<TraitNames>();
                TraitNames unknown = TraitNames.Unknown;
                GiveGiftTraitData data = null;
                InformationLearnedAboutSim sim = relationship.InformationAbout(target);
                foreach (Trait trait in target.TraitManager.List)
                {
                    if (sTraitToTraitDataMap.TryGetValue(trait.Guid, out data) && data.DoesTraitCareAboutObject(gift))
                    {
                        randomList.Add(trait.Guid);
                        num2 += data.Score;
                        if ((unknown == TraitNames.Unknown) && !sim.KnowsTrait(trait.Guid))
                        {
                            unknown = trait.Guid;
                        }
                    }
                }

                if (randomList.Count > 0x0)
                {
                    if (unknown == TraitNames.Unknown)
                    {
                        unknown = RandomUtil.GetRandomObjectFromList<TraitNames>(randomList);
                    }
                    else
                    {
                        sim.LearnTrait(unknown, actor.SimDescription, target.SimDescription);
                    }
                    message = sTraitToTraitDataMap[unknown].GetTNS(target);
                }

                float num3 = liking + num2;
                if (num3 >= Sim.GiveGiftTuning.kLTRToAcceptGift)
                {
                    stingName = "sting_give_gift_accept";
                    if (num3 >= Sim.GiveGiftTuning.kLTRToSuperAcceptGift)
                    {
                        message = GiveGiftLocalizeString(target.IsFemale, "UberAcceptGiftTNS", new object[0x0]);
                        stingName = "sting_give_gift_accept_super";
                    }
                    else if (liking >= Sim.GiveGiftTuning.kLTRToAcceptGift)
                    {
                        message = GiveGiftLocalizeString(target.IsFemale, "AcceptGiftTNS", new object[0x0]);
                    }
                    TransferGiftFromActorToTarget(actor, target, gift);
                }
                else
                {
                    if (liking < Sim.GiveGiftTuning.kLTRToAcceptGift)
                    {
                        message = GiveGiftLocalizeString(target.IsFemale, "RejectGiftTNS", new object[0x0]);
                    }
                    EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, actor, target, "PillowFight", false, false, false, CommodityTypes.Undefined));
                }
            }
            if (stingName != null)
            {
                actor.ShowTNSAndPlayStingIfSelectable(message, StyledNotification.NotificationStyle.kSimTalking, target.ObjectId, gift.ObjectId, stingName);
            }
            else
            {
                actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kSimTalking, target.ObjectId, gift.ObjectId);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:86,代码来源:GiveGiftEx.cs

示例3: GiveGiftProceduralTest

        public static bool GiveGiftProceduralTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {            
            OccultImaginaryFriend friend;
            if (actor.GetRelationship(target, false) == null)
            {
                return false;
            }
            if (SocialComponent.IsInServicePreventingSocialization(target))
            {
                return false;
            }
            if (!SocialComponent.WouldShowMultiLevelSocialPieMenu(actor, target))
            {
                return false;
            }
            if (OccultImaginaryFriend.TryGetOccultFromSim(target, out friend) && !friend.IsReal)
            {
                return false;
            }

            /*
            if (!Sim.GiveGift.Definition.DoesGiftForTargetSimExist(actor, target))
            {
                greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.GiveGift.GiveGiftLocalizeString(actor.IsFemale, "NoGiftsToGive", new object[0]));
                return false;
            }
             */
            return true;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:29,代码来源:GiveGiftEx.cs

示例4: UnicornInviteTest

        public static bool UnicornInviteTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (!target.IsUnicorn)
                {
                    return false;
                }
                if (!OccultUnicorn.IsNPCPoolUnicorn(target))
                {
                    return false;
                }
                Relationship relationship = actor.GetRelationship(target, false);
                if ((relationship == null) || (relationship.CurrentLTRLiking < PetSocialTunables.kUnicornMinLtrForInvite))
                {
                    return false;
                }

                /*
                if (!actor.Household.CanAddSpeciesToHousehold(target.SimDescription.Species))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString("Ui/Caption/MovingDialog:TooManyPets", new object[0x0]));
                    return false;
                }
                */
                return true;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return false;
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:33,代码来源:CommonSocials.cs


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