diff --git a/PlaylistManager/HarmonyPatches/SongCore_MenuLoaded.cs b/PlaylistManager/HarmonyPatches/SongCore_MenuLoaded.cs deleted file mode 100644 index 382ff79..0000000 --- a/PlaylistManager/HarmonyPatches/SongCore_MenuLoaded.cs +++ /dev/null @@ -1,15 +0,0 @@ -using HarmonyLib; -using System; - -namespace PlaylistManager.HarmonyPatches -{ - [HarmonyPatch(typeof(SongCore.Loader), "MenuLoaded")] - internal class SongCore_MenuLoaded - { - public static event Action MenuLoadedEvent; - private static void Postfix() - { - MenuLoadedEvent?.Invoke(); - } - } -} diff --git a/PlaylistManager/UI/ViewControllers/PlaylistDownloaderViewController.cs b/PlaylistManager/UI/ViewControllers/PlaylistDownloaderViewController.cs index 7eaa0a5..6d0dbf7 100644 --- a/PlaylistManager/UI/ViewControllers/PlaylistDownloaderViewController.cs +++ b/PlaylistManager/UI/ViewControllers/PlaylistDownloaderViewController.cs @@ -56,14 +56,14 @@ public void Initialize() { playlistDownloader.PopupEvent += OnPopupRequested; playlistDownloader.QueueUpdatedEvent += UpdateQueue; - SongCore_MenuLoaded.MenuLoadedEvent += OnMenuLoaded; + SceneManager.activeSceneChanged += OnMenuLoaded; } public void Dispose() { playlistDownloader.PopupEvent -= OnPopupRequested; playlistDownloader.QueueUpdatedEvent -= UpdateQueue; - SongCore_MenuLoaded.MenuLoadedEvent -= OnMenuLoaded; + SceneManager.activeSceneChanged -= OnMenuLoaded; } [UIAction("#post-parse")] @@ -113,9 +113,9 @@ private void UpdateQueue() } } - private void OnMenuLoaded() + private void OnMenuLoaded(Scene previousScene, Scene newScene) { - if (refreshRequested) + if (refreshRequested && newScene.name == "MainMenu") { refreshRequested = false; playlistDownloader.OnQueueClear();