|
@@ -377,43 +377,46 @@ namespace SongBrowserPlugin
|
|
/// </summary>
|
|
/// </summary>
|
|
public void RefreshSongList(List<LevelStaticData> songList)
|
|
public void RefreshSongList(List<LevelStaticData> songList)
|
|
{
|
|
{
|
|
- LevelStaticData[] songListArray = songList.ToArray();
|
|
|
|
-
|
|
|
|
_log.Debug("Attempting to refresh the song list view.");
|
|
_log.Debug("Attempting to refresh the song list view.");
|
|
try
|
|
try
|
|
{
|
|
{
|
|
|
|
+ // Check a couple of possible situations that we can't refresh
|
|
if (!_songSelectionMasterView.isActiveAndEnabled)
|
|
if (!_songSelectionMasterView.isActiveAndEnabled)
|
|
{
|
|
{
|
|
_log.Debug("No song list to refresh.");
|
|
_log.Debug("No song list to refresh.");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- // 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,
|
|
|
|
- songListArray,
|
|
|
|
- useLocalLeaderboards, showDismissButton, showPlayerStats, gameplayMode);
|
|
|
|
-
|
|
|
|
- // Refresh the song list
|
|
|
|
SongListTableView songTableView = _songListViewController.GetComponentInChildren<SongListTableView>();
|
|
SongListTableView songTableView = _songListViewController.GetComponentInChildren<SongListTableView>();
|
|
if (songTableView == null)
|
|
if (songTableView == null)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- ReflectionUtil.SetPrivateField(songTableView, "_levels", songListArray);
|
|
|
|
TableView tableView = ReflectionUtil.GetPrivateField<TableView>(songTableView, "_tableView");
|
|
TableView tableView = ReflectionUtil.GetPrivateField<TableView>(songTableView, "_tableView");
|
|
if (tableView == null)
|
|
if (tableView == null)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Convert to Array once in-case this is costly.
|
|
|
|
+ LevelStaticData[] songListArray = songList.ToArray();
|
|
|
|
+
|
|
|
|
+ // 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,
|
|
|
|
+ songListArray,
|
|
|
|
+ useLocalLeaderboards, showDismissButton, showPlayerStats, gameplayMode
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // Refresh the table views
|
|
|
|
+ ReflectionUtil.SetPrivateField(songTableView, "_levels", songListArray);
|
|
tableView.ReloadData();
|
|
tableView.ReloadData();
|
|
|
|
|
|
// Clear Force selection of index 0 so we don't end up in a weird state.
|
|
// Clear Force selection of index 0 so we don't end up in a weird state.
|