Skip to content

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

Draft
qiMengStars wants to merge 2 commits into
PCL-Community:devfrom
qiMengStars:fix/2626
Draft

fix: 在弹出mc更新提示弹窗时使用ESC键会打开Wiki#2892
qiMengStars wants to merge 2 commits into
PCL-Community:devfrom
qiMengStars:fix/2626

Conversation

@qiMengStars
Copy link
Copy Markdown
Contributor

@qiMengStars qiMengStars commented May 24, 2026

#2626 (comment)
所以比较妥协的解决方案是交换目前的两个按钮,将确认改成关闭置于第三个

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.

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

sourcery-ai Bot commented May 24, 2026

审阅者指南(在小型 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
Loading

文件级变更

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

与关联 issue 的对照评估

Issue 目标 是否解决 说明
#2626 确保当 Minecraft 更新提示对话框打开时,按下 ESC 键会关闭对话框,而不是打开 Wiki/更新日志。

可能关联的 issues


提示与命令

与 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

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
Loading

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
#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


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 - 我在这里给出了一些总体反馈:

  • 在你重新排序 MyMsgBox 中的按钮标签和动作之后,请再次确认 msgResult 的取值映射(尤其是用于下载分支的 msgResult == 2)仍然和预期的按钮索引/顺序一一对应,否则可能会触发错误的操作。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- After reordering the button labels and actions in `MyMsgBox`, double-check that the `msgResult` value mapping (especially `msgResult == 2` used for the download branch) still corresponds to the intended button index/order, otherwise the wrong action may be triggered.

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

Hey - I've left some high level feedback:

  • After reordering the button labels and actions in MyMsgBox, double-check that the msgResult value mapping (especially msgResult == 2 used for the download branch) still corresponds to the intended button index/order, otherwise the wrong action may be triggered.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- After reordering the button labels and actions in `MyMsgBox`, double-check that the `msgResult` value mapping (especially `msgResult == 2` used for the download branch) still corresponds to the intended button index/order, otherwise the wrong action may be triggered.

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.

@MoYuan-CN
Copy link
Copy Markdown
Member

MoYuan-CN commented May 24, 2026

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

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

@qiMengStars
Copy link
Copy Markdown
Contributor Author

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

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

pynickle
pynickle previously approved these changes May 25, 2026
LuLu-ling
LuLu-ling previously approved these changes May 25, 2026
@pcl-ce-automation pcl-ce-automation Bot added 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels May 25, 2026
: Lang.Text("Minecraft.Update.UpdatedAt") + Lang.TimeSpan(time - DateTime.Now));
var msgResult = ModMain.MyMsgBox(msgBoxText, Lang.Text("Minecraft.Update.Title"),
Lang.Text("Common.Action.Confirm"), Lang.Text("Common.Action.Download"),
(DateTime.Now - time).TotalHours > 3d ? Lang.Text("Common.Action.UpdateLog") : "",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

重新看了一下这处修改,根据 MyMsgBox (MyMsgText) 的实现,

try
{
InitializeComponent();
Btn1.Name = Btn1.Name + ModBase.GetUuid();
Btn2.Name = Btn2.Name + ModBase.GetUuid();
Btn3.Name = Btn3.Name + ModBase.GetUuid();
MyConverter = Converter;
LabTitle.Text = Converter.Title;
LabCaption.Text = Converter.Text;
Btn1.Text = Converter.Button1;
if (Converter.IsWarn)
{
Btn1.ColorType = MyButton.ColorState.Red;
LabTitle.SetResourceReference(TextBlock.ForegroundProperty, "ColorBrushRedLight");
}
Btn2.Text = Converter.Button2;
Btn3.Text = Converter.Button3;
Btn2.Visibility = string.IsNullOrEmpty(Converter.Button2) ? Visibility.Collapsed : Visibility.Visible;
Btn3.Visibility = string.IsNullOrEmpty(Converter.Button3) ? Visibility.Collapsed : Visibility.Visible;
ShapeLine.StrokeThickness = ModBase.GetWPFSize(1d);
}

把一个可选按钮放到第一按钮位置会导致逻辑上不显示这个按钮的时候生成一个空按钮

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 and removed 🕑 等待合并 已处理完毕,正在等待代码合并入主分支 labels May 25, 2026
@qiMengStars qiMengStars marked this pull request as draft May 27, 2026 12:17
@pcl-ce-automation pcl-ce-automation Bot added 🚧 正在处理 开发人员正在对该内容进行开发、测试或修复,进展中 and removed 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 labels May 27, 2026
@qiMengStars qiMengStars dismissed stale reviews from LuLu-ling and pynickle via 63cb15e May 27, 2026 12:17
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

4 participants