Explorar el Código

Dependent on new SongDataCore.
Version bump to 6.0.4.

Stephen Damm hace 5 años
padre
commit
bdfe19c604

+ 22 - 22
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -395,9 +395,9 @@ namespace SongBrowser
             {
                 var hash = SongBrowserModel.GetSongHash(x.levelID);
                 double maxPP = 0.0;
-                if (SongDataCore.Plugin.ScoreSaber.Data.Songs.ContainsKey(hash))
+                if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                 {
-                     maxPP = SongDataCore.Plugin.ScoreSaber.Data.Songs[hash].diffs.Max(y => y.pp);
+                     maxPP = SongDataCore.Plugin.Songs.Data.Songs[hash].diffs.Max(y => y.pp);
                 }
 
                 if (maxPP > 0f)
@@ -472,7 +472,7 @@ namespace SongBrowser
         {
             Logger.Info("Sorting song list by performance points...");
 
-            if (!SongDataCore.Plugin.ScoreSaber.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levels;
@@ -482,9 +482,9 @@ namespace SongBrowser
                 .OrderByDescending(x =>
                 {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
-                    if (SongDataCore.Plugin.ScoreSaber.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        return SongDataCore.Plugin.ScoreSaber.Data.Songs[hash].diffs.Max(y => y.pp);
+                        return SongDataCore.Plugin.Songs.Data.Songs[hash].diffs.Max(y => y.pp);
                     }
                     else
                     {
@@ -503,7 +503,7 @@ namespace SongBrowser
         {
             Logger.Info("Sorting song list by star points...");
 
-            if (!SongDataCore.Plugin.ScoreSaber.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levels;
@@ -514,9 +514,9 @@ namespace SongBrowser
                 {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
                     var stars = 0.0;
-                    if (SongDataCore.Plugin.ScoreSaber.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        var diffs = SongDataCore.Plugin.ScoreSaber.Data.Songs[hash].diffs;   
+                        var diffs = SongDataCore.Plugin.Songs.Data.Songs[hash].diffs;   
                         stars = diffs.Max(y => y.star);
                     }
 
@@ -579,7 +579,7 @@ namespace SongBrowser
             Logger.Info("Sorting song list by BeatSaver UpVotes");
 
             // Do not always have data when trying to sort by UpVotes
-            if (!SongDataCore.Plugin.BeatSaver.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levelIds;
@@ -588,9 +588,9 @@ namespace SongBrowser
             return levelIds
                 .OrderByDescending(x => {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
-                    if (SongDataCore.Plugin.BeatSaver.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        return SongDataCore.Plugin.BeatSaver.Data.Songs[hash].stats.upVotes;
+                        return SongDataCore.Plugin.Songs.Data.Songs[hash].upVotes;
                     }
                     else
                     {
@@ -608,9 +608,9 @@ namespace SongBrowser
         private List<IPreviewBeatmapLevel> SortBeatSaverPlayCount(List<IPreviewBeatmapLevel> levelIds)
         {
             Logger.Info("Sorting song list by BeatSaver PlayCount");
-
+            return levelIds;
             // Do not always have data when trying to sort by UpVotes
-            if (!SongDataCore.Plugin.BeatSaver.IsDataAvailable())
+            /*if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levelIds;
@@ -619,16 +619,16 @@ namespace SongBrowser
             return levelIds
                 .OrderByDescending(x => {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
-                    if (SongDataCore.Plugin.BeatSaver.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        return SongDataCore.Plugin.BeatSaver.Data.Songs[hash].stats.plays;
+                        return SongDataCore.Plugin.Songs.Data.Songs[hash].plays;
                     }
                     else
                     {
                         return int.MinValue;
                     }
                 })
-                .ToList();
+                .ToList();*/
         }
 
         /// <summary>
@@ -641,7 +641,7 @@ namespace SongBrowser
             Logger.Info("Sorting song list by BeatSaver Rating!");
 
             // Do not always have data when trying to sort by rating
-            if (!SongDataCore.Plugin.BeatSaver.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levelIds;
@@ -650,9 +650,9 @@ namespace SongBrowser
             return levelIds
                 .OrderByDescending(x => {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
-                    if (SongDataCore.Plugin.BeatSaver.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        return SongDataCore.Plugin.BeatSaver.Data.Songs[hash].stats.rating;
+                        return SongDataCore.Plugin.Songs.Data.Songs[hash].rating;
                     }
                     else
                     {
@@ -672,7 +672,7 @@ namespace SongBrowser
             Logger.Info("Sorting song list by BeatSaver Heat!");
 
             // Do not always have data when trying to sort by heat
-            if (!SongDataCore.Plugin.BeatSaver.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 SortWasMissingData = true;
                 return levelIds;
@@ -681,9 +681,9 @@ namespace SongBrowser
             return levelIds
                 .OrderByDescending(x => {
                     var hash = SongBrowserModel.GetSongHash(x.levelID);
-                    if (SongDataCore.Plugin.BeatSaver.Data.Songs.ContainsKey(hash))
+                    if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
                     {
-                        return SongDataCore.Plugin.BeatSaver.Data.Songs[hash].stats.heat;
+                        return SongDataCore.Plugin.Songs.Data.Songs[hash].heat;
                     }
                     else
                     {

+ 1 - 11
SongBrowserPlugin/DataAccess/SongBrowserSettings.cs

@@ -35,7 +35,7 @@ namespace SongBrowser.DataAccess
 
     static class SongSortModeMethods
     {
-        public static bool NeedsBeatSaverData(this SongSortMode s)
+        public static bool NeedsScoreSaberData(this SongSortMode s)
         {
             switch (s)
             {
@@ -43,16 +43,6 @@ namespace SongBrowser.DataAccess
                 case SongSortMode.Rating:
                 case SongSortMode.PlayCount:
                 case SongSortMode.Heat:
-                    return true;
-                default:
-                    return false;
-            }
-        }
-
-        public static bool NeedsScoreSaberData(this SongSortMode s)
-        {
-            switch (s)
-            {
                 case SongSortMode.PP:
                 case SongSortMode.Stars:
                     return true;

+ 1 - 1
SongBrowserPlugin/Plugin.cs

@@ -9,7 +9,7 @@ namespace SongBrowser
 {
     public class Plugin : IBeatSaberPlugin
     {
-        public const string VERSION_NUMBER = "6.0.3";
+        public const string VERSION_NUMBER = "6.0.4";
         public static Plugin Instance;
         public static IPA.Logging.Logger Log;
 

+ 2 - 2
SongBrowserPlugin/Properties/AssemblyInfo.cs

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.0.3")]
-[assembly: AssemblyFileVersion("6.0.3")]
+[assembly: AssemblyVersion("6.0.4")]
+[assembly: AssemblyFileVersion("6.0.4")]

+ 2 - 1
SongBrowserPlugin/SongBrowser.csproj

@@ -65,7 +65,8 @@
     <Reference Include="SongCore">
       <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Plugins\SongCore.dll</HintPath>
     </Reference>
-    <Reference Include="SongDataCore">
+    <Reference Include="SongDataCore, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Plugins\SongDataCore.dll</HintPath>
     </Reference>
     <Reference Include="System" />

+ 1 - 18
SongBrowserPlugin/SongBrowserApplication.cs

@@ -72,8 +72,7 @@ namespace SongBrowser
 
             InstallHandlers();
 
-            SongDataCore.Plugin.ScoreSaber.OnDataFinishedProcessing += OnScoreSaberDataDownloaded;
-            SongDataCore.Plugin.BeatSaver.OnDataFinishedProcessing += OnBeatSaverDataDownloaded;
+            SongDataCore.Plugin.Songs.OnDataFinishedProcessing += OnScoreSaberDataDownloaded;
 
             if (SongCore.Loader.AreSongsLoaded)
             {
@@ -134,22 +133,6 @@ namespace SongBrowser
         }
 
         /// <summary>
-        /// Update mapping of scrapped song data.
-        /// </summary>
-        private void OnBeatSaverDataDownloaded()
-        {
-            Logger.Trace("OnBeatSaverDataDownloaded");
-            try
-            {
-                StartCoroutine(_songBrowserUI.AsyncWaitForSongUIUpdate());
-            }
-            catch (Exception e)
-            {
-                Logger.Exception("Exception during OnBeatSaverDataDownloaded: ", e);
-            }
-        }
-
-        /// <summary>
         /// Install Our Handlers so we can react to ingame events.
         /// </summary>
         private void InstallHandlers()

+ 8 - 14
SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

@@ -10,7 +10,7 @@ using Logger = SongBrowser.Logging.Logger;
 using System.Collections;
 using SongCore.Utilities;
 using SongBrowser.Internals;
-using SongDataCore.ScoreSaber;
+using SongDataCore.BeatStar;
 
 namespace SongBrowser.UI
 {
@@ -572,8 +572,7 @@ namespace SongBrowser.UI
 
             //yield return new WaitForEndOfFrame();
 
-            if (_model.Settings.sortMode.NeedsBeatSaverData() && SongDataCore.Plugin.BeatSaver.IsDataAvailable() ||
-                _model.Settings.sortMode.NeedsScoreSaberData() && SongDataCore.Plugin.ScoreSaber.IsDataAvailable())
+            if (_model.Settings.sortMode.NeedsScoreSaberData() && SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 ProcessSongList();
                 RefreshSongUI();
@@ -769,8 +768,7 @@ namespace SongBrowser.UI
         {
             Logger.Debug("Sort button - {0} - pressed.", sortMode.ToString());
 
-            if ((sortMode.NeedsScoreSaberData() && !SongDataCore.Plugin.ScoreSaber.IsDataAvailable()) ||
-                (sortMode.NeedsBeatSaverData() && !SongDataCore.Plugin.BeatSaver.IsDataAvailable()))
+            if ((sortMode.NeedsScoreSaberData() && !SongDataCore.Plugin.Songs.IsDataAvailable()))
             {
                 Logger.Info("Data for sort type is not available.");
                 return;
@@ -1114,7 +1112,7 @@ namespace SongBrowser.UI
         {
             Logger.Trace("RefreshScoreSaberData({0})", level.levelID);
 
-            if (!SongDataCore.Plugin.ScoreSaber.IsDataAvailable())
+            if (!SongDataCore.Plugin.Songs.IsDataAvailable())
             {
                 return;
             }
@@ -1130,11 +1128,11 @@ namespace SongBrowser.UI
             // Check if we have data for this song
             Logger.Debug("Checking if have info for song {0}", level.songName);
             var hash = SongBrowserModel.GetSongHash(level.levelID);
-            if (SongDataCore.Plugin.ScoreSaber.Data.Songs.ContainsKey(hash))
+            if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(hash))
             {
                 Logger.Debug("Checking if have difficulty for song {0} difficulty {1}", level.songName, difficultyString);
-                ScoreSaberSong scoreSaberSong = SongDataCore.Plugin.ScoreSaber.Data.Songs[hash];
-                ScoreSaberSongDifficultyStats scoreSaberSongDifficulty = scoreSaberSong.diffs.FirstOrDefault(x => String.Equals(x.diff, difficultyString));
+                BeatStarSong scoreSaberSong = SongDataCore.Plugin.Songs.Data.Songs[hash];
+                BeatStarSongDifficultyStats scoreSaberSongDifficulty = scoreSaberSong.diffs.FirstOrDefault(x => String.Equals(x.diff, difficultyString));
                 if (scoreSaberSongDifficulty != null)
                 {
                     Logger.Debug("Display pp for song.");
@@ -1315,11 +1313,7 @@ namespace SongBrowser.UI
             // So far all we need to refresh is the sort buttons.
             foreach (SongSortButton sortButton in _sortButtonGroup)
             {
-                if (sortButton.SortMode.NeedsBeatSaverData() && !SongDataCore.Plugin.BeatSaver.IsDataAvailable())
-                {
-                    BeatSaberUI.SetButtonBorder(sortButton.Button, Color.gray);
-                }
-                else if (sortButton.SortMode.NeedsScoreSaberData() && !SongDataCore.Plugin.ScoreSaber.IsDataAvailable())
+                if (sortButton.SortMode.NeedsScoreSaberData() && !SongDataCore.Plugin.Songs.IsDataAvailable())
                 {
                     BeatSaberUI.SetButtonBorder(sortButton.Button, Color.gray);
                 }

+ 3 - 3
SongBrowserPlugin/manifest.json

@@ -2,13 +2,13 @@
   "$schema": "https://raw.githubusercontent.com/beat-saber-modding-group/BSIPA-MetadataFileSchema/master/Schema.json",
   "author": "Halsafar",
   "description": "Adds sort and filter features to the level selection UI.",
-  "gameVersion": "1.6.1",
+  "gameVersion": "1.7.0",
   "id": "SongBrowser",
   "name": "Song Browser",
-  "version": "6.0.3",
+  "version": "6.0.4",
   "dependsOn": {
     "SongCore": "^2.7.2",
-    "SongDataCore": "^1.1.5"
+    "SongDataCore": "^1.3.0"
   },
   "features": [
     "print",