diff --git a/CHANGELOG.md b/CHANGELOG.md index 603f9f3..12a9c92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [English](CHANGELOG_EN.md) | 中文 +## v1.8.3 + +- 修复了音效播放逻辑,确保音效播放时包含正确的游戏对象引用 + ## v1.8.2 - 优化了 UI 组件的布局和初始化逻辑,使用 UIFactory 方法简化代码,提升可读性 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index f6d32be..2c57fd2 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -2,6 +2,10 @@ English | [中文](CHANGELOG.md) +## v1.8.3 + +- Fixed audio playback logic to ensure correct game object references are included when playing sounds + ## v1.8.2 - Optimized UI component layout and initialization logic, simplified code using UIFactory methods, improved readability diff --git a/DuckovCustomModel/Constant.cs b/DuckovCustomModel/Constant.cs index aa4978b..0119982 100644 --- a/DuckovCustomModel/Constant.cs +++ b/DuckovCustomModel/Constant.cs @@ -4,7 +4,7 @@ public static class Constant { public const string ModID = "DuckovCustomModel"; public const string ModName = "Duckov Custom Model"; - public const string ModVersion = "1.8.2"; + public const string ModVersion = "1.8.3"; public const string HarmonyId = "com.ritsukage.DuckovCustomModel"; } } diff --git a/DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs b/DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs index 342deeb..16053f5 100644 --- a/DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs +++ b/DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs @@ -44,7 +44,7 @@ private static bool Prefix( var soundPath = modelHandler.GetRandomSoundByTag(normalizedSoundKey); if (string.IsNullOrEmpty(soundPath)) return true; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, gameObject); __result = null; return false; } @@ -70,7 +70,7 @@ private static bool Prefix(CharacterMainControl __instance) var soundPath = modelHandler.GetRandomSoundByTag(SoundTags.Normal); if (string.IsNullOrEmpty(soundPath)) return true; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, __instance.gameObject); AIMainBrain.MakeSound(new() { fromCharacter = __instance, diff --git a/DuckovCustomModel/HarmonyPatches/ItemDisplayPatches.cs b/DuckovCustomModel/HarmonyPatches/ItemDisplayPatches.cs index febda20..ed22c94 100644 --- a/DuckovCustomModel/HarmonyPatches/ItemDisplayPatches.cs +++ b/DuckovCustomModel/HarmonyPatches/ItemDisplayPatches.cs @@ -64,7 +64,7 @@ private static void ItemDisplay_OnTargetInspectionStateChanged_Postfix(Item item var soundPath = modelHandler.GetRandomSoundByTag(soundTag); if (string.IsNullOrEmpty(soundPath)) return; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, modelHandler.gameObject); } private static void OnItemDestroyed(Item item) diff --git a/DuckovCustomModel/MonoBehaviours/ModelHandler.cs b/DuckovCustomModel/MonoBehaviours/ModelHandler.cs index 2160ad5..fb7dab0 100644 --- a/DuckovCustomModel/MonoBehaviours/ModelHandler.cs +++ b/DuckovCustomModel/MonoBehaviours/ModelHandler.cs @@ -780,7 +780,7 @@ private void OnHurt(DamageInfo damageInfo) var soundPath = GetRandomSoundByTag(SoundTags.TriggerOnHurt); if (string.IsNullOrEmpty(soundPath)) return; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, gameObject); } private void OnDeath(DamageInfo damageInfo) @@ -790,7 +790,7 @@ private void OnDeath(DamageInfo damageInfo) var soundPath = GetRandomSoundByTag(SoundTags.TriggerOnDeath); if (string.IsNullOrEmpty(soundPath)) return; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, gameObject); } private void InitializeCustomCharacterSubVisuals() @@ -979,7 +979,7 @@ private void PlayIdleAudio() var soundPath = GetRandomSoundByTag(SoundTags.Idle); if (string.IsNullOrEmpty(soundPath)) return; - AudioManager.PostCustomSFX(soundPath); + AudioManager.PostCustomSFX(soundPath, gameObject); } private void ScheduleNextIdleAudio()