コード例 #1
0
	//public override IEnumerable<Gizmo> GetGizmos()
	public static void Postfix(ref IEnumerable<Gizmo> __result, Thing __instance)
	{
	  if (!Settings.Get().ShowGizmos()) return;

	  List<Gizmo> result = __result.ToList();

	  if (Settings.Get().purposeGizmos && __instance is Pawn pawn &&
		  PurposeGizmoAdder.PurposeGizmoFor(pawn) is Gizmo gizmo)
		result.Add(gizmo);

	  if (Settings.Get().reservedGizmos &&
		  PurposeGizmoAdder.ReservedGizmoFor(__instance) is Gizmo gizmo2)
		result.Add(gizmo2);

	  __result = result;
	}
コード例 #2
0
        //public override IEnumerable<Gizmo> GetGizmos()
        public static IEnumerable <Gizmo> Postfix(IEnumerable <Gizmo> __result, Thing __instance)
        {
            foreach (var gizmo in __result)
            {
                yield return(gizmo);
            }

            if (Mod.settings.ShowGizmos())
            {
                if (Mod.settings.purposeGizmos && __instance is Pawn pawn &&
                    PurposeGizmoAdder.PurposeGizmoFor(pawn) is Gizmo gizmo1)
                {
                    yield return(gizmo1);
                }

                if (Mod.settings.reservedGizmos &&
                    PurposeGizmoAdder.ReservedGizmoFor(__instance) is Gizmo gizmo2)
                {
                    yield return(gizmo2);
                }
            }
        }