Skip to content

fix(download): 修复 Minecraft 更新提示弹窗按 ESC 打开 Wiki#3436

Open
Lokins577 wants to merge 1 commit into
PCL-Community:devfrom
Lokins577:fix/update-hint-esc-wiki
Open

fix(download): 修复 Minecraft 更新提示弹窗按 ESC 打开 Wiki#3436
Lokins577 wants to merge 1 commit into
PCL-Community:devfrom
Lokins577:fix/update-hint-esc-wiki

Conversation

@Lokins577

@Lokins577 Lokins577 commented Jul 19, 2026

Copy link
Copy Markdown
Member

更新提示弹窗原按钮顺序为 [确认, 下载, 更新日志]。
将按钮重排为 [下载, 更新日志, 取消] 以解决 ESC 触发问题。
resolves #2626

本PR由Opus 4.8对代码进行了审查。

Summary by Sourcery

Bug Fixes:

  • 修复 Minecraft 更新提示,使按下 ESC 键时关闭对话框,而不是打开更新日志/维基。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Fix the Minecraft update prompt so that pressing ESC dismisses the dialog instead of opening the update log/wiki.

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XS PR 大小评估:微型 labels Jul 19, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

重新排列按钮,并调整 Minecraft 客户端更新提示对话框中的回调处理,使 ESC 不再触发打开 Wiki/更新日志,并相应更新结果处理逻辑。

更新后的 Minecraft 客户端更新提示对话框按钮处理时序图

sequenceDiagram
    actor User
    participant McDownloadClientUpdateHint
    participant ModMain
    participant ModDownloadLib
    participant ModBase

    User ->> McDownloadClientUpdateHint: trigger update hint
    McDownloadClientUpdateHint ->> ModMain: MyMsgBox(msgBoxText, title, Lang.Text(Common.Action.Download), [optional] Lang.Text(Common.Action.UpdateLog), Lang.Text(Common.Action.Cancel), button2Action: McUpdateLogShow)
    ModMain -->> McDownloadClientUpdateHint: msgResult

    alt msgResult == 1
        McDownloadClientUpdateHint ->> ModBase: RunInUi(download action)
    else msgResult == 2
        McDownloadClientUpdateHint ->> ModDownloadLib: McUpdateLogShow(version)
    else msgResult == 0
        McDownloadClientUpdateHint ->> McDownloadClientUpdateHint: [Cancel or ESC, no further action]
    end
Loading

File-Level Changes

Change Details Files
重新排列 Minecraft 更新提示对话框按钮,并更新关联的操作和结果处理,使其与新的按钮顺序和 ESC 行为保持一致。
  • 更改传递给 ModMain.MyMsgBox 的参数,将第一个按钮设为 Download,第二个按钮(可选)设为 Update Log,并将 Cancel 按钮添加为第三个按钮。
  • 将更新日志显示动作从第三个按钮的回调重新分配到第二个按钮的回调,以匹配新的视觉顺序。
  • 更新 msgResult 检查逻辑,使在选择第一个按钮时触发下载操作,而不是之前的第二个按钮。
Plain Craft Launcher 2/Modules/Minecraft/ModDownload.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#2626 确保当显示 Minecraft 更新提示对话框时,按下 ESC 会关闭对话框,而不是打开 Wiki / 更新日志。

Possibly linked issues


Tips and commands

Interacting with 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 来触发新的评审!

Customizing Your Experience

访问你的 dashboard 以:

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

Getting Help

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

Reviewer's Guide

Reorders the buttons and adjusts the callback handling in the Minecraft client update hint dialog so that ESC no longer triggers opening the Wiki/update log, and updates the result handling accordingly.

Sequence diagram for updated Minecraft client update hint dialog button handling

sequenceDiagram
    actor User
    participant McDownloadClientUpdateHint
    participant ModMain
    participant ModDownloadLib
    participant ModBase

    User ->> McDownloadClientUpdateHint: trigger update hint
    McDownloadClientUpdateHint ->> ModMain: MyMsgBox(msgBoxText, title, Lang.Text(Common.Action.Download), [optional] Lang.Text(Common.Action.UpdateLog), Lang.Text(Common.Action.Cancel), button2Action: McUpdateLogShow)
    ModMain -->> McDownloadClientUpdateHint: msgResult

    alt msgResult == 1
        McDownloadClientUpdateHint ->> ModBase: RunInUi(download action)
    else msgResult == 2
        McDownloadClientUpdateHint ->> ModDownloadLib: McUpdateLogShow(version)
    else msgResult == 0
        McDownloadClientUpdateHint ->> McDownloadClientUpdateHint: [Cancel or ESC, no further action]
    end
Loading

File-Level Changes

Change Details Files
Reordered the Minecraft update hint dialog buttons and updated the associated actions and result handling to align with the new order and ESC behavior.
  • Changed the parameters passed to ModMain.MyMsgBox to set the first button as Download, the second as Update Log (conditionally), and added a Cancel button as the third.
  • Reassigned the update log display action from the third button callback to the second button callback to match the new visual order.
  • Updated the msgResult check so that the download action is triggered when the first button is selected instead of the previous second button.
Plain Craft Launcher 2/Modules/Minecraft/ModDownload.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#2626 Ensure that when the Minecraft update hint dialog is shown, pressing ESC closes the dialog instead of opening the Wiki / update log.

Possibly linked issues


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
Contributor

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些整体性的反馈:

  • 在重新排列按钮之后,msgResult 各索引的含义发生了变化(下载操作从 2 变为 1);最好确认一下其他调用点,以及对话框的默认行为 / ESC 行为,是否仍与新的按钮顺序和索引保持一致。
给 AI 智能体的提示
请根据这次代码审查中的评论进行修改:

## 整体评论
- 在重新排列按钮之后,`msgResult` 各索引的含义发生了变化(下载操作从 `2` 变为 `1`);最好确认一下其他调用点,以及对话框的默认行为 / ESC 行为,是否仍与新的按钮顺序和索引保持一致。

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

Hey - I've left some high level feedback:

  • The meaning of msgResult indices changed (21 for download) after reordering buttons; it would be good to confirm that other call sites and the dialog’s default/ESC behavior still align with the new button order and indices.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The meaning of `msgResult` indices changed (`2``1` for download) after reordering buttons; it would be good to confirm that other call sites and the dialog’s default/ESC behavior still align with the new button order and indices.

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40666d90d8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 2481 to +2482
(DateTime.Now - time).TotalHours > 3d ? Lang.Text("Common.Action.UpdateLog") : "",
button3Action: () => ModDownloadLib.McUpdateLogShow(version));
Lang.Text("Common.Action.Cancel"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the cancel button in a waited slot

When the version was released within the last 3 hours, this ternary passes an empty button2 while still passing Cancel as button3. ModMain.MyMsgBox only blocks when button2.Length > 0 || forceWait, so in that fresh-release case it returns 1 immediately; the following if (msgResult == 1) then jumps to the download page before the user can cancel the update prompt. Put the cancel action in button2 when the changelog is hidden, or force the dialog to wait.

Useful? React with 👍 / 👎.

@Lokins577 Lokins577 added ⏸️ 暂停 该功能或任务目前处于搁置状态,近期没有计划开展相关开发或维护工作 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS PR 大小评估:微型 ⏸️ 暂停 该功能或任务目前处于搁置状态,近期没有计划开展相关开发或维护工作

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant