Conversation
## 更新内容 - 改进音效播放系统,统一使用 ModelHandler.PlaySound 方法管理所有音效播放 - 新增音效播放模式支持(Normal、StopPrevious、SkipIfPlaying、UseTempObject),提供更精细的音效控制 - 新增音效实例管理功能,支持停止指定音效或所有音效 - 改进音效打断机制: - 玩家按键触发(F1 嘎嘎)和 AI 自动触发(normal、surprise 标签)共享同一打断组 - 脚步声拥有独立的打断组 - 受伤音效如果已有音效正在播放则跳过,避免重复播放 - 死亡音效会先停止所有正在播放的音效,然后播放死亡音效 - 改进 AudioUtils.PlayAudioWithTempObject 方法,返回 EventInstance 以便更好地管理音效生命周期 - 移除不再使用的 SoundTags.Death 常量,统一使用 trigger_on_death 标签 - 更新 README 和 CHANGELOG,详细说明音效打断机制 ## 版本更新 - 更新版本号至 v1.8.5 - 更新 CHANGELOG.md 和 CHANGELOG_EN.md - 更新 README.md 和 README_EN.md,优化音效标签和打断机制说明
- 将 SoundPlayMode 枚举从 ModelHandler 移动到 DuckovCustomModel.Core.Data 命名空间 - 更新所有引用以使用新的命名空间 - 提升代码组织结构,使枚举定义更符合项目架构
There was a problem hiding this comment.
Pull Request Overview
This PR improves the audio playback system by introducing centralized sound management through ModelHandler.PlaySound, adding multiple playback modes for fine-grained control, and implementing sound interrupt mechanisms. The changes aim to prevent sound overlap and provide better control over when sounds should interrupt each other.
- Unified audio playback through
ModelHandler.PlaySoundwith support for four playback modes (Normal, StopPrevious, SkipIfPlaying, UseTempObject) - Implemented sound instance tracking and management with methods to stop specific or all sounds
- Enhanced interrupt mechanisms for different sound categories (player/AI vocalizations share one group, footsteps have independent group, hurt sounds skip if playing, death sounds stop all other sounds)
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| DuckovCustomModel/Constant.cs | Version bump to 1.8.5 |
| DuckovCustomModel.Core/Data/SoundPlayMode.cs | New enum defining four sound playback modes for controlling interrupt behavior |
| DuckovCustomModel.Core/Data/SoundTags.cs | Removed deprecated "Death" constant, unified usage of "trigger_on_death" tag |
| DuckovCustomModel/Utils/AudioUtils.cs | Modified to return EventInstance for better lifecycle management |
| DuckovCustomModel/MonoBehaviours/ModelHandler.cs | Added centralized sound management system with PlaySound method, sound instance tracking, and interrupt mechanisms |
| DuckovCustomModel/HarmonyPatches/AudioManagerPatches.cs | Updated to use new ModelHandler.PlaySound API with appropriate playback modes |
| README.md | Updated Chinese documentation to clarify sound interrupt mechanisms and tag behaviors |
| README_EN.md | Updated English documentation to clarify sound interrupt mechanisms and tag behaviors |
| CHANGELOG.md | Added v1.8.5 changelog entries in Chinese |
| CHANGELOG_EN.md | Added v1.8.5 changelog entries in English |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 新增 AudioUtils.CheckSoundIsPlaying 方法,同时检查实例有效性和播放状态 - 使用新方法替换所有 isValid() 调用,更准确地判断音效是否正在播放 - 统一音效状态检查逻辑,提高代码可维护性
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
更新内容
ormal\、\surprise\ 标签)共享同一打断组,新播放的音效会打断同组内正在播放的音效
版本更新