Browse Source

Fixed:
- changing the sort mode while viewing the song list was causing the views to be out of sync

Stephen Damm 6 năm trước cách đây
mục cha
commit
1e0d6e14c5
1 tập tin đã thay đổi với 19 bổ sung3 xóa
  1. 19 3
      SongBrowserPlugin/SongBrowser.cs

+ 19 - 3
SongBrowserPlugin/SongBrowser.cs

@@ -383,19 +383,35 @@ namespace SongBrowserPlugin
         {
             _log.Debug("Trying to refresh song list!");
 
-            // Forcefully refresh the song view
-            var newSongList = AcquireSongList();            
+            // Forcefully refresh the song view            
+            var newSongList = AcquireSongList();
+
+            // Refresh the master view
+            bool useLocalLeaderboards = ReflectionUtil.GetPrivateField<bool>(_songSelectionMasterView, "_useLocalLeaderboards");
+            bool showDismissButton = true;
+            bool showPlayerStats = ReflectionUtil.GetPrivateField<bool>(_songSelectionMasterView, "_showPlayerStats");
+            GameplayMode gameplayMode = ReflectionUtil.GetPrivateField<GameplayMode>(_songSelectionMasterView, "_gameplayMode");
+
+            _songSelectionMasterView.Init(
+                _songSelectionMasterView.levelId, 
+                _songSelectionMasterView.difficulty, 
+                newSongList.ToArray(),
+                useLocalLeaderboards, showDismissButton, showPlayerStats, gameplayMode);
+
+            // Refresh the song list
             SongListTableView songTableView = _songListViewController.GetComponentInChildren<SongListTableView>();
             ReflectionUtil.SetPrivateField(songTableView, "_levels", newSongList.ToArray());
             TableView tableView = ReflectionUtil.GetPrivateField<TableView>(songTableView, "_tableView");
             tableView.ReloadData();
-
+                        
+            // Clear Force selection of index 0 so we don't end up in a weird state.
             songTableView.ClearSelection();
             _songListViewController.SelectSong(0);
             _songSelectionMasterView.HandleSongListDidSelectSong(_songListViewController);
 
             RefreshUI();
             
+            // Old method of force refresh
             //Action showMethod = delegate () { };
             //_songSelectionMasterView.DismissModalViewController(showMethod);            
         }