Skip to content

fix: DisplayTouchInGame 在maimoller中不工作#55

Merged
clansty merged 1 commit intoMuNET-OSS:mainfrom
Starrah:maimoller-displaytouchingame-fix
Sep 18, 2025
Merged

fix: DisplayTouchInGame 在maimoller中不工作#55
clansty merged 1 commit intoMuNET-OSS:mainfrom
Starrah:maimoller-displaytouchingame-fix

Conversation

@Starrah
Copy link
Copy Markdown
Contributor

@Starrah Starrah commented Sep 18, 2025

其实和这个是一模一样的情况...
https://github.com/MewoLab/AquaMai/blob/983f887be48d6c5c85a81460fa3c45d2d35c3852/AquaMai.Mods/GameSystem/TestProof.cs#L78-L87

MouseTouchPanel.Start不会调用,自然依赖于其的RegisterMouseTouchPanel钩子也不会调用,prefab就为null,导致log里报错[DisplayTouchInGame] prefab is null

实在是太玄学了......

Sourcery 总结

Bug 修复:

  • 绕过 MaiMoller mod 阻止 MouseTouchPanel.Start 被调用的问题,通过注入一个空的 HarmonyPostfix,从而允许 DisplayTouchInGame 正确初始化
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Work around MaiMoller mod preventing MouseTouchPanel.Start from being called by injecting an empty HarmonyPostfix, allowing DisplayTouchInGame to initialize correctly

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Sep 18, 2025

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

审阅者指南

此 PR 在 MouseTouchPanel.Start 上添加了一个空的 Harmony 后缀补丁,以解决 MonoMod/Maimoller 补丁问题,该问题会阻止原始 Start 方法被调用,从而确保触摸面板注册和预制件初始化无误地进行。

MouseTouchPanel.Start 的 Harmony 补丁类图

classDiagram
class MouseTouchPanel {
    +Start()
}
class DisplayTouchInGame {
    +Workaround()  // HarmonyPostfix on MouseTouchPanel.Start
}
MouseTouchPanel <|.. DisplayTouchInGame : "HarmonyPostfix Patch"
Loading

文件级更改

更改 详情 文件
在 MouseTouchPanel.Start 上注入空的 Harmony 后缀以强制方法调用
  • 添加 [HarmonyPostfix] 属性
  • 添加针对 MouseTouchPanel.Start 的 [HarmonyPatch] 属性
  • 定义空的静态 Workaround() 方法
  • 包含引用类似 TestProof 解决方案的解释性注释
AquaMai.Mods/Utils/DisplayTouchInGame.cs

提示和命令

与 Sourcery 交互

  • 触发新审阅: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 根据审阅评论生成 GitHub issue: 通过回复审阅评论,请求 Sourcery 从中创建一个 issue。您也可以回复审阅评论并添加 @sourcery-ai issue 来创建 issue。
  • 生成拉取请求标题: 随时在拉取请求标题的任意位置写入 @sourcery-ai 以生成标题。您也可以在拉取请求上评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成拉取请求摘要: 随时在拉取请求正文的任意位置写入 @sourcery-ai summary 以在您想要的位置生成 PR 摘要。您也可以在拉取请求上评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求上评论 @sourcery-ai guide 以随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这会很有用。
  • 驳回所有 Sourcery 审阅: 在拉取请求上评论 @sourcery-ai dismiss 以驳回所有现有的 Sourcery 审阅。如果您想从新的审阅开始,这会特别有用——别忘了评论 @sourcery-ai review 来触发新的审阅!

自定义您的体验

访问您的 仪表板 以:

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

获取帮助

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

Reviewer's Guide

This PR adds an empty Harmony postfix patch on MouseTouchPanel.Start to work around a MonoMod/Maimoller patch issue that prevents the original Start method from being invoked, ensuring the touch panel registration and prefab initialization proceed without errors.

Class diagram for Harmony patch on MouseTouchPanel.Start

classDiagram
class MouseTouchPanel {
    +Start()
}
class DisplayTouchInGame {
    +Workaround()  // HarmonyPostfix on MouseTouchPanel.Start
}
MouseTouchPanel <|.. DisplayTouchInGame : "HarmonyPostfix Patch"
Loading

File-Level Changes

Change Details Files
Inject empty Harmony postfix on MouseTouchPanel.Start to force method invocation
  • Add [HarmonyPostfix] attribute
  • Add [HarmonyPatch] attribute targeting MouseTouchPanel.Start
  • Define empty static Workaround() method
  • Include explanatory comment referencing analogous TestProof solution
AquaMai.Mods/Utils/DisplayTouchInGame.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.

你好 - 我已审阅你的更改 - 以下是一些反馈:

  • 与其依赖空的后缀来触发 MouseTouchPanel.Start,不如考虑使用 Harmony 的 PatchPriority 或 After 属性来确保原始的 Start 在 Maimoller 补丁之后运行。
  • 在代码注释中添加清晰的 TODO 和对底层问题的引用,以便在确定根本原因后可以重新审视并删除此变通方法。
  • 将变通方法的注释翻译成英文(或添加英文版本),以提高非中文贡献者的可访问性。
给 AI 代理的提示
请处理此代码审查中的评论:

## 总体评论
- 与其依赖空的后缀来触发 MouseTouchPanel.Start,不如考虑使用 Harmony 的 PatchPriority 或 After 属性来确保原始的 Start 在 Maimoller 补丁之后运行。
- 在代码注释中添加清晰的 TODO 和对底层问题的引用,以便在确定根本原因后可以重新审视并删除此变通方法。
- 将变通方法的注释翻译成英文(或添加英文版本),以提高非中文贡献者的可访问性。

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击 👍 或 👎 对每条评论进行评价,我将利用这些反馈来改进你的评论。
Original comment in English

Hey there - I've reviewed your changes - here's some feedback:

  • Rather than relying on an empty postfix to trigger MouseTouchPanel.Start, consider using Harmony's PatchPriority or After attributes to ensure the original Start runs after the Maimoller patch.
  • Add a clear TODO and reference to the underlying issue in the code comment so that the workaround can be revisited and removed when the root cause is identified.
  • Translate the workaround comment into English (or add an English version) to improve accessibility for non-Chinese-speaking contributors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Rather than relying on an empty postfix to trigger MouseTouchPanel.Start, consider using Harmony's PatchPriority or After attributes to ensure the original Start runs after the Maimoller patch.
- Add a clear TODO and reference to the underlying issue in the code comment so that the workaround can be revisited and removed when the root cause is identified.
- Translate the workaround comment into English (or add an English version) to improve accessibility for non-Chinese-speaking contributors.

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.

@clansty clansty merged commit dbd22a0 into MuNET-OSS:main Sep 18, 2025
2 checks passed
@Starrah Starrah deleted the maimoller-displaytouchingame-fix branch September 22, 2025 18:44
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