Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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")]
4 changes: 4 additions & 0 deletions Patches/AudioManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
18 changes: 15 additions & 3 deletions Patches/BattleSfxSelectPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Il2Cpp;
using Il2CppAssets.Scripts.Database;
using Il2CppAssets.Scripts.PeroTools.GeneralLocalization;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;

Expand Down Expand Up @@ -38,6 +39,11 @@ private static void OnBattleSfxTogglePostfix(int index, bool isOn, BattleSfxSele
checkmark.SetActive(false);

var correctIndex = __instance.m_BattleSfx.FindIndex(new Func<Toggle, bool>(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<Image>().color = __instance.highLight;
Expand Down Expand Up @@ -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<Localization>());
txt.GetComponent<Text>().text = sfxPackName;

var textComp = txt.GetComponent<Text>();
textComp.text = sfxPackName;

var toggleComp = toggle.GetComponent<Toggle>();
var selectedItemHandle = toggle.GetComponent<SelectedItemHandle>();
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<bool>)(selected =>
{

textComp.color = selected ? selectedColor : unSelectedColor;

if (selected)
{
Setting.CurrentSfx = sfxPackName;
Expand All @@ -108,7 +121,6 @@ private static void GenerateToggles(BattleSfxSelect __instance)
}));

toggleComp.SetIsOnWithoutNotify(Setting.CurrentSfx == sfxPackName);

__instance.m_BattleSfx.Add(toggleComp);
}
}
Expand Down
20 changes: 0 additions & 20 deletions Patches/VolumeSelectPatch.cs

This file was deleted.