using ADOFAIRenderer; using ADOFAIRenderer.Core; using ADOFAIRenderer.Util; using FFmpeg.AutoGen; using MelonLoader; using MelonLoader.Utils; using UnityEngine; using UnityEngine.EventSystems; [assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.2.0-BETA", "ADOFAI Editor Forum")] [assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")] namespace ADOFAIRenderer { public class RenderMod : MelonMod { public static AssetBundle FontBundle = null!; // ReSharper disable once MemberCanBePrivate.Global public static AssetBundle SceneBundle = null!; public static string[] ModScenes = {}; public override void OnInitializeMelon() { ffmpeg.RootPath = MelonEnvironment.UserLibsDirectory; var renderManagerObj = new GameObject("Render Manager"); var updateHookerObj = new GameObject("Update Hooker"); Object.DontDestroyOnLoad(renderManagerObj); Object.DontDestroyOnLoad(updateHookerObj); renderManagerObj.AddComponent(); updateHookerObj.AddComponent(); LoadBundles(); } private static void LoadBundles() { FontBundle = BundleLoader.GetBundle("fonts"); SceneBundle = BundleLoader.GetBundle("scenes"); ModScenes = SceneBundle.GetAllScenePaths(); } public static void FixEventSystem() { if (EventSystem.current == null) return; var currentModule = EventSystem.current.currentInputModule; if (currentModule != null) return; Melon.Logger.Msg("Unity 6 인풋 모듈 이식."); var newModule = EventSystem.current.gameObject.AddComponent(); newModule.enabled = true; } public override void OnApplicationQuit() { if (RenderManager.Instance == null) return; Melon.Logger.Msg("MelonLoader 종료 감지: RenderManager의 활성 프로세스를 강제 수거 및 종료합니다."); RenderManager.Instance.CleanUpActiveRender(); } } }