Example #1
0
        static bool OnToggle(UnityModManager.ModEntry modEntry, bool value)
        {
            Main.modEntry = modEntry;
            if (enabled == value)
            {
                return(true);
            }
            enabled = value;

            if (enabled)
            {
                harmonyInstance = HarmonyInstance.Create(modEntry.Info.Id);
                harmonyInstance.PatchAll(Assembly.GetExecutingAssembly());
                if (mapBrowser == null)
                {
                    mapBrowser = ModMenu.Instance.gameObject.AddComponent <MapBrowser>();
                }
            }
            else
            {
                harmonyInstance.UnpatchAll(harmonyInstance.Id);
                mapBrowser = null;
                UnityEngine.Object.Destroy(ModMenu.Instance.gameObject.GetComponent <MapBrowser>());
            }
            return(true);
        }
Example #2
0
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            Main.modEntry     = modEntry;
            settings          = Settings.Load();
            mapBrowser        = ModMenu.Instance.gameObject.AddComponent <MapBrowser>();
            modEntry.OnToggle = OnToggle;


            return(true);
        }