public static void InsertUrgentRefillGizmos(ref IEnumerable <Gizmo> __result, Map map, ISlotGroupParent parent) { if (!UrgentRefill.active) { return; } SlotGroup group = parent.GetSlotGroup(); __result = __result.Add(new Command_Toggle() { defaultLabel = "TD.GizmoUrgentRefill".Translate(), defaultDesc = "TD.GizmoUrgentRefillDesc".Translate(), icon = haulUrgentlyIcon, isActive = () => group.IsMarkedForRefill(map), toggleAction = delegate { group.MarkForRefill(map, !group.IsMarkedForRefill(map)); } }); }
public static IEnumerable <Gizmo> InsertUrgentRefillGizmos(IEnumerable <Gizmo> __result, Map map, ISlotGroupParent parent) { foreach (var r in __result) { yield return(r); } if (!UrgentRefill.active) { yield break; } SlotGroup group = parent.GetSlotGroup(); yield return(new Command_Toggle() { defaultLabel = "TD.GizmoUrgentRefill".Translate(), defaultDesc = "TD.GizmoUrgentRefillDesc".Translate(), icon = haulUrgentlyIcon, isActive = () => group.IsMarkedForRefill(map), toggleAction = delegate { group.MarkForRefill(map, !group.IsMarkedForRefill(map)); } }); }