Skip to content
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

实现 #3093 取消版本隔离下的“自定义” 并 引导用户使用“修改游戏目录”功能 #3122

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected Node createItem(ToggleGroup group) {
}
}

public static final class FileOption<T> extends Option<T> {
public static class FileOption<T> extends Option<T> {
private final FileSelector selector = new FileSelector();

public FileOption(String title, T data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.beans.value.ChangeListener;
import javafx.collections.ObservableList;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.FileChooser;
Expand Down Expand Up @@ -229,13 +232,38 @@ public VersionSettingsPage(boolean globalSetting) {

gameDirItem = new MultiFileItem<>();
gameDirSublist = new ComponentSublist();
{
HintPane gameDirHint = new HintPane(MessageDialogPane.MessageType.INFO);
gameDirHint.setText(i18n("settings.game.working_directory.should_use_game_repo_feature"));
gameDirSublist.getContent().add(gameDirHint);
}
gameDirSublist.getContent().add(gameDirItem);
gameDirSublist.setTitle(i18n("settings.game.working_directory"));
gameDirSublist.setHasSubtitle(versionId != null);
gameDirItem.disableProperty().bind(modpack);
gameDirCustomOption = new MultiFileItem.FileOption<>(i18n("settings.custom"), GameDirectoryType.CUSTOM)
.setChooserTitle(i18n("settings.game.working_directory.choose"))
.setDirectory(true);
gameDirCustomOption = new MultiFileItem.FileOption<GameDirectoryType>(i18n("settings.custom"), GameDirectoryType.CUSTOM) {
private final WeakListenerHolder holder = new WeakListenerHolder();

@Override
protected Node createItem(ToggleGroup group) {
Node node = super.createItem(group);

ObservableList<Node> children = gameDirItem.getChildren();
holder.add(FXUtils.observeWeak(() -> {
boolean exist = children.contains(node);
if (!"".equals(getValue()) || gameDirItem.getSelectedData() == GameDirectoryType.CUSTOM) {
if (!exist) {
children.add(node);
}
} else {
if (exist) {
children.remove(node);
}
}
}, valueProperty(), gameDirItem.selectedDataProperty()));
return node;
}
}.setChooserTitle(i18n("settings.game.working_directory.choose")).setDirectory(true);

gameDirItem.loadChildren(Arrays.asList(
new MultiFileItem.Option<>(i18n("settings.advanced.game_dir.default"), GameDirectoryType.ROOT_FOLDER),
Expand Down Expand Up @@ -497,6 +525,7 @@ public void loadVersion(Profile profile, String versionId) {
this.listenerHolder = new WeakListenerHolder();

if (versionId == null) {
gameDirSublist.setHasSubtitle(false);
enableSpecificSettings.set(true);
state.set(State.fromTitle(Profiles.getProfileDisplayName(profile) + " - " + i18n("settings.type.global.manage")));

Expand All @@ -512,6 +541,7 @@ public void loadVersion(Profile profile, String versionId) {
}
}));
} else {
gameDirSublist.setHasSubtitle(true);
navigateToSpecificSettings.unbind();
navigateToSpecificSettings.set(false);
}
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ settings.game.working_directory.choose=Choose the working directory
settings.game.working_directory.hint=Enable the "Isolated" option in "Working Directory" to allow the current instance to store its settings, saves, and mods in a separate directory.\n\
\n\
It is recommended to enable this option to avoid mod conflicts, but you will need to move your saves manually.
settings.game.working_directory.should_use_game_repo_feature=Willing to change the game storage path? Go to HMCL Homepage - Version List, and click [Add game repository].

settings.icon=Icon

Expand Down
3 changes: 2 additions & 1 deletion HMCL/src/main/resources/assets/lang/I18N_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ world.reveal=開啟目錄
world.show_all=全部顯示
world.time=yyyy 年 M 月 d 日, HH:mm:ss

profile=遊戲目錄
profile=遊戲倉庫
profile.already_exists=該名稱已存在
profile.default=目前目錄
profile.home=官方啟動器目錄
Expand Down Expand Up @@ -1017,6 +1017,7 @@ settings.game.management=管理
settings.game.working_directory=執行路徑 (建議使用模組時選取「各實例獨立」,修改後請自行移動相關遊戲檔案,如存檔、模組設定等)
settings.game.working_directory.choose=選取執行目錄
settings.game.working_directory.hint=在「執行路徑」選項中選取「各實例獨立」使目前實例獨立存放設定、存檔、模組等資料,使用模組時建議開啟此選項以避免不同版本模組衝突。修改此選項後需自行移動存檔等檔案。
settings.game.working_directory.should_use_game_repo_feature=想要更改遊戲的儲存路徑?進入 HMCL 首頁 - 版本列表,點選【添加游戏仓库】

settings.icon=遊戲圖示

Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ settings.game.management=管理
settings.game.working_directory=版本隔离 (建议使用模组时选择“各版本独立”,改后需移动存档、模组等相关游戏文件)
settings.game.working_directory.choose=选择运行文件夹
settings.game.working_directory.hint=在“版本隔离”中选择“各版本独立”使当前版本独立存放设置、存档、模组等数据,使用模组时建议启用此选项以避免不同版本模组冲突。修改此选项后需自行移动存档等文件。
settings.game.working_directory.should_use_game_repo_feature=想要更改游戏的存储路径?进入 HMCL 主页 - 版本列表,点击【添加游戏仓库】

settings.icon=游戏图标

Expand Down
Loading