-
Notifications
You must be signed in to change notification settings - Fork 48
力大砖飞模组验证完成 #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
力大砖飞模组验证完成 #99
Conversation
Updated warning message for potential performance impact and conflicts.
Summary of ChangesHello @Haisairova-Official, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求引入了一个名为“力大砖飞”的新模组,用于 AquaMai 游戏。该模组允许用户通过从本地目录加载自定义 PNG 图像,全局替换游戏中的精灵和纹理。其实现通过 HarmonyLib 进行静态注入,拦截图形渲染和画布缩放事件,确保自定义资源能在整个游戏中应用。作者已完成验证,并在特定测试配置下未发现其他兼容性问题。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 引入了一个“力大砖飞”式的自定义皮肤功能,通过 Harmony patch 运行时替换游戏内的 Sprite 和 Texture。这个实现方式非常直接,正如其名,但也带来了代码注释中提到的潜在性能风险。整体代码逻辑清晰,但在错误处理、路径解析和逻辑一致性方面有几个可以改进的地方。我已经在代码中留下了具体的建议,希望能帮助您完善这个功能。
AquaMai.Mods/Fancy/RsOverride.cs
Outdated
| SpritePool[name] = sprite; | ||
| TexturePool[name] = tex; | ||
| } | ||
| } catch { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AquaMai.Mods/Fancy/RsOverride.cs
Outdated
| try { resolvedPath = FileSystem.ResolvePath(skinsDir); } | ||
| catch { resolvedPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, skinsDir); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (img.sprite != null && SpritePool.TryGetValue(img.sprite.name.ToLower(), out var s)) | ||
| img.sprite = s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 OnGraphicRebuild 方法中,替换图片后会调用 img.canvasRenderer.SetColor(Color.white) 来重置颜色,以避免意外的颜色叠加。但在 OnCanvasEnable 方法中缺少了这个逻辑。为了保持行为一致性并避免潜在的视觉问题,建议在这里也添加颜色重置的逻辑。同时,为了代码可读性和可维护性,建议为 if 语句使用花括号 {}。
if (img.sprite != null && SpritePool.TryGetValue(img.sprite.name.ToLower(), out var s))
{
img.sprite = s;
img.canvasRenderer.SetColor(Color.white);
}| if (rImg.texture != null && TexturePool.TryGetValue(rImg.texture.name.ToLower(), out var t)) | ||
| rImg.texture = t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clansty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我一年前尝试搞 4k 贴图的时候怎么没想到呢
|
以及隆重欢迎新开发者加入 AquaMai 大家庭 |
|
新屎山制造小作坊) |
Co-authored-by: 凌莞~(=^▽^=) <[email protected]>
Co-authored-by: 凌莞~(=^▽^=) <[email protected]>
Co-authored-by: 凌莞~(=^▽^=) <[email protected]>
Co-authored-by: 凌莞~(=^▽^=) <[email protected]>
|
这下搞定啦 改成 "LocalAssets/ResourcesOverride" |
|
好耶 |
|
对我会新写一个 毕竟这个能跑就不要动他了) |
目前未发现更多兼容性问题。测试于SDGB151+EZ156+160
修改部分表述
烦内就这样子吧)
Note
Introduces
CustomSkinsPlusStaticto load PNG overrides and forcibly replaceImage/RawImageassets across the UI via Harmony patches.CustomSkinsPlusStaticinAquaMai.Mods/Fancy/RsOverride.cswithConfigSectionand directoryConfigEntry(LocalAssets/GlobalTextureOverride).*.pngfrom the configured folder intoSpritePool/TexturePoolwith normalized names.PrefixonGraphic.Rebuildto swapImage.spriteandRawImage.texturewith pool matches and reset renderer color.PostfixonCanvasScaler.OnEnableto bulk-scan children and replace matching sprites/textures.Written by Cursor Bugbot for commit 692d10b. This will update automatically on new commits. Configure here.