Kaynağa Gözat

#111: Custom sort handler.
Set SongSortMode.Custom

Stephen Damm 4 yıl önce
ebeveyn
işleme
c5155e611d

+ 4 - 0
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -32,6 +32,7 @@ namespace SongBrowser
         public BeatmapCharacteristicSO CurrentBeatmapCharacteristicSO;
         public BeatmapCharacteristicSO CurrentBeatmapCharacteristicSO;
 
 
         public static Func<IAnnotatedBeatmapLevelCollection, List<IPreviewBeatmapLevel>> CustomFilterHandler;
         public static Func<IAnnotatedBeatmapLevelCollection, List<IPreviewBeatmapLevel>> CustomFilterHandler;
+        public static Func<List<IPreviewBeatmapLevel>, List<IPreviewBeatmapLevel>> CustomSortHandler;
         public static Action<Dictionary<string, CustomPreviewBeatmapLevel>> didFinishProcessingSongs;
         public static Action<Dictionary<string, CustomPreviewBeatmapLevel>> didFinishProcessingSongs;
 
 
         public bool SortWasMissingData { get; private set; } = false;
         public bool SortWasMissingData { get; private set; } = false;
@@ -300,6 +301,9 @@ namespace SongBrowser
                 case SongSortMode.Random:
                 case SongSortMode.Random:
                     sortedSongs = SortRandom(filteredSongs);
                     sortedSongs = SortRandom(filteredSongs);
                     break;
                     break;
+                case SongSortMode.Custom:
+                    sortedSongs = CustomSortHandler != null ? CustomSortHandler.Invoke(filteredSongs) : filteredSongs;
+                    break;
                 case SongSortMode.Default:
                 case SongSortMode.Default:
                 default:
                 default:
                     sortedSongs = SortSongName(filteredSongs);
                     sortedSongs = SortSongName(filteredSongs);

+ 3 - 0
SongBrowserPlugin/DataAccess/SongBrowserSettings.cs

@@ -27,6 +27,9 @@ namespace SongBrowser.DataAccess
         PlayCount,
         PlayCount,
         Stars,
         Stars,
 
 
+        // Allow mods to extend functionality.
+        Custom,
+
         // Deprecated
         // Deprecated
         Favorites,
         Favorites,
         Playlist,
         Playlist,