From 348884d9cae3b3fafcf891c79be50b5e5a325bd6 Mon Sep 17 00:00:00 2001 From: OLC Date: Tue, 18 Nov 2025 16:30:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E9=9F=B3=E6=95=88?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E9=80=BB=E8=BE=91=E4=BB=A5=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E5=AF=B9=E8=B1=A1=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改多个文件中的音效播放调用,确保在播放自定义音效时传递相应的游戏对象引用,以改善音效的上下文关联性。 --- DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs | 4 ++-- DuckovCustomModel/HarmonyPatches/ItemDisplayPatches.cs | 2 +- DuckovCustomModel/MonoBehaviours/ModelHandler.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) 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() From 3f1c81dccf6ebf4e4c5f318562dbae8f26006eb8 Mon Sep 17 00:00:00 2001 From: OLC Date: Tue, 18 Nov 2025 16:51:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=87=B3=20v1.8.3=20=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ CHANGELOG_EN.md | 4 ++++ DuckovCustomModel/Constant.cs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) 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"; } }