소스 검색

Code cleanup.

Halsafar 4 년 전
부모
커밋
42074565a0

+ 3 - 3
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -26,7 +26,7 @@ namespace SongBrowser
 
         // song list management
         private double _customSongDirLastWriteTime = 0;
-        private Dictionary<String, double> _cachedLastWriteTimes;
+        private readonly Dictionary<String, double> _cachedLastWriteTimes;
         private Dictionary<string, int> _levelIdToPlayCount;
 
         public BeatmapCharacteristicSO CurrentBeatmapCharacteristicSO;
@@ -159,7 +159,7 @@ namespace SongBrowser
         private double GetSongUserDate(CustomPreviewBeatmapLevel level)
         {
             var coverPath = Path.Combine(level.customLevelPath, level.standardLevelInfoSaveData.coverImageFilename);
-            var lastTime = EPOCH;
+            DateTime lastTime;
             if (File.Exists(coverPath))
             {
                 var lastWriteTime = File.GetLastWriteTimeUtc(coverPath);
@@ -210,7 +210,7 @@ namespace SongBrowser
         /// <summary>
         /// Sort the song list based on the settings.
         /// </summary>
-        public void ProcessSongList(IAnnotatedBeatmapLevelCollection selectedBeatmapCollection, LevelCollectionViewController levelCollectionViewController, LevelSelectionNavigationController navController)
+        public void ProcessSongList(IAnnotatedBeatmapLevelCollection selectedBeatmapCollection, LevelSelectionNavigationController navController)
         {
             Logger.Trace("ProcessSongList()");
 

+ 1 - 0
SongBrowserPlugin/Internals/BeatSaberUI.cs

@@ -40,6 +40,7 @@ namespace SongBrowser.Internals
             vc.rectTransform.sizeDelta = new Vector2(0f, 0f);
             vc.rectTransform.anchoredPosition = new Vector2(0f, 0f);
             vc.gameObject.SetActive(false);
+            vc.name = name;
             return vc;
         }
 

+ 4 - 6
SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

@@ -97,7 +97,7 @@ namespace SongBrowser.UI
             Logger.Trace("CreateUI()");
 
             // Determine the flow controller to use
-            FlowCoordinator flowCoordinator = null;
+            FlowCoordinator flowCoordinator;
             if (mode == MainMenuViewController.MenuButton.SoloFreePlay)
             {
                 Logger.Debug("Entering SOLO mode...");
@@ -110,8 +110,7 @@ namespace SongBrowser.UI
             }
             else
             {
-                Logger.Debug("Entering SOLO CAMPAIGN mode...");
-                flowCoordinator = Resources.FindObjectsOfTypeAll<CampaignFlowCoordinator>().First();
+                Logger.Info("Entering Unsupported mode...");                
                 return;
             }
 
@@ -552,7 +551,7 @@ namespace SongBrowser.UI
                 return;
             }
 
-            this._model.ProcessSongList(_lastLevelCollection, _beatUi.LevelCollectionViewController, _beatUi.LevelSelectionNavigationController);
+            this._model.ProcessSongList(_lastLevelCollection, _beatUi.LevelSelectionNavigationController);
         }
 
         /// <summary>
@@ -1029,7 +1028,6 @@ namespace SongBrowser.UI
                 segmentSize = LIST_ITEMS_VISIBLE_AT_ONCE;
             }
 
-            TableView tableView = ReflectionUtil.GetPrivateField<TableView>(_beatUi.LevelCollectionTableView, "_tableView");
             int currentRow = _beatUi.LevelCollectionTableView.GetPrivateField<int>("_selectedRow");
             int jumpDirection = Math.Sign(numJumps);
             int newRow = currentRow + (jumpDirection * segmentSize);
@@ -1225,7 +1223,7 @@ namespace SongBrowser.UI
         /// </summary>
         private void RefreshCurrentSelectionDisplay()
         {
-            string sortByDisplay = null;
+            string sortByDisplay;
             if (_model.Settings.sortMode == SongSortMode.Default)
             {
                 sortByDisplay = "Title";