diff --git a/source/SongCore/Data/SongData.cs b/source/SongCore/Data/SongData.cs index b4492e4..ef4396f 100644 --- a/source/SongCore/Data/SongData.cs +++ b/source/SongCore/Data/SongData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Drawing.Imaging; using System.IO; using System.Linq; @@ -121,8 +122,10 @@ public class MapColor public float r; public float g; public float b; - public float a; + [DefaultValue(1)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + public float a = 1f; public MapColor(float r, float g, float b, float a = 1f) { diff --git a/source/SongCore/HarmonyPatches/CosmeticCharacteristicsPatches.cs b/source/SongCore/HarmonyPatches/CosmeticCharacteristicsPatches.cs index fe958cd..3b953b2 100644 --- a/source/SongCore/HarmonyPatches/CosmeticCharacteristicsPatches.cs +++ b/source/SongCore/HarmonyPatches/CosmeticCharacteristicsPatches.cs @@ -95,20 +95,22 @@ internal class CosmeticCharacteristicsPatch // public static OverrideClasses.CustomLevel previouslySelectedSong = null; private static void Postfix(IReadOnlyList difficultyBeatmapSets, BeatmapCharacteristicSO selectedBeatmapCharacteristic, ref List ____beatmapCharacteristics, ref IconSegmentedControl ____segmentedControl) { - if (!Plugin.Configuration.DisplayCustomCharacteristics) - return; - var diffBeatmapLevel = difficultyBeatmapSets.FirstOrDefault().difficultyBeatmaps.FirstOrDefault().level; - var level = diffBeatmapLevel is CustomBeatmapLevel ? diffBeatmapLevel as CustomPreviewBeatmapLevel : null; + if (!Plugin.Configuration.DisplayCustomCharacteristics) return; - if (level == null) - return; + var diffBeatmapSetsBeatmaps = difficultyBeatmapSets.FirstOrDefault().difficultyBeatmaps; + if (diffBeatmapSetsBeatmaps == null) return; + var diffBeatmapItem = diffBeatmapSetsBeatmaps.FirstOrDefault(); + if (diffBeatmapItem == null) return; + var diffBeatmapLevel = diffBeatmapItem.level; + var level = diffBeatmapLevel is CustomBeatmapLevel ? diffBeatmapLevel as CustomPreviewBeatmapLevel : null; + + if (level == null) return; var songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(level)); - if (songData == null) - return; - if (songData._characteristicDetails == null) - return; + if (songData == null) return; + if (songData._characteristicDetails == null) return; + if (____segmentedControl == null) return; if (songData._characteristicDetails.Length > 0) { @@ -137,7 +139,7 @@ private static void Postfix(IReadOnlyList difficultyBeatm } if (characteristic == selectedBeatmapCharacteristic) - { + { cell = i; } i++; diff --git a/source/SongCore/manifest.json b/source/SongCore/manifest.json index e8dba12..2e106b8 100644 --- a/source/SongCore/manifest.json +++ b/source/SongCore/manifest.json @@ -5,7 +5,7 @@ "gameVersion": "1.31.0", "id": "SongCore", "name": "SongCore", - "version": "3.11.1", + "version": "3.11.2", "dependsOn": { "BSIPA": "^4.3.0", "BeatSaberMarkupLanguage": "^1.7.6",