public DeployShieldGizmo(Pawn pawn, IList <IShield> shields) { action = delegate { if (shields.Count > 1) { Find.WindowStack.Add(ShowSelectShield(pawn, shields)); } else if (shields.Any()) { ShieldDeploymentUtility.DeployShield(pawn, shields.First()); } }; }
private FloatMenu ShowSelectShield(Pawn pawn, IList <IShield> shields) { return(new FloatMenu( shields.Select(shield => { return new FloatMenuOption( shield.Label, delegate { ShieldDeploymentUtility.DeployShield(pawn, shield); }); }).ToList() )); }
static void NotifyShieldRemoved(ThingOwner __instance, Thing item) { switch (__instance?.Owner) { case Pawn_InventoryTracker inventory: var pawn = inventory.pawn; if (pawn.Spawned) { ShieldDeploymentUtility.DeployedShields(pawn) .Where(shield => ShieldDeploymentUtility.ItemProvidesShield(item, shield)) .Do(shield => ShieldDeploymentUtility.UndeployShield(pawn, shield)); } break; } }