Skip to content

feat: 自由模式,按按键增加时间的功能 - #153

Merged
clansty merged 3 commits into
MuNET-OSS:mainfrom
Starrah:feat-freedom-addTimeKey
Sep 26, 2026
Merged

clansty merged 3 commits into
MuNET-OSS:mainfrom
Starrah:feat-freedom-addTimeKey

Conversation

@Starrah

@Starrah Starrah commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

给自由模式实现了一个功能,可以通过按指定的按键,延长自由模式的时间。

Review in cubic

Sourcery 总结

允许玩家通过可配置的键盘快捷键,在游戏过程中延长自由模式的时间。

新功能:

  • 为自由模式添加可配置的按键延时功能,支持可选的长按激活和可调整的增加时长。

错误修复:

  • 在计时器到期后增加时间时,恢复自由模式的倒计时行为和计时器显示。
Original summary in English

Sourcery 摘要

为自由模式添加可配置的按键加时能力,并确保计时结束后能够正确恢复倒计时状态。

新功能:

  • 为自由模式增加可配置的按键加时功能,支持长按触发和自定义每次增加的时长。

错误修复:

  • 修复自由模式计时结束后追加时间时无法恢复倒计时和计时器显示的问题。
Original summary in English

Summary by Sourcery

为自由模式添加可配置的按键加时能力,并确保计时结束后能够正确恢复倒计时状态。

New Features:

  • 为自由模式增加可配置的按键加时功能,支持长按触发和自定义每次增加的时长。

Bug Fixes:

  • 修复自由模式计时结束后追加时间时无法恢复倒计时和计时器显示的问题。

@sourcery-ai

sourcery-ai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

审查者指南

通过按键或长按实现可配置的 Freedom Mode 时间延长功能,使用 Harmony/反射更新底层计时器和倒计时状态,并在时间结束后延长时间时修复计时器 UI。

延长 Freedom Mode 时间的时序图

sequenceDiagram
    participant GameMainObject
    participant FreedomTimer
    participant KeyListener
    participant GameManager
    participant PleaseWaitProcess
    participant PleaseWaitMonitor

    GameMainObject->>FreedomTimer: OnGameMainObjectUpdate()
    FreedomTimer->>GameManager: IsFreedomMode
    FreedomTimer->>KeyListener: GetKeyDownOrLongPress(addTimeKey, addTimeLongPress)
    KeyListener-->>FreedomTimer: key pressed
    FreedomTimer->>GameManager: _freedomTime += addTimeSeconds * 1000L
    FreedomTimer->>GameManager: IsFreedomCountDown = true
    FreedomTimer->>GameManager: IsFreedomTimeUp = false
    FreedomTimer->>FreedomTimer: _pendingUiRefresh = true
    PleaseWaitProcess->>FreedomTimer: ResetFreedomTimerState()
    FreedomTimer->>GameManager: GetFreedomModeMSec()
    FreedomTimer->>PleaseWaitMonitor: IsVisibleFreedomMode()
    FreedomTimer->>PleaseWaitMonitor: SetOneMinute()
    FreedomTimer->>PleaseWaitMonitor: StopAllCoroutines()
Loading

文件级变更

变更 详细信息 文件
为 Freedom Mode 添加可配置的按键触发时间延长功能。
  • 添加了触发按键、长按行为以及每次激活所增加秒数的设置。
  • 在游戏更新循环期间处理按键输入,并通过反射增加私有的 Freedom Mode 计时器。
  • 应用额外时间后重启倒计时状态,并清除时间结束标志。
  • 在隐式功能启用检测中加入功能按键。
AquaMai.Mods/Utils/FreedomTimer.cs
AquaMai.Mods/GameSystem/TestProof.cs
在增加时间后恢复 Freedom Mode 倒计时 UI,包括从时间结束状态中恢复。
  • 将 UI 修复延迟到 PleaseWaitProcess 更新循环中执行。
  • 重置私有倒计时状态、剩余时间阈值以及缓存的显示时间值。
  • 停止时间结束监视器动画,并在必要时恢复正常的计时器动画。
AquaMai.Mods/Utils/FreedomTimer.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

Implements configurable Freedom Mode time extension through a key press or long press, updates the underlying timer and countdown state via Harmony/reflection, and repairs the timer UI when extending time after expiration.

Sequence diagram for extending Freedom Mode time

sequenceDiagram
    participant GameMainObject
    participant FreedomTimer
    participant KeyListener
    participant GameManager
    participant PleaseWaitProcess
    participant PleaseWaitMonitor

    GameMainObject->>FreedomTimer: OnGameMainObjectUpdate()
    FreedomTimer->>GameManager: IsFreedomMode
    FreedomTimer->>KeyListener: GetKeyDownOrLongPress(addTimeKey, addTimeLongPress)
    KeyListener-->>FreedomTimer: key pressed
    FreedomTimer->>GameManager: _freedomTime += addTimeSeconds * 1000L
    FreedomTimer->>GameManager: IsFreedomCountDown = true
    FreedomTimer->>GameManager: IsFreedomTimeUp = false
    FreedomTimer->>FreedomTimer: _pendingUiRefresh = true
    PleaseWaitProcess->>FreedomTimer: ResetFreedomTimerState()
    FreedomTimer->>GameManager: GetFreedomModeMSec()
    FreedomTimer->>PleaseWaitMonitor: IsVisibleFreedomMode()
    FreedomTimer->>PleaseWaitMonitor: SetOneMinute()
    FreedomTimer->>PleaseWaitMonitor: StopAllCoroutines()
Loading

File-Level Changes

Change Details Files
Added configurable key-triggered time extension for Freedom Mode.
  • Added settings for the trigger key, long-press behavior, and seconds added per activation.
  • Handled key input during the game update loop and increased the private Freedom Mode timer via reflection.
  • Restarted countdown state and cleared the time-up flag when additional time is applied.
  • Included the feature key in implicit feature enablement detection.
AquaMai.Mods/Utils/FreedomTimer.cs
AquaMai.Mods/GameSystem/TestProof.cs
Restored the Freedom Mode countdown UI after time is added, including recovery from the time-up state.
  • Deferred UI repair to the PleaseWaitProcess update loop.
  • Reset private countdown state, remaining-time thresholds, and cached displayed time values.
  • Stopped time-up monitor animations and restored the normal timer animation when necessary.
AquaMai.Mods/Utils/FreedomTimer.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

你好——我已经审阅了你的更改,看起来很棒!

Sourcery 评估

已批准。


Sourcery 对开源项目免费——如果你喜欢我们的审阅结果,请考虑分享给更多人 ✨
Original comment in English

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread AquaMai.Mods/Utils/FreedomTimer.cs Outdated
Comment thread AquaMai.Mods/GameSystem/TestProof.cs
Comment thread AquaMai.Mods/Utils/FreedomTimer.cs
Comment thread AquaMai.Mods/GameSystem/TestProof.cs
Comment thread AquaMai.Mods/Utils/FreedomTimer.cs Outdated
Comment thread AquaMai.Mods/Utils/FreedomTimer.cs Outdated
Comment thread AquaMai.Mods/Utils/FreedomTimer.cs
@clansty
clansty merged commit e73aa27 into MuNET-OSS:main Sep 26, 2026
5 checks 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