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

[+] add global jacket as Movie #16

Merged
merged 1 commit into from
Jan 26, 2025
Merged

[+] add global jacket as Movie #16

merged 1 commit into from
Jan 26, 2025

Conversation

ck2739046
Copy link
Contributor

@ck2739046 ck2739046 commented Jan 25, 2025

Summary by Sourcery

新功能:

  • 添加了一个配置选项,允许从游戏源加载电影。
Original summary in English

Summary by Sourcery

New Features:

  • Added a configuration option to allow loading movies from the game source.

Copy link

sourcery-ai bot commented Jan 25, 2025

审阅者指南 by Sourcery

此拉取请求引入了一个新功能,允许游戏从游戏源、本地 mp4 文件或封面图像作为备选方案加载电影。优先级依次为:游戏源电影、本地 mp4,然后是封面。

电影加载优先级流程序列图

sequenceDiagram
    participant GameCtrl
    participant DataManager
    participant OptionDataManager
    participant FileSystem
    participant LoadLocalImages
    participant AssetManager

    GameCtrl->>DataManager: GetMusic(SelectMusicID)
    alt loadSourceMovie enabled
        GameCtrl->>OptionDataManager: GetMovieDataPath(movieName.id)
        alt source movie exists
            Note over GameCtrl: Use source movie
            Note over GameCtrl: Exit loading sequence
        end
    end

    alt loadMp4Movie enabled
        GameCtrl->>FileSystem: ResolvePath(movieAssetsDir)
        GameCtrl->>FileSystem: Check MP4 existence
        alt MP4 exists
            Note over GameCtrl: Use MP4 movie
        end
    end

    alt jacketAsMovie enabled
        GameCtrl->>LoadLocalImages: GetJacketTexture2D(movieName.id)
        alt local jacket not found
            GameCtrl->>AssetManager: GetJacketTexture2D(filename)
        end
    end
Loading

文件级更改

更改 详情 文件
添加了从游戏源加载电影的新配置选项。
  • 添加了新的 loadSourceMovie 配置条目。
  • 修改了 LoadLocalBgaAwake 方法,在启用 loadSourceMovie 时加载源电影。
AquaMai.Mods/GameSystem/Assets/MovieLoader.cs
修改了电影加载逻辑,优先级为源电影、本地 mp4,然后是封面。
  • LoadLocalBgaAwake 方法现在首先检查源电影。
  • LoadLocalBgaAwake 方法现在在未找到源电影时检查本地 mp4。
  • LoadLocalBgaAwake 方法现在在未找到源电影和本地 mp4 时检查封面。
AquaMai.Mods/GameSystem/Assets/MovieLoader.cs

提示和命令

与 Sourcery 交互

  • 触发新审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复审阅评论要求 Sourcery 创建问题。您也可以用 @sourcery-ai issue 回复审阅评论来创建问题。
  • 生成拉取请求标题: 在拉取请求标题的任何位置写 @sourcery-ai 以随时生成标题。您也可以在拉取请求中评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何位置写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以在拉取请求中评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求中评论 @sourcery-ai guide 以随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这很有用。
  • 取消所有 Sourcery 审阅: 在拉取请求中评论 @sourcery-ai dismiss 以取消所有现有的 Sourcery 审阅。特别适用于想要重新开始审阅的情况 - 别忘了评论 @sourcery-ai review 以触发新的审阅!
  • 为问题生成行动计划: 在问题中评论 @sourcery-ai plan 以生成问题的行动计划。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request introduces a new feature that allows the game to load a movie from the game source, a local mp4 file, or a jacket image as a fallback. The priority is source movie, local mp4, and then jacket.

Sequence diagram for movie loading priority flow

sequenceDiagram
    participant GameCtrl
    participant DataManager
    participant OptionDataManager
    participant FileSystem
    participant LoadLocalImages
    participant AssetManager

    GameCtrl->>DataManager: GetMusic(SelectMusicID)
    alt loadSourceMovie enabled
        GameCtrl->>OptionDataManager: GetMovieDataPath(movieName.id)
        alt source movie exists
            Note over GameCtrl: Use source movie
            Note over GameCtrl: Exit loading sequence
        end
    end

    alt loadMp4Movie enabled
        GameCtrl->>FileSystem: ResolvePath(movieAssetsDir)
        GameCtrl->>FileSystem: Check MP4 existence
        alt MP4 exists
            Note over GameCtrl: Use MP4 movie
        end
    end

    alt jacketAsMovie enabled
        GameCtrl->>LoadLocalImages: GetJacketTexture2D(movieName.id)
        alt local jacket not found
            GameCtrl->>AssetManager: GetJacketTexture2D(filename)
        end
    end
Loading

File-Level Changes

Change Details Files
Added a new configuration option to load movies from the game source.
  • Added a new loadSourceMovie config entry.
  • Modified the LoadLocalBgaAwake method to load source movie if loadSourceMovie is enabled.
AquaMai.Mods/GameSystem/Assets/MovieLoader.cs
Modified the movie loading logic to prioritize source movie, local mp4, and then jacket.
  • The LoadLocalBgaAwake method now checks for source movie first.
  • The LoadLocalBgaAwake method now checks for local mp4 if source movie is not found.
  • The LoadLocalBgaAwake method now checks for jacket if source movie and local mp4 are not found.
AquaMai.Mods/GameSystem/Assets/MovieLoader.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ck2739046 - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 在源电影加载部分的提前返回(if (!moviePath.Contains("dummy")) return;)将阻止在源电影存在但加载失败时回退到 MP4/jacket 选项。考虑处理这种情况。
  • 考虑添加更详细的日志记录,以指示成功加载了哪个电影源(source/MP4/jacket),以帮助进行故障排除。
这是我在审查期间查看的内容
  • 🟡 一般问题:发现 2 个问题
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对于开源是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请点击每条评论上的 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @ck2739046 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The early return in the source movie loading section (if (!moviePath.Contains("dummy")) return;) will prevent falling back to MP4/jacket options when a source movie exists but fails to load. Consider handling this case.
  • Consider adding more detailed logging to indicate which movie source was successfully loaded (source/MP4/jacket) to help with troubleshooting.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

AquaMai.Mods/GameSystem/Assets/MovieLoader.cs Show resolved Hide resolved
}

var mp4Exists = File.Exists(mp4Path);
var jacket = LoadLocalImages.GetJacketTexture2D(music.movieName.id);
if (!mp4Exists && jacket is null)
{
MelonLogger.Msg("No jacket found for music " + music);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: 当 mp4Exists 为 false 但 jacket 存在时,错误信息具有误导性

考虑使消息更准确,例如 '未找到音乐的电影或 jacket'

Original comment in English

issue: Error message is misleading when mp4Exists is false but jacket exists

Consider making the message more accurate, e.g. 'No movie or jacket found for music'

@clansty clansty merged commit e8655e6 into MewoLab:main Jan 26, 2025
1 check passed
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.

2 participants