Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 修复“快速启动/Quick Play”相关的版本判断逻辑:将是否支持快速启动的判断从“世界版本”调整为“实例(游戏)版本”,并在世界列表中对快速启动入口增加不支持版本的显示控制,避免在不支持的版本中出现快速启动按钮。
Changes:
WorldManagePage:将构造参数/内部字段由versionId改为instanceId,并用实例的 gameVersion 判断是否支持 Quick Play,从而控制管理页中的快速启动入口。WorldListPage:新增基于实例版本的supportQuickPlay属性,并在世界列表 cell 中按该属性控制快速启动按钮的显示/布局占位。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldManagePage.java | 以实例版本判断 Quick Play 支持性,并将启动/脚本生成逻辑切换为使用 instanceId |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListPage.java | 增加实例级 supportQuickPlay 状态并绑定到列表快速启动按钮可见性 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Optional<String> gameVersion = profile.getRepository().getGameVersion(instanceId); | ||
| supportQuickPlay = World.supportQuickPlay(GameVersionNumber.asGameVersion(gameVersion)); | ||
|
|
There was a problem hiding this comment.
profile.getRepository().getGameVersion(instanceId) is documented as time-consuming (jar detection) and should run on the IO scheduler; calling it in the WorldManagePage constructor (FX thread) can freeze the UI. Consider computing supportQuickPlay asynchronously (e.g., Task.supplyAsync(Schedulers.io(), ...) / Platform.runLater) and exposing it as a BooleanProperty so the toolbar/menu visibility can react when the value arrives from cache/detection.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private List<World> worlds; | ||
| private Profile profile; | ||
| private String instanceId; | ||
| private final BooleanProperty supportQuickPlay = new SimpleBooleanProperty(this, "supportQuickPlay", false); |
There was a problem hiding this comment.
supportQuickPlay is stored on the WorldListPage instance, and WorldListPage is reused across instance switches (VersionPage.loadVersion(...) calls loadVersion(...) on already-initialized tabs). If the user switches to another instance, supportQuickPlay will keep the previous instance’s value until the async refresh() completes, which can briefly show the quick-play button/menu items for an unsupported instance. Consider resetting supportQuickPlay to false in loadVersion(...) (or at the beginning of refresh()) before starting the background task.
| Optional<String> gameVersion = profile.getRepository().getGameVersion(instanceId); | ||
| supportQuickPlay.set(World.supportQuickPlay(GameVersionNumber.asGameVersion(gameVersion))); | ||
|
|
There was a problem hiding this comment.
In whenComplete(Schedulers.javafx(), ...), this re-invokes profile.getRepository().getGameVersion(instanceId) on the JavaFX thread. Even though you try to “warm” the cache in the background task, getGameVersion is documented as time-consuming; it’s safer to compute the Optional<String> (or the boolean supportQuickPlay) in the IO task and pass it to the FX continuation, avoiding any potential UI-thread blocking if caching behavior changes or the warm-up call is skipped.
修复了两个问题: