Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加game.parseDieTextMap,将character[4]里的阵亡语音相关屎山规范化 #1315

Merged
merged 4 commits into from
May 5, 2024

Conversation

Spmario233
Copy link
Collaborator

@Spmario233 Spmario233 commented May 4, 2024

PR受影响的平台

全部

诱因和背景

先前添加Character类时,未对阵亡语音相关的参数进行处理。为了统一本体内存在的多种不同的阵亡语音结构,做出此次更新。

PR描述

原本位于character[4]中的"die:ext:xxx/yyy"格式和"die_audio:xxx:yyy"的文件,现在全部统一化格式,进入Character#dieAudios中。例:

//die_audio的旧写法(主要用于族钟会的多种阵亡语音)
clan_zhonghui: ["male", "wei", "3/4", ["clanyuzhi", "clanxieshu", "clanbaozu"], ["clan:颍川钟氏", "die_audio:clan_zhonghui:clan_zhonghui2:clan_zhonghui3"]],
//转换为Character类之后的dieAudios
{
    dieAudios: ["clan_zhonghui", "clan_zhonghui2", "clan_zhonghui3"],
}

//die的旧写法(主要用于扩展武将的阵亡语音)
big_banana: ["male","wei",3,["banana_skill"],["die:ext:无名扩展/big_banana"]],
//转换为Character类之后的dieAudios
{
    dieAudios: ["ext:无名扩展/big_banana"],
}

当角色阵亡时,若dieAudios存在内容,则从dieAudios中存在的内容里随机选择一条播放。若不存在内容,则播放audio/die/角色名称.mp3
此外,提供game.parseDieTextMap函数。返回一个角色拥有的所有阵亡语音ID/对应语音文件/对应台词。例:

>game.parseDieTextMap("clan_zhonghui")
返回值如下:
[
    {
        "key": "clan_zhonghui",
        "file": "die/clan_zhonghui.mp3",
        "text": "兵来似欲作恶,当云何?"
    },
    {
        "key": "clan_zhonghui2",
        "file": "die/clan_zhonghui2.mp3",
        "text": "伯约误我!",
    },
    {
        "key": "clan_zhonghui3",
        "file": "die/clan_zhonghui3.mp3"
        "text": "谋事在人,成事在天……",
    }
]

PR测试

武将资料页面能够正确显示武将的阵亡语音台词。
本地不断杀死族钟会,成功做到随机播放语音。并且能够正确播放扩展的阵亡语音。

扩展适配

需要具有阵亡特效,覆盖了die事件流程的扩展更新阵亡语音的播放,从而进行适配。但Character类本身提供了垃圾桶的向下兼容,也许并不会出现问题?

检查清单

  • 我已经进行了充足的测试,且现有的测试都已通过
  • 如果此次PR涉及到新功能的添加,我已在PR描述中写入详细文档
  • 如果此次PR需要扩展跟进,我已在扩展适配中写入详细文档
  • 如果这个PR解决了一个issue,我在诱因和背景中明确链接到该issue
  • 我保证该PR中没有随意修改换行符等内容,没有制造出大量的Diff
  • 我保证该PR遵循项目中.editorconfigeslint.config.mjsprettier.config.mjs所规定的代码样式,并且已经通过prettier格式化过代码

@Spmario233 Spmario233 merged commit f1699f7 into PR-Branch May 5, 2024
@Spmario233 Spmario233 deleted the die-audio-dev branch May 5, 2024 03:07
@Spmario233 Spmario233 mentioned this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant