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


C# Sim.ShowTNSAndPlayStingIfSelectable方法代码示例

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


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

示例1: 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

示例2: OnStrayPetAdopted

        public static void OnStrayPetAdopted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                Household household = actor.Household;
                //if (household.CanAddSpeciesToHousehold(target.SimDescription.Species))
                {
                    if (TwoButtonDialog.Show(Localization.LocalizeString(actor.IsFemale, "Gameplay/Actors/Sim/StrayPets:AdoptionConfirmation", new object[] { actor, target }), LocalizationHelper.Yes, LocalizationHelper.No))
                    {
                        if (actor.IsSelectable)
                        {
                            string titleText = Localization.LocalizeString(target.IsFemale, "Gameplay/Actors/Sim/StrayPets:AdoptStrayNameTitle", new object[0x0]);
                            string promptText = Localization.LocalizeString(target.IsFemale, "Gameplay/Actors/Sim/StrayPets:AdoptStrayNameDescription", new object[0x0]);
                            target.SimDescription.FirstName = StringInputDialog.Show(titleText, promptText, target.SimDescription.FirstName, 256, StringInputDialog.Validation.SimNameText);
                        }

                        target.SimDescription.LastName = actor.SimDescription.LastName;
                        actor.ShowTNSAndPlayStingIfSelectable(Localization.LocalizeString("Gameplay/Actors/Sim/StrayPets:AdoptionAcceptedTNS", new object[] { target, actor.Household.Name }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, target.ObjectId, "sting_pet_adopt");
                        target.BuffManager.RemoveElement(BuffNames.StrayPet);

                        Relationships.CheckAddHumanParentFlagOnAdoption(actor.SimDescription, target.SimDescription);

                        if (actor.Partner != null)
                        {
                            Relationships.CheckAddHumanParentFlagOnAdoption(actor.Partner, target.SimDescription);
                        }

                        PetAdoption.PetAdoptionEnd(target, actor, true);
                        PetPoolManager.RemovePet(target.IsCat ? PetPoolType.StrayCat : PetPoolType.StrayDog, target.SimDescription, true);
                        household.AddSim(target);
                    }
                    else
                    {
                        actor.ShowTNSIfSelectable(Localization.LocalizeString("Gameplay/Actors/Sim/StrayPets:AdoptionDeclinedTNS", new object[] { target, actor.Household.Name }), StyledNotification.NotificationStyle.kGameMessageNegative, ObjectGuid.InvalidObjectGuid, target.ObjectId);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:42,代码来源:CommonSocials.cs


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