Пример #1
0
 internal static bool Load(UnityModManager.ModEntry modEntry)
 {
     logger = modEntry.Logger;
     //logger.Log(windowWidth.ToString);
     try
     {
         new GameObject(typeof(UI).FullName, typeof(UI));
         return(true);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(false);
     //GUILayout.Button("");
 }
Пример #2
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            settings = Settings.Load <Settings>(modEntry);

            Logger = modEntry.Logger;

            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;

            return(true);
        }
Пример #3
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger   = modEntry.Logger;
            settings = Settings.Load <Settings>(modEntry);
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            if (showMessageTypeTmp == null)
            {
                showMessageTypeTmp = new bool[settings.showMessageType.Length];
            }
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
            return(true);
        }
Пример #4
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger = modEntry.Logger;

            Settings           = Settings.Load <Settings>(modEntry);
            modEntry.OnGUI     = new Action <UnityModManager.ModEntry>(Main.OnGUI);
            modEntry.OnSaveGUI = new Action <UnityModManager.ModEntry>(Main.OnSaveGUI);
            modEntry.OnToggle  = new Func <UnityModManager.ModEntry, bool, bool>(Main.OnToggle);
            modEntry.OnUnload  = new Func <UnityModManager.ModEntry, bool>(Main.OnUnload);

            WeaponFocus.Init(modEntry.Path);

            HarmonyInstance = new HarmonyLib.Harmony(modEntry.Info.Id);
            HarmonyInstance.PatchAll(typeof(Main).Assembly);

            return(true);
        }
Пример #5
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            if (!Directory.Exists(backupdir))
            {
                Directory.CreateDirectory(backupdir);
            }

            Logger             = modEntry.Logger;
            settings           = Settings.Load <Settings>(modEntry);
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;

            HarmonyInstance.Create(modEntry.Info.Id).PatchAll(Assembly.GetExecutingAssembly());

            return(true);
        }
Пример #6
0
        private static bool Load(UnityModManager.ModEntry modEntry)
        {
            HarmonyInstance.Create(modEntry.Info.Id).PatchAll(Assembly.GetExecutingAssembly());

            Logger = modEntry.Logger;

            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnShowGUI = OnShowGUI;
            modEntry.OnHideGUI = OnHideGUI;

#if DEBUG
            modEntry.OnUnload = OnUnload;
#endif

            return(true);
        }
Пример #7
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger            = modEntry.Logger;
            modEntry.OnToggle = OnToggle;
            settings          = Settings.Load <Settings>(modEntry);
            modEntry.OnGUI    = OnGUI;
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            if (!Main.uiIsShow)
            {
                UI.Load();
                UI.key        = settings.key;
                Main.uiIsShow = true;
            }
            return(true);
        }
Пример #8
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            //logger.Log("Hello");
            //读取用户配置文件
            settings = Settings.Load <Settings>(modEntry);
            //储存日志输出对象
            logger = modEntry.Logger;
            //logger.Log("Load");
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
            //modEntry.OnToggle = OnToggle;
            //将更改应用到游戏上
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            return(true);
        }
Пример #9
0
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            settings = Settings.Load <Settings>(modEntry);

            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            logger             = modEntry.Logger;
            modEntry.OnSaveGUI = OnSaveGUI;
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnUpdate  = OnUpdate;
#if DEBUG
            modEntry.OnUnload = Unload;
#endif
            return(true);
        }
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            try
            {
                logger = modEntry.Logger;

                ModBeforeDBReady();

                var harmony = new Harmony(modEntry.Info.Id);
                harmony.PatchAll(Assembly.GetExecutingAssembly());
            }
            catch (Exception ex)
            {
                Error(ex);
                throw;
            }
            return(true);
        }
Пример #11
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger = modEntry.Logger;

            Enabled  = modEntry.Active;
            Settings = UnityModManager.ModSettings.Load <Settings>(modEntry);

            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;

            var harmony = HarmonyInstance.Create("TaiwuRerollMod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            GeneratorPatch.ApplyAll(harmony);

            return(true);
        }
Пример #12
0
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            logger             = modEntry.Logger;
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
#if DEBUG
            modEntry.OnUnload = Unload;
#endif
            settings        = UnityModManager.ModSettings.Load <Settings>(modEntry);
            harmonyInstance = Harmony12.HarmonyInstance.Create(modEntry.Info.Id);
            if (!ApplyPatch(typeof(LibraryScriptableObject_LoadDictionary_Patch), "All mod features"))
            {
                // If we can't patch this, nothing will work, so want the mod to turn red in UMM.
                throw Error("Failed to patch LibraryScriptableObject.LoadDictionary(), cannot load mod");
            }
            return(true);
        }
Пример #13
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            #region 基础设置
            settings           = Settings.Load <Settings>(modEntry);
            Logger             = modEntry.Logger;
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
            #endregion
            //ActorPatch.Init(modEntry);

            ActorMenuActorListPatch.Init(modEntry);

            HarmonyInstance harmony = HarmonyInstance.Create(modEntry.Info.Id);
            harmony.PatchAll(Assembly.GetExecutingAssembly());

            return(true);
        }
Пример #14
0
        // Mod entry point, invoked from UMM
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            logger             = modEntry.Logger;
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
            settings           = UnityModManager.ModSettings.Load <Settings>(modEntry);
            harmonyInstance    = Harmony12.HarmonyInstance.Create(modEntry.Info.Id);
            if (!ApplyPatch(typeof(LibraryScriptableObject_LoadDictionary_Patch), "Load library"))
            {
                throw Error("Failed to patch LibraryScriptableObject.LoadDictionary(), cannot load mod");
            }
            if (!ApplyPatch(typeof(UnityModManager_UI_Update_Patch), "Read keys"))
            {
                throw Error("Failed to patch LibraryScriptableObject.LoadDictionary(), cannot load mod");
            }
            if (!ApplyPatch(typeof(LocalMap_OnPointerClick_Patch), "Local map click"))
            {
                throw Error("Failed to patch LocalMap.OnPointerClick(), cannot load mod");
            }
            if (!ApplyPatch(typeof(LocalMap_OnShow_Patch), "Local map show"))
            {
                throw Error("Failed to patch LocalMap.OnShow(), cannot load mod");
            }
            if (!ApplyPatch(typeof(LocalMap_OnHide_Patch), "Local map hide"))
            {
                throw Error("Failed to patch LocalMap.OnHide(), cannot load mod");
            }
            if (!ApplyPatch(typeof(GlobalMapLocation_HandleClick_Patch), "Global map location click"))
            {
                throw Error("Failed to patch GlobalMapLocation.HandleClick(), cannot load mod");
            }
            if (!ApplyPatch(typeof(GlobalMapLocation_HandleHoverChange_Patch), "Global map hover change"))
            {
                throw Error("Failed to patch GlobalMapLocation.HandleHoverChange(), cannot load mod");
            }
            if (!ApplyPatch(typeof(BlueprintLocation_GetDescription_Patch), "Blueprint location description"))
            {
                throw Error("Failed to patch BlueprintLocation.GetDescription(), cannot load mod");
            }

            StartMod();
            return(true);
        }
Пример #15
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            isEnable = false;
            //读取用户配置文件
            settings = Settings.Load <Settings>(modEntry);
            //储存日志输出对象
            logger = modEntry.Logger;
            //logger.Log("Load");
            modEntry.OnGUI = OnGUI;
            //modEntry.OnSaveGUI = OnSaveGUI;
            //modEntry.OnToggle = OnToggle;
            //将更改应用到游戏上
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            if (!isEnable)
            {
                return(false);
            }
            ConstructorInfo t1Constructor = trainScriptType.GetConstructor(Type.EmptyTypes);

            System.Object oPubClass  = t1Constructor.Invoke(new System.Object[] { });
            MethodInfo    method     = trainScriptType.GetMethod("TrainCoroutine", BindingFlags.Instance | BindingFlags.NonPublic);
            MethodInfo    prefix     = typeof(MainMod).GetMethod("TrainScript_TrainCoroutine_Transpiler");
            HarmonyMethod transpiler = new HarmonyMethod(prefix);

            harmony.Patch(method, null, null, transpiler);


            //string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            //StreamReader sr = new StreamReader(path + "\\config.json");
            //
            //string json = sr.ReadToEnd();
            //speed = JsonConvert.DeserializeObject<Speed>(json);


            //logger.Log(trainScriptType.GetMethods(BindingFlags.NonPublic).Length.ToString());
            //MethodInfo methodInfo= trainScriptType.GetMethod("TrainCoroutine");
            //logger.Log(methodInfo.Name);
            //harmony.Patch()

            return(true);
        }
Пример #16
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger   = modEntry.Logger;
            settings = Settings.Load <Settings>(modEntry);
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;
            lastTimeScale      = realTimeScale = Time.timeScale;
            if (_looper == null)
            {
                _looper = new GameObject().AddComponent(
                    typeof(GameSpeeder_Looper)) as GameSpeeder_Looper;
                UnityEngine.Object.DontDestroyOnLoad(_looper);
            }
            return(true);
        }
Пример #17
0
        public static bool Load(UnityModManager.ModEntry modEntry)
        {
            Logger   = modEntry.Logger;
            settings = Settings.Load <Settings>(modEntry);
            var harmony = HarmonyInstance.Create(modEntry.Info.Id);

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            modEntry.OnToggle  = OnToggle;
            modEntry.OnGUI     = OnGUI;
            modEntry.OnSaveGUI = OnSaveGUI;

            if (looper == null)
            {
                looper = (new GameObject()).AddComponent <Looper>();
                UnityEngine.Object.DontDestroyOnLoad(looper);
            }

            return(true);
        }
Пример #18
0
        //this is the function that load the mod, the info.json must point to it In entry method
        static bool Load(UnityModManager.ModEntry modEntry)
        {
            logger            = modEntry.Logger;
            modEntry.OnToggle = OnToggle;
            modEntry.OnGUI    = OnGUI;
            //modEntry.OnSaveGUI = OnSaveGUI;
            modpath = modEntry.Path;
            //settings = UnityModManager.ModSettings.Load<Settings>(modEntry);
            harmonyInstance = Harmony12.HarmonyInstance.Create(modEntry.Info.Id);
            ApplyPatch(typeof(LibraryScriptableObject_LoadDictionary2_Patch), "Loading the shader");
            ApplyPatch(typeof(AssetBundle_LoadFromFile_Patch), "Loading the new fx");
            if (!ApplyPatch(typeof(LibraryScriptableObject_LoadDictionary_Patch), "All mod features"))
            {
                // If we can't patch this, nothing will work, so want the mod to turn red in UMM.
                throw Error("Failed to patch LibraryScriptableObject.LoadDictionary(), cannot load mod");
            }

            return(true);
        }
 static bool Load(UnityModManager.ModEntry modEntry)
 {
     try
     {
         settings = Settings.Load(modEntry);
         var harmony = HarmonyInstance.Create(modEntry.Info.Id);
         harmony.PatchAll(Assembly.GetExecutingAssembly());
         modEntry.OnToggle  = OnToggle;
         modEntry.OnGUI     = OnGUI;
         modEntry.OnSaveGUI = OnSaveGUI;
         logger             = modEntry.Logger;
     }
     catch (Exception e)
     {
         DebugLog(e.ToString() + "\n" + e.StackTrace);
         throw e;
     }
     return(true);
 }