Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/事件/音效.md
2025-03-17 13:24:39 +08:00

80 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebarDepth: 1
---
# 音效
# 索引
| 事件 | <div style="width: 3em"></div> | 描述 |
| --- | --- | --- |
| [OnMusicStopClientEvent](音效.md#onmusicstopclientevent) | <span style="display:inline;color:#7575f9">客户端</span> | 音乐停止时当玩家调用StopCustomMusic来停止自定义背景音乐时会触发该事件 |
| [PlayMusicClientEvent](音效.md#playmusicclientevent) | <span style="display:inline;color:#7575f9">客户端</span> | 播放背景音乐时触发 |
| [PlaySoundClientEvent](音效.md#playsoundclientevent) | <span style="display:inline;color:#7575f9">客户端</span> | 播放场景音效或UI音效时触发 |
# 音效
## OnMusicStopClientEvent
<span style="display:inline;color:#7575f9">客户端</span>
- 描述
音乐停止时当玩家调用StopCustomMusic来停止自定义背景音乐时会触发该事件
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| musicName | str | 音乐名称 |
- 返回值
## PlayMusicClientEvent
<span style="display:inline;color:#7575f9">客户端</span>
- 描述
播放背景音乐时触发
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| name | str | 即资源包中sounds/music_definitions.json中的event_name并且对应sounds/sound_definitions.json中的key |
| cancel | bool | 设为True可屏蔽该次音效播放 |
- 返回值
## PlaySoundClientEvent
<span style="display:inline;color:#7575f9">客户端</span>
- 描述
播放场景音效或UI音效时触发
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| name | str | 即资源包中sounds/sound_definitions.json中的key |
| pos | tuple(float,float,float) | 音效播放的位置。UI音效为(0,0,0) |
| volume | float | 音量范围为0-1 |
| pitch | float | 播放速度正常速度为1 |
| cancel | bool | 设为True可屏蔽该次音效播放 |
- 返回值