diff --git a/VideoPlayer/VideoData.cs b/VideoPlayer/VideoData.cs index 54e38d4..81755c0 100644 --- a/VideoPlayer/VideoData.cs +++ b/VideoPlayer/VideoData.cs @@ -23,7 +23,7 @@ public class VideoData public string videoPath; [System.NonSerialized] - public IBeatmapLevel level; + public IPreviewBeatmapLevel level; [System.NonSerialized] public float downloadProgress = 0f; [System.NonSerialized] diff --git a/VideoPlayer/VideoLoader.cs b/VideoPlayer/VideoLoader.cs index 260ee57..41433de 100644 --- a/VideoPlayer/VideoLoader.cs +++ b/VideoPlayer/VideoLoader.cs @@ -3,11 +3,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using SongLoaderPlugin; using UnityEngine; using System.IO; -using SongLoaderPlugin.OverrideClasses; using System.Diagnostics; +using SongCore; using MusicVideoPlayer.YT; namespace MusicVideoPlayer.Util @@ -20,7 +19,7 @@ public class VideoLoader : MonoBehaviour public bool autoDownload = false; - private Dictionary videos; + private Dictionary videos; private HMTask _loadingTask; private bool _loadingCancelled; @@ -40,12 +39,12 @@ private void Awake() Instance = this; autoDownload = Plugin.config.GetBool("Settings", "autoDownload", false, true); - SongLoader.SongsLoadedEvent += RetrieveAllVideoData; + Loader.SongsLoadedEvent += RetrieveAllVideoData; DontDestroyOnLoad(gameObject); } - public string GetVideoPath(IBeatmapLevel level) + public string GetVideoPath(IPreviewBeatmapLevel level) { VideoData vid; if (videos.TryGetValue(level, out vid)) return GetVideoPath(vid); @@ -57,19 +56,19 @@ public string GetVideoPath(VideoData video) return Path.Combine(GetLevelPath(video.level), video.videoPath); } - public VideoData GetVideo(IBeatmapLevel level) + public VideoData GetVideo(IPreviewBeatmapLevel level) { VideoData vid; if (videos.TryGetValue(level, out vid)) return vid; return null; } - public static string GetLevelPath(IBeatmapLevel level) + public static string GetLevelPath(IPreviewBeatmapLevel level) { - if (level is CustomLevel) + if (level is CustomPreviewBeatmapLevel) { // Custom song - return (level as CustomLevel).customSongInfo.path; + return (level as CustomPreviewBeatmapLevel).customLevelPath; } else { @@ -87,7 +86,7 @@ public static string GetLevelPath(IBeatmapLevel level) } } - public bool SongHasVideo(IBeatmapLevel level) + public bool SongHasVideo(IPreviewBeatmapLevel level) { return videos.ContainsKey(level); } @@ -114,16 +113,17 @@ public static void SaveVideoToDisk(VideoData video) //} } - private void RetrieveAllVideoData(SongLoader songLoader, List levels) + private void RetrieveAllVideoData(Loader songLoader, Dictionary levels) { - videos = new Dictionary(); - RetrieveCustomLevelVideoData(songLoader, levels); + videos = new Dictionary(); + List LevelList = new List(levels.Values); + RetrieveCustomLevelVideoData(LevelList); RetrieveOSTVideoData(); } private void RetrieveOSTVideoData() { - BeatmapLevelSO[] levels = Resources.FindObjectsOfTypeAll().Where(x=> x.GetType() != typeof(CustomLevel)).ToArray(); + BeatmapLevelSO[] levels = Resources.FindObjectsOfTypeAll().Where(x=> x.GetType() != typeof(CustomBeatmapLevel)).ToArray(); Action job = delegate { @@ -197,17 +197,17 @@ private void RetrieveOSTVideoData() _loadingTask.Run(); } - private void RetrieveCustomLevelVideoData(SongLoader songLoader, List levels) + private void RetrieveCustomLevelVideoData(List levels) { Action job = delegate { try { float i = 0; - foreach (CustomLevel level in levels) + foreach (CustomPreviewBeatmapLevel level in levels) { i++; - var songPath = level.customSongInfo.path; + var songPath = level.customLevelPath; var results = Directory.GetFiles(songPath, "video.json", SearchOption.AllDirectories); if (results.Length == 0) { @@ -222,7 +222,7 @@ private void RetrieveCustomLevelVideoData(SongLoader songLoader, List