public AssignOutfitUI(Building_Dresser dresser) { this.Dresser = dresser; this.closeOnClickedOutside = true; this.doCloseButton = true; this.doCloseX = true; this.absorbInputAroundWindow = true; this.forcePause = true; this.closeOnClickedOutside = false; foreach (Pawn p in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists) { if (p.Faction == Faction.OfPlayer && p.def.race.Humanlike) { if (!WorldComp.PawnOutfits.ContainsKey(p)) { PawnOutfitTracker po = new PawnOutfitTracker(); po.Pawn = p; Outfit currentOutfit = p.outfits.CurrentOutfit; if (currentOutfit != null) { po.AddOutfit(new DefinedOutfit(currentOutfit, WorldComp.GetOutfitType(currentOutfit))); } WorldComp.PawnOutfits.Add(p, po); } } } }
private int DrawPawnSelection(int x, int y) { #if TRACE && CUSTOM_OUTFIT_UI Log.Warning("Begin CustomOutfitUI.DrawPawnSelection " + x + " " + y); #endif string label = (this.pawn != null) ? this.pawn.Name.ToStringShort : "Select Pawn"; #if TRACE && CUSTOM_OUTFIT_UI Log.Message(" Label: " + label); #endif if (Widgets.ButtonText(new Rect(x, y, 100, 30), label)) { List <FloatMenuOption> options = new List <FloatMenuOption>(); #if TRACE && CUSTOM_OUTFIT_UI Log.Message(" selectablePawns Count: " + this.selectablePawns.Count); #endif foreach (Pawn p in this.selectablePawns) { #if TRACE && CUSTOM_OUTFIT_UI Log.Message(" " + p.Name.ToStringShort); #endif options.Add(new FloatMenuOption(p.Name.ToStringShort, delegate { #if CUSTOM_OUTFIT_UI Log.Warning("Begin CustomOutfitUI.DrawAvailableApparel.Delegate " + p.Name.ToStringShort); #endif if (this.customOutfit != null) { this.outfitTracker.UpdateCustomApparel(this.Dresser); this.customOutfit = null; } this.pawn = p; if (!WorldComp.PawnOutfits.TryGetValue(this.pawn, out outfitTracker)) { outfitTracker = new PawnOutfitTracker(this.pawn); WorldComp.PawnOutfits.Add(this.pawn, outfitTracker); } #if CUSTOM_OUTFIT_UI Log.Warning("End CustomOutfitUI.DrawAvailableApparel.Delegate"); #endif }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(options)); } #if TRACE && CUSTOM_OUTFIT_UI Log.Warning("End CustomOutfitUI.DrawPawnSelection"); #endif return(x + 110); }
private void HandleOutfitAssign(bool assign, Outfit outfit, PawnOutfitTracker po) { Pawn pawn = po.Pawn; if (assign) { po.DefinedOutfits.Add(new DefinedOutfit(outfit, WorldComp.GetOutfitType(outfit))); } else { po.Remove(outfit); if (pawn.outfits.CurrentOutfit.Equals(outfit)) { bool newOutfitFound; if (pawn.Drafted) { newOutfitFound = !po.ChangeToBattleOutfit(); } else { newOutfitFound = !po.ChangeToCivilianOutfit(); } if (!newOutfitFound) { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + ". Could not find another Outfit for them to wear. Please fix this manually.", MessageTypeDefOf.CautionInput); } else { IDresserOutfit o = po.CurrentOutfit; if (o != null) { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + " and will instead be assigned to wear " + o.Label, MessageTypeDefOf.CautionInput); } else { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + " but could not be assigned anything else to wear.", MessageTypeDefOf.CautionInput); } } } } }
public ApparelLayerSelectionsContainer(Pawn pawn, ColorPresetsDTO presetsDto) { PawnOutfitTracker po; if (!WorldComp.PawnOutfits.TryGetValue(pawn, out po)) { po = new PawnOutfitTracker(pawn); WorldComp.PawnOutfits.Add(pawn, po); } this.PawnOutfitTracker = po; this.ApparelLayerSelections = new List <ApparelLayerColorSelectionDTO>(ChangeDresser.Util.LayerCount); IEnumerable <ApparelLayerDef> layers = ChangeDresser.Util.Layers; foreach (ApparelLayerDef layer in layers) { this.ApparelLayerSelections.Add(new ApparelLayerColorSelectionDTO(layer, this.PawnOutfitTracker)); } this.SelectedApparel = new List <SelectionColorWidgetDTO>(); this.ColorPresetsDTO = presetsDto; this.CopyColorSelected = false; }
public ApparelLayerColorSelectionDTO(ApparelLayerDef layer, PawnOutfitTracker po) : base((po != null) ? po.GetLayerColor(layer, true) : Color.white) { this.ApparelLayerDef = layer; this.PawnOutfitTracker = po; }