PCL-CE icon indicating copy to clipboard operation
PCL-CE copied to clipboard

fix: 在弹出mc更新提示弹窗时使用ESC键会打开Wiki

Open qiMengStars opened this issue 6 months ago • 3 comments

https://github.com/PCL-Community/PCL-CE/issues/2626#issuecomment-4528964685 所以比较妥协的解决方案是交换目前的两个按钮,将确认改成关闭置于第三个

close #2626

Summary by Sourcery

错误修复:

  • 通过将该操作从更新通知对话框中的默认/主要按钮上移除,防止按下 ESC 键时意外打开更新日志/维基。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Prevent the ESC key from unintentionally opening the update log/wiki by moving that action off the default/primary button in the update notification dialog.

qiMengStars avatar May 24 '26 14:05 qiMengStars

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

审阅者指南

调整 Minecraft 更新提示中的按钮顺序及相关动作,使 ESC 不再打开 Wiki / 更新日志,而是符合预期的“确认/关闭”语义。

更新后的 Minecraft 客户端更新提示按钮动作时序图

sequenceDiagram
    actor User
    participant ModMinecraft
    participant ModMain
    participant ModDownloadLib

    User->>ModMinecraft: McDownloadClientUpdateHint(versionName, jsonObject)
    ModMinecraft->>ModMain: MyMsgBox(msgBoxText, title, button1Text:Common_Action_UpdateLog, button2Text:Common_Action_Download, button3Text:Common_Action_Close, Button1Action:McUpdateLogShow)
    alt [user activates button1]
        ModMain->>ModDownloadLib: McUpdateLogShow(version)
    end

文件级变更

变更 细节 文件
重新排序了 Minecraft 更新对话框按钮,并将更新日志动作重新绑定到第一个按钮,以防止 ESC 打开 Wiki/更新日志。
  • 修改消息框调用方式,有条件地传入可选的第三个按钮文本,然后显式传入“下载”和“关闭”动作的标签。
  • 将更新日志回调从第三个按钮动作移动到第一个按钮动作,以匹配新的按钮顺序和键盘行为。
  • 在改变其在参数列表中的位置的同时,保留了基于时间差显示更新日志按钮的现有条件显示逻辑。
Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.cs

与关联 issue 的对照评估

Issue 目标 是否解决 说明
https://github.com/PCL-Community/PCL-CE/issues/2626 确保当 Minecraft 更新提示对话框打开时,按下 ESC 键会关闭对话框,而不是打开 Wiki/更新日志。 ✅

可能关联的 issues

  • #2626:该 PR 通过重新排序并重新绑定更新对话框按钮,使 ESC 不再打开 Wiki,从而修复此问题

提示与命令

与 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 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

  • 联系支持团队 以提出问题或反馈。
  • 访问我们的文档获取详细指南和信息。
  • 通过关注 X/Twitter、LinkedIn 或 GitHub 与 Sourcery 团队保持联系。
Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the Minecraft update prompt button order and associated actions so that ESC no longer opens the Wiki / update log, aligning behavior with expected confirm/close semantics.

Sequence diagram for updated Minecraft client update prompt button actions

sequenceDiagram
    actor User
    participant ModMinecraft
    participant ModMain
    participant ModDownloadLib

    User->>ModMinecraft: McDownloadClientUpdateHint(versionName, jsonObject)
    ModMinecraft->>ModMain: MyMsgBox(msgBoxText, title, button1Text:Common_Action_UpdateLog, button2Text:Common_Action_Download, button3Text:Common_Action_Close, Button1Action:McUpdateLogShow)
    alt [user activates button1]
        ModMain->>ModDownloadLib: McUpdateLogShow(version)
    end

File-Level Changes

Change Details Files
Reordered the Minecraft update dialog buttons and reassigned the update-log action to the first button to prevent ESC from opening the Wiki/update log.
  • Changed the message box call to pass the optional third-button text conditionally, followed by explicit labels for Download and Close actions.
  • Moved the update-log callback from the third button action to the first button action to match the new button ordering and keyboard behavior.
  • Preserved existing conditional display logic for the update-log button based on the time difference while changing its position in the parameter list.
Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.cs

Assessment against linked issues

Issue Objective Addressed Explanation
https://github.com/PCL-Community/PCL-CE/issues/2626 Ensure that when the Minecraft update prompt dialog is open, pressing the ESC key closes the dialog instead of opening the Wiki/update log. ✅

Possibly linked issues

  • #2626: The PR reorders and rebinds update dialog buttons so ESC no longer opens Wiki, fixing the issue

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

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar May 24 '26 14:05 sourcery-ai[bot]

~~需要审查:这样做可能会破坏其他需要通过 ESC 触发事件的地方~~

当我啥也没说,但有另一个问题,参见下面的 Req Change

MoYuan-CN avatar May 24 '26 17:05 MoYuan-CN

需要审查:这样做可能会破坏其他需要通过 ESC 触发事件的地方

你是不是误解了些什么,我只是把那个弹窗的两个按钮位置交换了一下,以便让关闭位于第三个 没有动全局的ESC调度,本来ESC默认就是最后一个按钮,只不过以前最后一个按钮是打开wiki(

qiMengStars avatar May 24 '26 23:05 qiMengStars

由于本 PR 长期无人维护且无实质改动,现予以关闭

RyogiMutsuki avatar Jul 06 '26 10:07 RyogiMutsuki