feat: 标题画面播放自定义 BGM 和视频 - #115
Conversation
Summary of ChangesHello @WUGqnwvMQPzl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求引入了一个新模组,允许用户在游戏标题画面播放自定义的视频和音频文件。通过替换默认的标题动画,它为玩家提供了更丰富的个性化选项,并旨在重现旧版本游戏中曾有的标题视频功能。该模组通过HarmonyLib对游戏广告流程进行修改,以实现视频和音频的无缝集成和管理。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
这个 PR 实现了一个很棒的功能,允许在标题画面播放自定义视频。代码结构清晰,并利用 Harmony 来修改游戏行为,实现了预期的效果。
在代码审查中,我发现了一些可以改进的地方,主要集中在并发处理、资源管理和代码健壮性方面。具体来说,存在一个关于视频准备状态的竞态条件,可能会导致不稳定的行为;还有一个小的内存泄漏问题,与动态创建的材质有关。此外,一些硬编码的值和口语化的注释也可以优化,以提高代码的可读性和可维护性。
请查看我提出的具体建议,这些修改将有助于提高这个功能的稳定性和代码质量。
2f14037 to
d897011
Compare
There was a problem hiding this comment.
3 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="AquaMai.Mods/Fancy/TitleScreenTweak.cs">
<violation number="1" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:139">
P2: 当视频在 `PlayLogo` 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 `prepareCompleted` 结果被忽略。</violation>
<violation number="2" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:168">
P1: `TransitionOut` 持续多帧时,这里会每帧且每个 monitor 重复调用 `SoundManager.StartMusic()`;若该调用重新开始已准备的音乐,`IsEndMusic()` 可能永远无法结束标题画面。仅在进入 `TransitionOut` 时启动一次全局音频,并只启动一次视频播放器。</violation>
<violation number="3" location="AquaMai.Mods/Fancy/TitleScreenTweak.cs:229">
P2: 启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 `AllStop`,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| { | ||
| // Stop game's original title music and plays our own | ||
| SoundManager.StopJingle(i); | ||
| SoundManager.StartMusic(); |
There was a problem hiding this comment.
P1: TransitionOut 持续多帧时,这里会每帧且每个 monitor 重复调用 SoundManager.StartMusic();若该调用重新开始已准备的音乐,IsEndMusic() 可能永远无法结束标题画面。仅在进入 TransitionOut 时启动一次全局音频,并只启动一次视频播放器。
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 168:
<comment>`TransitionOut` 持续多帧时,这里会每帧且每个 monitor 重复调用 `SoundManager.StartMusic()`;若该调用重新开始已准备的音乐,`IsEndMusic()` 可能永远无法结束标题画面。仅在进入 `TransitionOut` 时启动一次全局音频,并只启动一次视频播放器。</comment>
<file context>
@@ -0,0 +1,284 @@
+ {
+ // Stop game's original title music and plays our own
+ SoundManager.StopJingle(i);
+ SoundManager.StartMusic();
+
+ // Stops the "maimai DX" voice, turns out it'll conflicts with the custom BGM feature
</file context>
|
|
||
| movieSprite.size = new Vector2(calWidth, calHeight); | ||
|
|
||
| Interlocked.Increment(ref _videoPreparedCount); |
There was a problem hiding this comment.
P2: 当视频在 PlayLogo 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 prepareCompleted 结果被忽略。
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 139:
<comment>当视频在 `PlayLogo` 时尚未准备好但随后才准备完成时,回退后的隐藏播放器仍会把全局状态改成已准备,导致流程播放不可见的视频并按其结束状态过渡。回退后应终止或标记准备流程,使迟到的 `prepareCompleted` 结果被忽略。</comment>
<file context>
@@ -0,0 +1,284 @@
+
+ movieSprite.size = new Vector2(calWidth, calHeight);
+
+ Interlocked.Increment(ref _videoPreparedCount);
+ };
+
</file context>
| { | ||
| // So uhh... When I was testing the feature, this method makes title screen suddently go black before transition | ||
| // I don't like the sudden cutout so I disabled it, not sure about the side effect or compatibility though | ||
| return false; |
There was a problem hiding this comment.
P2: 启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 AllStop,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AquaMai.Mods/Fancy/TitleScreenTweak.cs, line 229:
<comment>启用“标题画面调整”但关闭自定义视频时,这个前缀仍会跳过原始 `AllStop`,因此普通标题画面也会改变停止与过渡行为。仅在自定义视频已准备并确实需要避免黑屏时跳过原方法。</comment>
<file context>
@@ -0,0 +1,284 @@
+ {
+ // So uhh... When I was testing the feature, this method makes title screen suddently go black before transition
+ // I don't like the sudden cutout so I disabled it, not sure about the side effect or compatibility though
+ return false;
+ }
+
</file context>
Sourcery 摘要
在标题画面启用自定义视频和音频播放,并提供可配置的回退与呈现选项。
新功能:
改进:
Original summary in English
Sourcery 摘要
支持在标题画面上配置自定义音频和视频,同时在自定义媒体不可用时保留原始体验。
新功能:
错误修复:
增强功能:
维护工作:
Original summary in English
Summary by Sourcery
Enable configurable custom audio and video presentation on the title screen while preserving the original experience when custom media is unavailable.
New Features:
Bug Fixes:
Enhancements:
Chores: