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


C# SimDescription.RemoveSocialGroupTrait方法代码示例

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


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

示例1: Run

        protected override bool Run(SimDescription me, bool singleSelection)
        {
            List<SimTrait.Item> allOptions = new List<SimTrait.Item>();
            foreach (Sims3.Gameplay.ActorSystems.Trait trait in TraitManager.GetDictionaryTraits)
            {
                if (trait.IsReward) continue;

                if (trait.Guid == TraitNames.DescendantHiddenTrait) continue;

                if (!trait.TraitValidForAgeSpecies(me.GetCASAGSAvailabilityFlags())) continue;

                if (trait.RobotOnly) continue;                

                int count = 0;
                if (me.TraitManager.HasElement(trait.Guid))
                {
                    count = 1;
                }

                allOptions.Add(new SimTrait.Item (trait.Guid, count));
            }

            CommonSelection<SimTrait.Item>.Results selection = new CommonSelection<SimTrait.Item>(Name, me.FullName, allOptions, new SimTrait.AuxillaryColumn()).SelectMultiple();
            if (selection.Count == 0) return false;

            foreach (SimTrait.Item item in selection)
            {
                if (item == null) continue;

                TraitNames traitName = item.Value;

                Sims3.Gameplay.ActorSystems.Trait trait = TraitManager.GetTraitFromDictionary(traitName);
                if (trait != null)
                {
                    if (me.TraitManager.HasElement(traitName))
                    {
                        if (me.TraitManager.mSocialGroupTraitGuid == traitName)
                        {
                            me.RemoveSocialGroupTrait();
                        }
                        else if (me.TraitManager.mUniversityGraduateTraitGuid == traitName)
                        {
                            me.RemoveUniversityGraduateTrait();
                        }
                        else
                        {
                            me.RemoveTrait(trait);
                        }
                    }
                    else
                    {
                        int iTraitsForBabiesAndToddlers = TraitManager.kTraitsForBabiesAndToddlers;
                        int iTraitsForChildren = TraitManager.kTraitsForChildren;
                        int iTraitsForTeens = TraitManager.kTraitsForTeens;
                        int iTraitsForYoungAdultAndOlder = TraitManager.kTraitsForYoungAdultAndOlder;

                        try
                        {
                            // Don't use MaxValue as EA adds to this number for [[University]] purposes
                            TraitManager.kTraitsForBabiesAndToddlers = 10000000;
                            TraitManager.kTraitsForChildren = 10000000;
                            TraitManager.kTraitsForTeens = 10000000;
                            TraitManager.kTraitsForYoungAdultAndOlder = 10000000;

                            if (trait.IsHidden)
                            {
                                me.TraitManager.AddHiddenElement(traitName);
                            }
                            else
                            {
                                me.AddTrait(trait);
                            }
                        }
                        finally
                        {
                            TraitManager.kTraitsForBabiesAndToddlers = iTraitsForBabiesAndToddlers;
                            TraitManager.kTraitsForChildren = iTraitsForChildren;
                            TraitManager.kTraitsForTeens = iTraitsForTeens;
                            TraitManager.kTraitsForYoungAdultAndOlder = iTraitsForYoungAdultAndOlder;
                        }
                    }
                }
            }

            if ((me.CreatedSim != null) && (me.CreatedSim.SocialComponent != null))
            {
                me.CreatedSim.SocialComponent.UpdateTraits();
            }

            if (me.TraitManager.CountVisibleTraits() > me.TraitManager.NumTraitsForAge())
            {
                Common.Notify(Common.Localize("ChangeTraits:MaxExceeded", me.IsFemale, new object[] { me, me.TraitManager.CountVisibleTraits(), me.TraitManager.NumTraitsForAge() }));
            }

            return true;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:96,代码来源:ChangeTraits.cs


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