From 404ba92a34ef00b74db4791314f94d5a6afff89d Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Thu, 7 Sep 2023 04:57:17 -0400 Subject: [PATCH 1/3] Fix for game v1.31.1 --- PlaylistManager/Managers/PlaylistDataManager.cs | 8 ++++---- .../ViewControllers/LevelDetailButtonsViewController.cs | 6 +++--- PlaylistManager/manifest.json | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/PlaylistManager/Managers/PlaylistDataManager.cs b/PlaylistManager/Managers/PlaylistDataManager.cs index 79deb113..850a7fe5 100644 --- a/PlaylistManager/Managers/PlaylistDataManager.cs +++ b/PlaylistManager/Managers/PlaylistDataManager.cs @@ -1,10 +1,10 @@ -using IPA.Utilities; +using System; +using System.Collections.Generic; using PlaylistManager.HarmonyPatches; using PlaylistManager.Interfaces; using PlaylistManager.UI; using PlaylistManager.Utilities; -using System; -using System.Collections.Generic; +using UnityEngine; using Zenject; namespace PlaylistManager @@ -88,7 +88,7 @@ private void LevelPackDetailViewController_didActivateEvent(bool firstActivation } } - private void LevelFilteringNavigationController_didSelectAnnotatedBeatmapLevelCollectionEvent(LevelFilteringNavigationController _, IAnnotatedBeatmapLevelCollection annotatedBeatmapLevelCollection, UnityEngine.GameObject __, BeatmapCharacteristicSO ___) + private void LevelFilteringNavigationController_didSelectAnnotatedBeatmapLevelCollectionEvent(LevelFilteringNavigationController controller, IAnnotatedBeatmapLevelCollection annotatedBeatmapLevelCollection, GameObject noDataInfoPrefab, bool sortAlphabetically, BeatmapCharacteristicSO preferredBeatmapCharacteristic) { AnnotatedBeatmapLevelCollectionsViewController_didSelectAnnotatedBeatmapLevelCollectionEvent(annotatedBeatmapLevelCollection); } diff --git a/PlaylistManager/UI/ViewControllers/LevelDetailButtonsViewController.cs b/PlaylistManager/UI/ViewControllers/LevelDetailButtonsViewController.cs index bb162bf2..6c975e1e 100644 --- a/PlaylistManager/UI/ViewControllers/LevelDetailButtonsViewController.cs +++ b/PlaylistManager/UI/ViewControllers/LevelDetailButtonsViewController.cs @@ -112,15 +112,15 @@ private void RemoveSong() if ((PluginConfig.Instance.AuthorName.IndexOf("GOOBIE", StringComparison.OrdinalIgnoreCase) >= 0 || PluginConfig.Instance.AuthorName.IndexOf("ERIS", StringComparison.OrdinalIgnoreCase) >= 0 || PluginConfig.Instance.AuthorName.IndexOf("PINK", StringComparison.OrdinalIgnoreCase) >= 0 || PluginConfig.Instance.AuthorName.IndexOf("CANDL3", StringComparison.OrdinalIgnoreCase) >= 0) && PluginConfig.Instance.EasterEggs) { - levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, $"{PluginConfig.Instance.AuthorName} Cute"); + levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, $"{PluginConfig.Instance.AuthorName} Cute", false); } else if (PluginConfig.Instance.AuthorName.IndexOf("JOSHABI", StringComparison.OrdinalIgnoreCase) >= 0) { - levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, $"*Sneeze*"); + levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, $"*Sneeze*", false); } else { - levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, "Play"); + levelCollectionNavigationController.SetDataForPack(selectedPlaylist, true, true, "Play", false); } levelCollectionNavigationController.HideDetailViewController(); diff --git a/PlaylistManager/manifest.json b/PlaylistManager/manifest.json index ef6a921a..2e7bd2cf 100644 --- a/PlaylistManager/manifest.json +++ b/PlaylistManager/manifest.json @@ -3,12 +3,12 @@ "id": "PlaylistManager", "name": "PlaylistManager", "author": "PixelBoom", - "version": "1.6.7", + "version": "1.6.8", "description": [ "#![PlaylistManager.Description.md]", "Load, Create, Edit, Organize Playlists and Download their Songs in Beat Saber." ], - "gameVersion": "1.31.0", + "gameVersion": "1.31.1", "icon": "PlaylistManager.Icons.Logo.png", "dependsOn": { "BSIPA": "^4.3.0", @@ -16,7 +16,7 @@ "BeatSaberMarkupLanguage": "^1.7.5", "SiraUtil": "^3.0.0", "BeatSaberPlaylistsLib": "^1.6.7", - "BeatSaverSharp": "^3.3.0", + "BeatSaverSharp": "^3.4.5", "System.IO.Compression": "^4.6.57", "System.IO.Compression.FileSystem": "^4.7.3056" }, From 0f82ac0f623100a03e5336ad27f410b6b1fe834f Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Thu, 7 Sep 2023 04:58:01 -0400 Subject: [PATCH 2/3] Fix readonly toggle not behaving like intended --- .../UI/ViewControllers/PlaylistDetailsViewController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PlaylistManager/UI/ViewControllers/PlaylistDetailsViewController.cs b/PlaylistManager/UI/ViewControllers/PlaylistDetailsViewController.cs index 8113712d..1aa0ad4e 100644 --- a/PlaylistManager/UI/ViewControllers/PlaylistDetailsViewController.cs +++ b/PlaylistManager/UI/ViewControllers/PlaylistDetailsViewController.cs @@ -189,9 +189,9 @@ private void ReadOnlyToggled(bool playlistReadOnly) { if (playlistReadOnly) { - playlistReadOnly = true; + PlaylistReadOnly = true; } - else if (PlaylistAllowDuplicates != PlaylistReadOnly) + else if (PlaylistReadOnly != playlistReadOnly) { popupModalsController.ShowYesNoModal(modalTransform, "To turn off read only, this playlist will be cloned and writing will be enabled on the clone. Proceed?", ClonePlaylist, noButtonPressedCallback: UpdateReadOnly, animateParentCanvas: false); } From 2dda00fe04bbc166792b974959925952cffecba8 Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:43:17 -0400 Subject: [PATCH 3/3] Reduce freeze when refreshing playlists --- PlaylistManager/UI/RefreshButtonUI.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PlaylistManager/UI/RefreshButtonUI.cs b/PlaylistManager/UI/RefreshButtonUI.cs index 14cef264..e881f3aa 100644 --- a/PlaylistManager/UI/RefreshButtonUI.cs +++ b/PlaylistManager/UI/RefreshButtonUI.cs @@ -3,7 +3,7 @@ using SongCore; using SongCore.UI; using System; -using IPA.Utilities.Async; +using System.Threading.Tasks; using Zenject; namespace PlaylistManager.UI @@ -28,11 +28,13 @@ private async void SongsLoaded(Loader _, System.Collections.Concurrent.Concurren progressBar = ProgressBar.Create(); } - var numPlaylists = await UnityMainThreadTaskScheduler.Factory.StartNew(() => - { - PlaylistLibUtils.playlistManager.RefreshPlaylists(true); - return PlaylistLibUtils.playlistManager.GetPlaylistCount(true); - }).ConfigureAwait(false); + PlaylistLibUtils.playlistManager.RefreshPlaylists(true); + var numPlaylists = PlaylistLibUtils.playlistManager.GetPlaylistCount(true); + + // This event handler is loading sprites and accessing Unity objects so it must be done on the main thread. + // Although SongsLoadedEvent is already invoked on the main thread, the default event handler in ProgressBar + // will overwrite our message. We're essentially skipping a frame to let the default event handler run first. + await Task.Yield(); progressBar.enabled = true; progressBar.ShowMessage($"\n{numPlaylists} playlists loaded.", kMessageTime);