本文整理汇总了C#中SimDescription.RemoveTrait方法的典型用法代码示例。如果您正苦于以下问题:C# SimDescription.RemoveTrait方法的具体用法?C# SimDescription.RemoveTrait怎么用?C# SimDescription.RemoveTrait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimDescription
的用法示例。
在下文中一共展示了SimDescription.RemoveTrait方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
protected override bool Run(SimDescription me, bool singleSelection)
{
if (!ApplyAll)
{
List<SimTrait.Item> allOptions = new List<SimTrait.Item>();
foreach (Sims3.Gameplay.ActorSystems.Trait trait in TraitManager.GetDictionaryTraits)
{
if (!me.TraitManager.HasElement(trait.Guid)) continue;
if (!trait.IsReward) continue;
allOptions.Add(new SimTrait.Item(trait.Guid, 1));
}
mSelection = new CommonSelection<SimTrait.Item>(Name, me.FullName, allOptions).SelectMultiple();
if ((mSelection == null) || (mSelection.Count == 0)) return false;
}
foreach (SimTrait.Item item in mSelection)
{
if (item == null) continue;
TraitNames traitName = item.Value;
if (!me.TraitManager.HasElement(traitName)) continue;
Sims3.Gameplay.ActorSystems.Trait trait = TraitManager.GetTraitFromDictionary(traitName);
if (trait != null)
{
me.RemoveTrait(trait);
me.mSpendableHappiness += trait.Score;
}
}
if ((me.CreatedSim != null) && (me.CreatedSim.SocialComponent != null))
{
me.CreatedSim.SocialComponent.UpdateTraits();
}
return true;
}
示例2: 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;
}