示例#1
0
        static bool Prefix(FSMCoreGame __instance, ScriptBundleLoader manager, IEnumerable <string> filePaths)
        {
            UnityEngine.Debug.Log("ScriptBundleLoader.ScriptBundle Patched true");

            AccessTools.Field(typeof(ScriptBundleLoader.ScriptBundle), "fileSystemWatchers").SetValue(__instance, new List <FileSystemWatcher>());
            AccessTools.Field(typeof(ScriptBundleLoader.ScriptBundle), "instances").SetValue(__instance, new List <object>());

            List <string> fullPaths = new List <string>();

            foreach (string value in filePaths)
            {
                fullPaths.Add(Path.GetFullPath(value));
            }

            AccessTools.Field(typeof(ScriptBundleLoader.ScriptBundle), "filePaths").SetValue(__instance, fullPaths);
            AccessTools.Field(typeof(ScriptBundleLoader.ScriptBundle), "manager").SetValue(__instance, manager);

            AppDomain currentDomain = AppDomain.CurrentDomain;

            Assembly[] assemblies = currentDomain.GetAssemblies();

            List <string> list = new List <string>();

            for (int i = 0; i < assemblies.Count(); i++)
            {
                string result;
                try
                {
                    result = assemblies[i].Location;
                }
                catch
                {
                    result = null;
                }
                if (result != null)
                {
                    list.Add(result);
                }
            }

            Debug.Log("domains list size " + list.Count);

            AccessTools.Field(typeof(ScriptBundleLoader.ScriptBundle), "assemblyReferences").SetValue(__instance, list.ToArray());

            if (HoneyDebug.Get().loadingPerformance)
            {
                manager.logWriter.WriteLine("loading " + Environment.NewLine + string.Join(Environment.NewLine, filePaths.ToArray <string>()));
            }

            AccessTools.Method(typeof(ScriptBundleLoader.ScriptBundle), "CompileFiles").Invoke(__instance, null);
            AccessTools.Method(typeof(ScriptBundleLoader.ScriptBundle), "CreateFileWatchers").Invoke(__instance, null);
            AccessTools.Method(typeof(ScriptBundleLoader.ScriptBundle), "CreateNewInstances").Invoke(__instance, null);

            return(false);
        }
 static void Postfix(FSMCoreGame __instance)
 {
     UnityEngine.Debug.Log("TemporalEventMode will be force to be turned off.");
     AccessTools.Method(typeof(FSMCoreGame), "TemporalEventModeOff").Invoke(__instance, null);
 }