diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs index 0cbe08b..3f4e8e6 100644 --- a/AssemblyInfo.cs +++ b/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using Main = CustomHitSound.Main; -[assembly: AssemblyVersion("2.1.0")] -[assembly: AssemblyFileVersion("2.1.0")] -[assembly: MelonInfo(typeof(Main), "CustomHitSound", "2.1.0", "lxy")] +[assembly: AssemblyVersion("2.1.2")] +[assembly: AssemblyFileVersion("2.1.2")] +[assembly: MelonInfo(typeof(Main), "CustomHitSound", "2.1.2", "lxy")] [assembly: MelonGame("PeroPeroGames", "MuseDash")] \ No newline at end of file diff --git a/Patches/AudioManagerPatch.cs b/Patches/AudioManagerPatch.cs index 381c0f9..79d0181 100644 --- a/Patches/AudioManagerPatch.cs +++ b/Patches/AudioManagerPatch.cs @@ -20,6 +20,10 @@ private static void Postfix(AudioManager __instance) var length = Setting.CurrentSfx.Length + 1; var sfxName = Path.GetFileNameWithoutExtension(sfxFilePath)[..^length]; var audioClip = Manager.Load(sfxFilePath); + if (sfxName == "sfx_press") + { + __instance.m_SfxBuffer["sfx_press_horse"] = audioClip; + } __instance.m_SfxBuffer[sfxName] = audioClip; } diff --git a/Patches/BattleSfxSelectPatch.cs b/Patches/BattleSfxSelectPatch.cs index 8d79629..cbbc7b7 100644 --- a/Patches/BattleSfxSelectPatch.cs +++ b/Patches/BattleSfxSelectPatch.cs @@ -2,6 +2,7 @@ using Il2Cpp; using Il2CppAssets.Scripts.Database; using Il2CppAssets.Scripts.PeroTools.GeneralLocalization; +using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; @@ -38,6 +39,11 @@ private static void OnBattleSfxTogglePostfix(int index, bool isOn, BattleSfxSele checkmark.SetActive(false); var correctIndex = __instance.m_BattleSfx.FindIndex(new Func(x => x.name == $"Tgl{Setting.CurrentSfx}")); + if (correctIndex < 0) + { + Setting.CurrentSfx = string.Empty; + return; + } var correctImgBg = __instance.m_Content.GetChild(correctIndex).GetChild(0); __instance.m_BattleSfx[correctIndex].isOn = true; correctImgBg.GetComponent().color = __instance.highLight; @@ -89,11 +95,18 @@ private static void GenerateToggles(BattleSfxSelect __instance) var imgBg = toggle.transform.GetChild(0); var txt = imgBg.GetChild(1); Object.Destroy(txt.GetComponent()); - txt.GetComponent().text = sfxPackName; - + var textComp = txt.GetComponent(); + textComp.text = sfxPackName; + var toggleComp = toggle.GetComponent(); + var selectedItemHandle = toggle.GetComponent(); + var selectedColor = selectedItemHandle.selectedColor = new Color(1, 1, 1, 1); + var unSelectedColor = selectedItemHandle.unSelectedColor = new Color(0.996f, 0.651f, 0.854f, 1); toggleComp.onValueChanged.AddListener((Action)(selected => { + + textComp.color = selected ? selectedColor : unSelectedColor; + if (selected) { Setting.CurrentSfx = sfxPackName; @@ -108,7 +121,6 @@ private static void GenerateToggles(BattleSfxSelect __instance) })); toggleComp.SetIsOnWithoutNotify(Setting.CurrentSfx == sfxPackName); - __instance.m_BattleSfx.Add(toggleComp); } } diff --git a/Patches/VolumeSelectPatch.cs b/Patches/VolumeSelectPatch.cs deleted file mode 100644 index 5f17432..0000000 --- a/Patches/VolumeSelectPatch.cs +++ /dev/null @@ -1,20 +0,0 @@ -using HarmonyLib; -using Il2Cpp; -using UnityEngine.UI; - -namespace CustomHitSound.Patches; - -[HarmonyPatch(typeof(VolumeSelect), nameof(VolumeSelect.SetSelectImage))] -internal static class VolumeSelectPatch -{ - private static void Postfix(VolumeSelect __instance) - { - if (Setting.CurrentSfx == string.Empty) - { - return; - } - - var label = __instance.transform.GetChild(7, 2, 0); - label.GetComponent().text = Setting.CurrentSfx; - } -} \ No newline at end of file