Explorar el Código

Working with BeatSaber 1.8.0.
Updated to new BSIPA4.
Version bump to 6.0.5.

Stephen Damm hace 5 años
padre
commit
a98271fab5

+ 2 - 2
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -193,7 +193,7 @@ namespace SongBrowser
             _levelIdToPlayCount = new Dictionary<string, int>();
 
             // Build a map of levelId to sum of all playcounts and sort.
-            PlayerDataModelSO playerData = Resources.FindObjectsOfTypeAll<PlayerDataModelSO>().FirstOrDefault();            
+            PlayerDataModel playerData = Resources.FindObjectsOfTypeAll<PlayerDataModel>().FirstOrDefault();
             foreach (var levelData in playerData.playerData.levelsStatsData)
             {
                 if (!_levelIdToPlayCount.ContainsKey(levelData.levelID))
@@ -340,7 +340,7 @@ namespace SongBrowser
         {
             Logger.Info("Filtering song list as favorites playlist...");
 
-            PlayerDataModelSO playerData = Resources.FindObjectsOfTypeAll<PlayerDataModelSO>().FirstOrDefault();
+            PlayerDataModel playerData = Resources.FindObjectsOfTypeAll<PlayerDataModel>().FirstOrDefault();
             return levels.Where(x => playerData.playerData.favoritesLevelIds.Contains(x.levelID)).ToList();
         }
 

+ 1 - 1
SongBrowserPlugin/DataAccess/SongBrowserSettings.cs

@@ -220,7 +220,7 @@ namespace SongBrowser.DataAccess
             Logger.Info("Migrating [{0}] into the In-Game favorites.", oldFavoritesPath);
 
             Playlist oldFavorites = Playlist.LoadPlaylist(oldFavoritesPath);
-            PlayerDataModelSO playerData = Resources.FindObjectsOfTypeAll<PlayerDataModelSO>().FirstOrDefault();
+            PlayerDataModel playerData = Resources.FindObjectsOfTypeAll<PlayerDataModel>().FirstOrDefault();
             foreach (PlaylistSong song in oldFavorites.songs)
             {
                 string levelID = CustomLevelLoader.kCustomLevelPrefixId + song.hash;

+ 7 - 28
SongBrowserPlugin/Plugin.cs

@@ -7,17 +7,20 @@ using BS_Utils.Utilities;
 
 namespace SongBrowser
 {
-    public class Plugin : IBeatSaberPlugin
+    [Plugin(RuntimeOptions.SingleStartInit)]
+    public class Plugin
     {
-        public const string VERSION_NUMBER = "6.0.4";
+        public const string VERSION_NUMBER = "6.0.5";
         public static Plugin Instance;
         public static IPA.Logging.Logger Log;
 
-        public void Init(object nullObject, IPA.Logging.Logger logger)
+        [Init]
+        public void Init(IPA.Logging.Logger logger)
         {
             Log = logger;
         }
 
+        [OnStart]
         public void OnApplicationStart()
         {
             Instance = this;
@@ -28,6 +31,7 @@ namespace SongBrowser
             BSEvents.menuSceneLoadedFresh += OnMenuSceneLoadedFresh;
         }
 
+        [OnExit]
         public void OnApplicationQuit()
         {            
         }
@@ -43,30 +47,5 @@ namespace SongBrowser
                 Logger.Exception("Exception on fresh menu scene change: " + e);
             }
         }
-
-        public void OnUpdate()
-        {
-
-        }
-
-        public void OnFixedUpdate()
-        {
-
-        }
-
-        public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
-        {
-
-        }
-
-        public void OnSceneUnloaded(Scene scene)
-        {
-
-        }
-
-        public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
-        {
-
-        }
     }
 }

+ 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.4")]
-[assembly: AssemblyFileVersion("6.0.4")]
+[assembly: AssemblyVersion("6.0.5")]
+[assembly: AssemblyFileVersion("6.0.5")]

+ 5 - 4
SongBrowserPlugin/SongBrowser.csproj

@@ -50,14 +50,15 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
     </Reference>
-    <Reference Include="MainAssembly">
-      <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Beat Saber_Data\Managed\MainAssembly.dll</HintPath>
+    <Reference Include="Main">
+      <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Beat Saber_Data\Managed\Main.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json.12.0.0.0">
       <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Libs\Newtonsoft.Json.12.0.0.0.dll</HintPath>
     </Reference>
-    <Reference Include="Polyglot.Scripts">
-      <HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Polyglot.Scripts.dll</HintPath>
+    <Reference Include="Polyglot, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Beat Saber_Data\Managed\Polyglot.dll</HintPath>
     </Reference>
     <Reference Include="SongCore">
       <HintPath>D:\Games\Steam\SteamApps\common\Beat Saber\Plugins\SongCore.dll</HintPath>

+ 5 - 4
SongBrowserPlugin/UI/Browser/BeatSaberUIController.cs

@@ -1,4 +1,5 @@
-using HMUI;
+using BS_Utils.Utilities;
+using HMUI;
 using IPA.Utilities;
 using System;
 using System.Collections.Generic;
@@ -90,7 +91,7 @@ namespace SongBrowser.DataAccess
             LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform;
             Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID());
 
-            TableView tableView = ReflectionUtil.GetPrivateField<TableView>(LevelCollectionTableView, "_tableView");
+            TableView tableView = LevelCollectionTableView.GetPrivateField<TableView>("_tableView");
             TableViewPageUpButton = tableView.GetPrivateField<Button>("_pageUpButton");
             TableViewPageDownButton = tableView.GetPrivateField<Button>("_pageDownButton");
             Logger.Debug("Acquired Page Up and Down buttons...");
@@ -278,8 +279,8 @@ namespace SongBrowser.DataAccess
                 }
 
                 Logger.Debug("Checking if TableView is initialized...");
-                TableView tableView = ReflectionUtil.GetPrivateField<TableView>(LevelCollectionTableView, "_tableView");
-                bool tableViewInit = ReflectionUtil.GetPrivateField<bool>(tableView, "_isInitialized");
+                TableView tableView = LevelCollectionTableView.GetPrivateField<TableView>("_tableView");
+                bool tableViewInit = tableView.GetPrivateField<bool>("_isInitialized");
 
                 Logger.Debug("Reloading SongList TableView");
                 tableView.ReloadData();

+ 1 - 1
SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

@@ -635,7 +635,7 @@ namespace SongBrowser.UI
         /// </summary>
         /// <param name="arg1"></param>
         /// <param name="arg2"></param>
-        private void _levelPacksTableView_didSelectPackEvent(LevelPacksTableView arg1, IBeatmapLevelPack arg2)
+        private void _levelPacksTableView_didSelectPackEvent(AnnotatedBeatmapLevelCollectionsTableView arg1, IBeatmapLevelPack arg2)
         {
             Logger.Trace("_levelPacksTableView_didSelectPackEvent(arg2={0})", arg2);
 

+ 8 - 6
SongBrowserPlugin/manifest.json

@@ -1,18 +1,20 @@
 {
-  "$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.7.0",
+  "gameVersion": "1.8.0",
   "id": "SongBrowser",
   "name": "Song Browser",
-  "version": "6.0.4",
+  "version": "6.0.5",
   "dependsOn": {
-    "SongCore": "^2.7.2",
-    "SongDataCore": "^1.3.0"
+    "SongCore": "^2.9.0",
+    "SongDataCore": "^1.3.3"
   },
   "features": [
     "print",
     "debug",
     "warn"
-  ]
+  ],
+  "misc": {
+    "plugin-hint": "SongBrowser.Plugin"
+  }
 }