コード例 #1
0
        private static void Postfix(ref Zone_Growing __instance)
        {
            var allowTill = TillToggle.IsAllowed(__instance);

            Scribe_Values.Look(ref allowTill, "allowTill", true);
            TillToggle.SetAllowed(__instance, allowTill);
        }
コード例 #2
0
        private static void Postfix(Zone_Growing __instance, ref IEnumerable <Gizmo> __result)
        {
            if (ResearchProjectDefOf.AC_Tilling.IsFinished)
            {
                var toggleTillCommand = new Command_Toggle
                {
                    defaultLabel = "AC.CommandToggleTill".Translate(),
                    defaultDesc  = "AC.CommandToggleTillDesc".Translate(),
                    icon         = TexCommand.Till,
                    isActive     = () => TillToggle.IsAllowed(__instance),
                    toggleAction = () => TillToggle.SetAllowed(__instance, !TillToggle.IsAllowed(__instance))
                };

                __result = new List <Gizmo>(__result)
                {
                    toggleTillCommand
                };
            }
            else
            {
                __result = new List <Gizmo>(__result);
            }
        }