コード例 #1
0
 private void OnMenuToggle()
 {
     if (!Toggleable.IsToggleQueued(ToggleIdx))
     {
         if (IsEnabled)
         {
             Trigger(2108245096, "BuildingDisabled");
         }
         Prioritizable.AddRef(base.gameObject);
     }
     else
     {
         Prioritizable.RemoveRef(base.gameObject);
     }
     Toggleable.Toggle(ToggleIdx);
     Game.Instance.userMenu.Refresh(base.gameObject);
 }
コード例 #2
0
            public static bool TogglePatch(Toggleable __instance, ref int targetIdx)
            {
                if (__instance.IsToggleQueued(targetIdx))
                {
                    return(false);
                }

                FieldInfo info = __instance.GetType().GetField(
                    "targets",
                    System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

                List <KeyValuePair <IToggleHandler, Chore> > targets = info.GetValue(__instance) as List <KeyValuePair <IToggleHandler, Chore> >;

                targets[targetIdx].Key.HandleToggle();
                return(false);
            }