Ver código fonte

Fix duplicates in playlists breaking things.
Version bump.

Stephen Damm 6 anos atrás
pai
commit
0d45bf245b

+ 10 - 1
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -809,7 +809,16 @@ namespace SongBrowserPlugin
             LevelCollectionSO levelCollections = Resources.FindObjectsOfTypeAll<LevelCollectionSO>().FirstOrDefault();
             var levels = levelCollections.GetLevelsWithBeatmapCharacteristic(CurrentBeatmapCharacteristicSO);
 
-            Dictionary<String, LevelSO> levelDict = levels.Select((val, index) => new { LevelId = val.levelID, Level = val }).ToDictionary(i => i.LevelId, i => i.Level);
+            //Dictionary<String, LevelSO> levelDict = levels.Select((val, index) => new { LevelId = val.levelID, Level = val }).ToDictionary(i => i.LevelId, i => i.Level);
+            Dictionary<String, LevelSO> levelDict = new Dictionary<string, LevelSO>();
+            foreach (LevelSO level in levels)
+            {
+                if (!levelDict.ContainsKey(level.levelID))
+                {
+                    levelDict.Add(level.levelID, level);
+                }
+            }
+
             List<LevelSO> songList = new List<LevelSO>();
             foreach (PlaylistSong ps in this.CurrentPlaylist.Songs)
             {

+ 2 - 2
SongBrowserPlugin/Plugin.cs

@@ -7,7 +7,7 @@ namespace SongBrowserPlugin
 {
     public class Plugin : IPlugin
     {
-        public const string VERSION_NUMBER = "v2.4.2";
+        public const string VERSION_NUMBER = "v2.4.3";
 
         public string Name
         {
@@ -71,4 +71,4 @@ namespace SongBrowserPlugin
 
         }
     }
-}
+}