private static Gizmo GetSquadAttackGizmo(Pawn pawn) { Command_Target command_Target = new Command_Target(); command_Target.defaultLabel = "CommandSquadAttack".Translate(); command_Target.defaultDesc = "CommandSquadAttackDesc".Translate(); command_Target.targetingParams = TargetingParameters.ForAttackAny(); command_Target.hotKey = KeyBindingDefOf.Misc1; command_Target.icon = TexCommand.SquadAttack; if (FloatMenuUtility.GetAttackAction(pawn, LocalTargetInfo.Invalid, out string failStr) == null) { command_Target.Disable(failStr.CapitalizeFirst() + "."); } command_Target.action = delegate(Thing target) { IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x) { Pawn pawn2 = x as Pawn; return(pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.Drafted); }).Cast <Pawn>(); foreach (Pawn item in enumerable) { FloatMenuUtility.GetAttackAction(item, target, out string _)?.Invoke(); } }; return(command_Target); }
private static Gizmo GetSquadAttackGizmo(Pawn pawn) { Command_Target command_Target = new Command_Target(); command_Target.defaultLabel = "CommandSquadAttack".Translate(); command_Target.defaultDesc = "CommandSquadAttackDesc".Translate(); command_Target.targetingParams = TargetingParameters.ForAttackAny(); command_Target.hotKey = KeyBindingDefOf.Misc1; command_Target.icon = TexCommand.SquadAttack; if (FloatMenuUtility.GetAttackAction(pawn, LocalTargetInfo.Invalid, out var failStr) == null) { command_Target.Disable(failStr.CapitalizeFirst() + "."); } command_Target.action = delegate(Thing target) { foreach (Pawn item in Find.Selector.SelectedObjects.Where(delegate(object x) { Pawn pawn2 = x as Pawn; return(pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.Drafted); }).Cast <Pawn>()) { string failStr2; Action attackAction = FloatMenuUtility.GetAttackAction(item, target, out failStr2); if (attackAction != null) { attackAction(); } else if (!failStr2.NullOrEmpty()) { Messages.Message(failStr2, target, MessageTypeDefOf.RejectInput, historical: false); } } }; return(command_Target); }
private static void <GetSquadAttackGizmo> m__0(Thing target) { IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x) { Pawn pawn2 = x as Pawn; return(pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.Drafted); }).Cast <Pawn>(); foreach (Pawn pawn in enumerable) { string text; Action attackAction = FloatMenuUtility.GetAttackAction(pawn, target, out text); if (attackAction != null) { attackAction(); } } }