Exemplo n.º 1
0
        public void Initialize(IManager manager, string ipcIdentifier)
        {
            UnityEngine.Application.SetStackTraceLogType(UnityEngine.LogType.Log, UnityEngine.StackTraceLogType.None);
            Instance = this;

            MusicTrack.Info.Register();
            MusicChoice.Info.Register();

            DirectoryEx.CreateIfDoesNotExist("EditorMusic/");

            var harmony  = HarmonyInstance.Create("com.corecii.distance.customtrackmusic");
            var assembly = Assembly.GetExecutingAssembly();

            assembly.GetTypes().Do(type =>
            {
                try
                {
                    var parentMethodInfos = type.GetHarmonyMethods();
                    if (parentMethodInfos != null && parentMethodInfos.Count() > 0)
                    {
                        var info      = HarmonyMethod.Merge(parentMethodInfos);
                        var processor = new PatchProcessor(harmony, type, info);
                        processor.Patch();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Failed to patch {type}: {e}");
                }
            });

            PatchPostLoad(true);
        }
Exemplo n.º 2
0
        public void Initialize(IManager manager)
        {
            Instance = this;
            Manager  = manager;

            Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);

            Config      = gameObject.AddComponent <ConfigurationLogic>();
            Variables   = gameObject.AddComponent <VariablesLogic>();
            SoundPlayer = gameObject.AddComponent <SoundPlayerLogic>();
            LevelEditor = gameObject.AddComponent <LevelEditorLogic>();
            Logger      = LogManager.GetForCurrentAssembly();

            MusicTrack.Info.Register();
            MusicChoice.Info.Register();

            DirectoryEx.CreateIfDoesNotExist("EditorMusic/");

            CreateSettingsMenu();

            RuntimePatcher.AutoPatch();
        }