Skip to content

[F] OneKeyRetrySkip导致的一键跳关,不会设置TrackSkip Flag的问题#129

Merged
clansty merged 1 commit into
MuNET-OSS:mainfrom
Starrah:track-skip-flag
May 13, 2026
Merged

[F] OneKeyRetrySkip导致的一键跳关,不会设置TrackSkip Flag的问题#129
clansty merged 1 commit into
MuNET-OSS:mainfrom
Starrah:track-skip-flag

Conversation

@Starrah
Copy link
Copy Markdown
Contributor

@Starrah Starrah commented May 13, 2026

只是设置一个flag。
游戏官方的正常track skip逻辑是会设置这个flag的,所以我们也应该设一下

Summary by Sourcery

Bug Fixes:

  • 通过为两个播放器设置曲目跳过标志,确保一键重试跳过功能能正确地将曲目标记为已跳过。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure one-key retry skip correctly marks tracks as skipped by setting the track skip flag for both players.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 13, 2026

审阅者指南(在小型 PR 上折叠显示)

审阅者指南

在执行单键重试/跳过时,为两位玩家都设置 TrackSkip 标志,使其行为与游戏的正常“跳过曲目”逻辑一致。

OneKeyRetrySkip 中 TrackSkip 标志设置的时序图

sequenceDiagram
    participant OneKeyRetrySkip
    participant GamePlayManager
    participant Player0Score
    participant Player1Score

    OneKeyRetrySkip->>GamePlayManager: SetSyncResult(0)

    OneKeyRetrySkip->>GamePlayManager: GetGameScore(0)
    GamePlayManager-->>OneKeyRetrySkip: GameScore0
    OneKeyRetrySkip->>Player0Score: SetTrackSkip()

    OneKeyRetrySkip->>GamePlayManager: GetGameScore(1)
    GamePlayManager-->>OneKeyRetrySkip: GameScore1
    OneKeyRetrySkip->>Player1Score: SetTrackSkip()
Loading

文件级别变更

变更 详情 文件
确保在调用 OneKeyRetrySkip 时,为两位玩家的游戏分数都设置 TrackSkip 标志。
  • 在发送重试/跳过消息并同步结果之后,遍历两个玩家索引(0 和 1)。
  • 对于每位玩家,从 GamePlayManager 安全地获取对应的 GameScore 实例,如果存在,则调用 SetTrackSkip() 将该曲目标记为已跳过。
  • 在新的 TrackSkip 设置逻辑之后,继续调用 SetRelease() 以保持现有流程。
AquaMai.Mods/UX/OneKeyRetrySkip.cs

提示与命令

与 Sourcery 交互

  • 触发新的代码审查: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 在某条审查评论下回复,请求 Sourcery 从该评论创建一个 issue。你也可以直接回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。也可以在 Pull Request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 正文的任意位置写入 @sourcery-ai summary,即可在指定位置生成 PR 摘要。也可以在 Pull Request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,即可标记解决所有 Sourcery 评论。如果你已经处理完所有评论且不希望再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在 Pull Request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。特别适用于你希望从零开始进行一次新审查的场景——别忘了再评论 @sourcery-ai review 以触发新的审查!

自定义你的使用体验

访问你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 Pull Request 摘要、审阅者指南等审查功能。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds setting of the TrackSkip flag for both players when performing a one-key retry/skip so that it matches the game’s normal track-skip behavior.

Sequence diagram for TrackSkip flag setting in OneKeyRetrySkip

sequenceDiagram
    participant OneKeyRetrySkip
    participant GamePlayManager
    participant Player0Score
    participant Player1Score

    OneKeyRetrySkip->>GamePlayManager: SetSyncResult(0)

    OneKeyRetrySkip->>GamePlayManager: GetGameScore(0)
    GamePlayManager-->>OneKeyRetrySkip: GameScore0
    OneKeyRetrySkip->>Player0Score: SetTrackSkip()

    OneKeyRetrySkip->>GamePlayManager: GetGameScore(1)
    GamePlayManager-->>OneKeyRetrySkip: GameScore1
    OneKeyRetrySkip->>Player1Score: SetTrackSkip()
Loading

File-Level Changes

Change Details Files
Ensure OneKeyRetrySkip sets the TrackSkip flag on game scores for both players when invoked.
  • After sending the retry/skip message and syncing result, iterate over both player indices (0 and 1).
  • For each player, safely retrieve the GameScore instance from GamePlayManager and, if present, call SetTrackSkip() to mark the track as skipped.
  • Maintain existing flow by calling SetRelease() after the new TrackSkip-setting logic.
AquaMai.Mods/UX/OneKeyRetrySkip.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!

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
Copy Markdown

@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.

Hey - 我在这里给出了一些高层次的反馈:

  • 建议避免在循环中直接使用魔术数字 2,可以改用具名常量,或者从现有数据源推导玩家数量,这样以后玩家槽位配置变更时,就不需要修改这段逻辑。
  • 可以在循环之前,将 Singleton<GamePlayManager>.Instance 缓存在一个局部变量中,以避免重复的单例查找调用,同时也能让代码意图更清晰。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- Consider avoiding the magic number `2` in the loop by using a named constant or deriving the player count from an existing source, so future changes in player slots don't require updating this logic.
- You can cache `Singleton<GamePlayManager>.Instance` in a local variable before the loop to avoid repeated singleton lookups and make the intent a bit clearer.

Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈持续改进为你提供的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • Consider avoiding the magic number 2 in the loop by using a named constant or deriving the player count from an existing source, so future changes in player slots don't require updating this logic.
  • You can cache Singleton<GamePlayManager>.Instance in a local variable before the loop to avoid repeated singleton lookups and make the intent a bit clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider avoiding the magic number `2` in the loop by using a named constant or deriving the player count from an existing source, so future changes in player slots don't require updating this logic.
- You can cache `Singleton<GamePlayManager>.Instance` in a local variable before the loop to avoid repeated singleton lookups and make the intent a bit clearer.

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

No issues found across 1 file

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the PostGameProcessUpdate method in OneKeyRetrySkip.cs to iterate through game scores and mark them as skipped. The review feedback suggests caching the GamePlayManager singleton instance in a local variable to improve code readability and performance, while also recommending a null check for safer access.

Comment on lines +59 to +62
for (int i = 0; i < 2; i++)
{
Singleton<GamePlayManager>.Instance.GetGameScore(i)?.SetTrackSkip();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

建议将 Singleton.Instance 缓存到局部变量中。虽然目前只有两次迭代,但缓存单例访问是更好的实践,且能提高代码的可读性。此外,建议在访问前对单例实例进行空检查(防御性编程),以防止在某些极端情况下出现 NullReferenceException。虽然第 58 行已经直接访问了该单例,但在新代码中遵循安全实践仍是推荐的。

var gamePlayManager = Singleton<GamePlayManager>.Instance;
for (int i = 0; i < 2; i++)
{
    gamePlayManager?.GetGameScore(i)?.SetTrackSkip();
}

@clansty clansty merged commit 905b405 into MuNET-OSS:main May 13, 2026
3 checks passed
@Starrah Starrah deleted the track-skip-flag branch May 13, 2026 06:58
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