protected ProcessOutfitTask(Sim sim, List <BodyTypes> types, CASParts.Key sourceKey, List <OutfitCategories> ignore) { mSim = sim; mTypes = types; mSourceKey = sourceKey; mIgnore = ignore; }
protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { CASParts.Key currentKey = new CASParts.Key(sim.CreatedSim); if (outfitKey == currentKey) { return; } switch (outfitKey.mCategory) { case OutfitCategories.Everyday: case OutfitCategories.Athletic: case OutfitCategories.Formalwear: case OutfitCategories.Swimwear: case OutfitCategories.Sleepwear: case OutfitCategories.Career: case OutfitCategories.Outerwear: // Don't allow the user to remove the last of a category if (sim.GetOutfitCount(outfitKey.mCategory) == 1) { return; } break; } CASParts.RemoveOutfit(sim, outfitKey, false); }
protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { SimOutfit source = CASParts.GetOutfit(sim, outfitKey, false); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(Dresser.GetStoreOutfitKey(outfitKey.mCategory, sim.IsUsingMaternityOutfits)), source, true)) { } }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { CASParts.Key currentKey = new CASParts.Key(sim.CreatedSim); if (outfitKey == currentKey) { return(false); } return(true); }
protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false); SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(displayKey.mCategory, sim), geneOutfit)) { new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes); } }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { displayKey = new CASParts.Key(sCategories[outfitKey.GetIndex()], 0); outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(sCategories[outfitKey.GetIndex()], sim.IsUsingMaternityOutfits)); alternate = true; if (CASParts.GetOutfit(sim, outfitKey, true) == null) { return(false); } return(true); }
protected override bool Run(SimDescription me, bool singleSelection) { if (!ApplyAll) { List <OutfitCategories> categories = new List <OutfitCategories>(); foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories))) { if (category == OutfitCategories.Special) { continue; } categories.Add(category); } List <Item> allOptions = GetOptions(me, categories); CommonSelection <Item> .Results choices = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectMultiple(); if ((choices == null) || (choices.Count == 0)) { return(false); } mOutfits.Clear(); mOutfits.AddRange(choices); } CASParts.Key currentKey = new CASParts.Key(me.CreatedSim); // Remove them in reverse to ensure that removing earlier indices doesn't alter the index of later ones for (int i = mOutfits.Count - 1; i >= 0; i--) { Item item = mOutfits[i]; if (item.Value == currentKey) { continue; } me.RemoveOutfit(item.Category, item.Index, true); } return(true); }
protected override OptionResult Run(GameHitParameters <Sim> parameters) { List <Item> allOptions = new List <Item>(); foreach (OutfitCategories category in GetCategories(parameters.mTarget.SimDescription)) { int count = GetOutfitCount(parameters.mTarget.SimDescription, category); for (int i = 0; i < count; i++) { CASParts.Key outfitKey = new CASParts.Key(category, i); CASParts.Key displayKey = new CASParts.Key(category, i); bool alternate = false; if (!Allow(parameters.mTarget.SimDescription, ref outfitKey, ref alternate, ref displayKey)) { continue; } allOptions.Add(new Item(outfitKey, alternate, parameters.mTarget.SimDescription, displayKey)); } } if (allOptions.Count == 0) { SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":NoChoices", parameters.mTarget.IsFemale, new object[] { parameters.mTarget })); return(OptionResult.Failure); } CommonSelection <Item> .Results choices = new CommonSelection <Item>(Name, parameters.mTarget.FullName, allOptions).SelectMultiple(); if ((choices == null) || (choices.Count == 0)) { return(OptionResult.Failure); } List <Item> selection = new List <Item>(choices); // Remove them in reverse to ensure that removing earlier indices doesn't alter the index of later ones for (int i = selection.Count - 1; i >= 0; i--) { Perform(parameters.mTarget.SimDescription, selection[i].Value, selection[i].mDisplayKey); } return(OptionResult.SuccessClose); }
protected override OptionResult Run(GameHitParameters <Sim> parameters) { if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }))) { return(OptionResult.Failure); } SimDescription sim = parameters.mTarget.SimDescription; SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false); foreach (OutfitCategories category in LoadOutfit.sCategories) { CASParts.Key outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(category, sim.IsUsingMaternityOutfits)); SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true); if (source == null) { continue; } int index = 0; if (category == OutfitCategories.Career) { index = 1; } using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(category, index), geneOutfit)) { new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes); } if (category == OutfitCategories.Career) { sim.CareerOutfitIndex = index; } } return(OptionResult.SuccessRetain); }
protected abstract void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey);
protected abstract bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey);
public static void Perform(Sim sim, List <BodyTypes> types, CASParts.Key sourceKey, List <OutfitCategories> ignore) { new ProcessOutfitTask(sim, types, sourceKey, ignore).AddToSimulator(); }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { return(true); }