Feat: 刷理智添加使用备选关卡 - #84
Open
iispig1919 wants to merge 2 commits into
Open
Conversation
- Add useOptionalStage toggle and stagePlan list to FightConfiguration - Add CoreParams struct to send only required fields to MAA Core - Add isStageOpenToday() with known resource stage open days (CE-6/AP-5/CA-5/SK-5 and chip stages) - Update FightSettingsView with stage plan UI: add/remove stages, open status indicator - Update LegacyConfigurations migration with default values for new fields Made-with: Cursor
There was a problem hiding this comment.
Hey - 我在这里给出一些高层次的反馈:
- 在对
config.stagePlan做ForEach时,你使用了enumerated()进行迭代,同时又使用remove(at:)修改数组,这在 SwiftUI 中很容易导致索引/绑定不匹配;建议改为遍历config.stagePlan.indices(或者使用可标识的包装类型),这样在删除行时可以保持索引稳定。 - 在可选关卡行的 UI 中,每一行都会多次调用
FightConfiguration.isStageOpenToday(stageName)(用于图片、颜色和帮助文案);可以在HStack中把结果缓存在一个局部变量里,从而简化代码并避免重复计算。
给 AI 代理的提示
Please address the comments from this code review:
## Overall Comments
- Inside the `ForEach` over `config.stagePlan`, you’re iterating with `enumerated()` and also mutating the array with `remove(at:)`, which can easily lead to index/binding mismatches in SwiftUI; consider iterating over `config.stagePlan.indices` (or an identifiable wrapper) to keep indices stable when removing rows.
- In the optional-stage row UI, `FightConfiguration.isStageOpenToday(stageName)` is called multiple times per row (for image, color, and help text); caching the result in a local variable in the `HStack` would simplify the code and avoid redundant work.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English
Hey - I've left some high level feedback:
- Inside the
ForEachoverconfig.stagePlan, you’re iterating withenumerated()and also mutating the array withremove(at:), which can easily lead to index/binding mismatches in SwiftUI; consider iterating overconfig.stagePlan.indices(or an identifiable wrapper) to keep indices stable when removing rows. - In the optional-stage row UI,
FightConfiguration.isStageOpenToday(stageName)is called multiple times per row (for image, color, and help text); caching the result in a local variable in theHStackwould simplify the code and avoid redundant work.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Inside the `ForEach` over `config.stagePlan`, you’re iterating with `enumerated()` and also mutating the array with `remove(at:)`, which can easily lead to index/binding mismatches in SwiftUI; consider iterating over `config.stagePlan.indices` (or an identifiable wrapper) to keep indices stable when removing rows.
- In the optional-stage row UI, `FightConfiguration.isStageOpenToday(stageName)` is called multiple times per row (for image, color, and help text); caching the result in a local variable in the `HStack` would simplify the code and avoid redundant work.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
*用AI跑的,做得烂的话就close吧,希望能添加此功能
由 Sourcery 提供的总结
为战斗任务新增可选的多关卡规划功能,包含界面支持和按日期感知的关卡选择;精简发送给 MAA Core 的参数;并将现有配置迁移到新格式。
新功能:
增强优化:
CoreParams负载,以限制发送到 MAA Core 服务的字段Original summary in English
Summary by Sourcery
Add optional multi-stage planning for fight tasks with UI support and date-aware stage selection, refine the parameters sent to MAA Core, and migrate existing configurations to the new format.
New Features:
Enhancements: