feat: hint for custom commands.

This commit is contained in:
huanghongxun 2021-09-19 03:00:18 +08:00
parent c0f82b1ae7
commit 1b539ade9d
4 changed files with 57 additions and 9 deletions

View File

@ -80,7 +80,8 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
private final JFXTextField txtGameArgs;
private final JFXTextField txtMetaspace;
private final JFXTextField txtWrapper;
private final JFXTextField txtPrecallingCommand;
private final JFXTextField txtPreLaunchCommand;
private final JFXTextField txtPostExitCommand;
private final JFXTextField txtServerIP;
private final ComponentList componentList;
private final ComponentList iconPickerItemWrapper;
@ -385,16 +386,26 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
txtGameArgs.getStyleClass().add("fit-width");
pane.addRow(0, new Label(i18n("settings.advanced.minecraft_arguments")), txtGameArgs);
txtPrecallingCommand = new JFXTextField();
txtPrecallingCommand.setPromptText(i18n("settings.advanced.precall_command.prompt"));
txtPrecallingCommand.getStyleClass().add("fit-width");
pane.addRow(1, new Label(i18n("settings.advanced.precall_command")), txtPrecallingCommand);
txtPreLaunchCommand = new JFXTextField();
txtPreLaunchCommand.setPromptText(i18n("settings.advanced.precall_command.prompt"));
txtPreLaunchCommand.getStyleClass().add("fit-width");
pane.addRow(1, new Label(i18n("settings.advanced.precall_command")), txtPreLaunchCommand);
txtWrapper = new JFXTextField();
txtWrapper.setPromptText(i18n("settings.advanced.wrapper_launcher.prompt"));
txtWrapper.getStyleClass().add("fit-width");
pane.addRow(2, new Label(i18n("settings.advanced.wrapper_launcher")), txtWrapper);
txtPostExitCommand = new JFXTextField();
txtPostExitCommand.setPromptText(i18n("settings.advanced.post_exit_command.prompt"));
txtPostExitCommand.getStyleClass().add("fit-width");
pane.addRow(3, new Label(i18n("settings.advanced.post_exit_command")), txtPostExitCommand);
HintPane hintPane = new HintPane();
hintPane.setText(i18n("settings.advanced.custom_commands.hint"));
GridPane.setColumnSpan(hintPane, 2);
pane.addRow(4, hintPane);
customCommandsPane.getContent().setAll(pane);
}
@ -593,7 +604,8 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
FXUtils.unbindString(txtGameArgs, lastVersionSetting.minecraftArgsProperty());
FXUtils.unbindString(txtMetaspace, lastVersionSetting.permSizeProperty());
FXUtils.unbindString(txtWrapper, lastVersionSetting.wrapperProperty());
FXUtils.unbindString(txtPrecallingCommand, lastVersionSetting.preLaunchCommandProperty());
FXUtils.unbindString(txtPreLaunchCommand, lastVersionSetting.preLaunchCommandProperty());
FXUtils.unbindString(txtPostExitCommand, lastVersionSetting.postExitCommandProperty());
FXUtils.unbindString(txtServerIP, lastVersionSetting.serverIpProperty());
FXUtils.unbindBoolean(chkAutoAllocate, lastVersionSetting.autoMemoryProperty());
FXUtils.unbindBoolean(chkFullscreen, lastVersionSetting.fullscreenProperty());
@ -631,7 +643,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
FXUtils.bindString(txtGameArgs, versionSetting.minecraftArgsProperty());
FXUtils.bindString(txtMetaspace, versionSetting.permSizeProperty());
FXUtils.bindString(txtWrapper, versionSetting.wrapperProperty());
FXUtils.bindString(txtPrecallingCommand, versionSetting.preLaunchCommandProperty());
FXUtils.bindString(txtPreLaunchCommand, versionSetting.preLaunchCommandProperty());
FXUtils.bindString(txtServerIP, versionSetting.serverIpProperty());
FXUtils.bindBoolean(chkAutoAllocate, versionSetting.autoMemoryProperty());
FXUtils.bindBoolean(chkFullscreen, versionSetting.fullscreenProperty());

View File

@ -648,6 +648,16 @@ settings=Settings
settings.advanced=Advanced Settings
settings.advanced.custom_commands=Custom Commands
settings.advanced.custom_commands.hint=Custom commands are executed with following environment variables:\n\
\ - $INST_NAME: name of the version\n\
\ - $INST_ID: name of the version\n\
\ - $INST_DIR: absolute path of the version\n\
\ - $INST_MC_DIR: absolute path of minecraft\n\
\ - $INST_JAVA: java binary used for launch\n\
\ - $INST_FORGE: set if Forge installed\n\
\ - $INST_LITELOADER: set if LiteLoader installed\n\
\ - $INST_OPTIFINE: set if OptiFine installed\n\
\ - $INST_FABRIC: set if Fabric installed
settings.advanced.dont_check_game_completeness=Do not scan game files
settings.advanced.dont_check_jvm_validity=Don't check whether JVM can launch the game or not
settings.advanced.game_dir.default=Standard (.minecraft/)
@ -676,6 +686,8 @@ settings.advanced.process_priority.below_normal=Below Normal
settings.advanced.process_priority.normal=Normal
settings.advanced.process_priority.above_normal=Above Normal
settings.advanced.process_priority.high=High
settings.advanced.post_exit_command=Post-exit command
settings.advanced.post_exit_command.prompt=Will be executed after game exits
settings.advanced.server_ip=Server Address
settings.advanced.server_ip.prompt=Join server when game launched
settings.advanced.use_native_glfw=[Linux] Use system GLFW

View File

@ -647,6 +647,16 @@ settings=遊戲設定
settings.advanced=進階設定
settings.advanced.custom_commands=自訂命令
settings.advanced.custom_commands.hint=自訂命令被調用時將包含如下的環境變數:\n\
\ - $INST_NAME: 版本名稱\n\
\ - $INST_ID: 版本名稱\n\
\ - $INST_DIR: 版本文件夾\n\
\ - $INST_MC_DIR: 遊戲運行路徑\n\
\ - $INST_JAVA: 遊戲運行使用的 Java 路徑\n\
\ - $INST_FORGE: 若安裝了 Forge將會存在本環境變數\n\
\ - $INST_LITELOADER: 若安裝了 LiteLoader將會存在本環境變數\n\
\ - $INST_OPTIFINE: 若安裝了 OptiFine將會存在本環境變數\n\
\ - $INST_FABRIC: 若安裝了 Fabric將會存在本環境變數
settings.advanced.dont_check_game_completeness=不檢查遊戲完整性
settings.advanced.dont_check_jvm_validity=不檢查 JVM 與遊戲的相容性
settings.advanced.game_dir.default=預設(.minecraft/
@ -667,7 +677,7 @@ settings.advanced.natives_directory=本地庫路徑LWJGL
settings.advanced.natives_directory.choose=選擇本地庫路徑
settings.advanced.natives_directory.default=預設(.minecraft/versions/<版本名>/natives/
settings.advanced.no_jvm_args=不使用預設的 JVM 參數
settings.advanced.precall_command=啟動前執行指令
settings.advanced.precall_command=遊戲啟動前執行指令
settings.advanced.precall_command.prompt=將在遊戲啟動前呼叫使用
settings.advanced.process_priority=進程優先度
settings.advanced.process_priority.low=低(節省遊戲占用資源,可能會造成遊戲卡頓)
@ -675,6 +685,8 @@ settings.advanced.process_priority.below_normal=較低(節省遊戲占用資
settings.advanced.process_priority.normal=中(平衡)
settings.advanced.process_priority.above_normal=較高(優先保證遊戲運行,但可能會導致其他程式卡頓)
settings.advanced.process_priority.high=高(優先保證遊戲運行,但可能會導致其他程式卡頓)
settings.advanced.post_exit_command=遊戲結束後執行命令
settings.advanced.post_exit_command.prompt=將在遊戲結束後呼叫使用
settings.advanced.server_ip=伺服器位址
settings.advanced.server_ip.prompt=默認,啟動遊戲後直接進入對應伺服器
settings.advanced.use_native_glfw=[Linux] 使用系統 GLFW

View File

@ -647,6 +647,16 @@ settings=设置
settings.advanced=高级设置
settings.advanced.custom_commands=自定义命令
settings.advanced.custom_commands.hint=自定义命令被调用时将包含如下的环境变量:\n\
\ - $INST_NAME: 版本名称\n\
\ - $INST_ID: 版本名称\n\
\ - $INST_DIR: 版本文件夹\n\
\ - $INST_MC_DIR: 游戏运行路径\n\
\ - $INST_JAVA: 游戏运行使用的 Java 路径\n\
\ - $INST_FORGE: 若安装了 Forge将会存在本环境变量\n\
\ - $INST_LITELOADER: 若安装了 LiteLoader将会存在本环境变量\n\
\ - $INST_OPTIFINE: 若安装了 OptiFine将会存在本环境变量\n\
\ - $INST_FABRIC: 若安装了 Fabric将会存在本环境变量
settings.advanced.dont_check_game_completeness=不检查游戏完整性
settings.advanced.dont_check_jvm_validity=不检查 JVM 与游戏的兼容性
settings.advanced.game_dir.default=默认(.minecraft/
@ -667,7 +677,7 @@ settings.advanced.natives_directory=本地库路径LWJGL
settings.advanced.natives_directory.choose=选择本地库路径
settings.advanced.natives_directory.default=预设(.minecraft/versions/<版本名>/natives/
settings.advanced.no_jvm_args=不添加默认的 JVM 参数
settings.advanced.precall_command=启动前执行命令
settings.advanced.precall_command=游戏启动前执行命令
settings.advanced.precall_command.prompt=将在游戏启动前调用
settings.advanced.process_priority=进程优先级
settings.advanced.process_priority.low=低(节省游戏占用资源,可能会造成游戏卡顿)
@ -675,6 +685,8 @@ settings.advanced.process_priority.below_normal=较低(节省游戏占用资
settings.advanced.process_priority.normal=中(平衡)
settings.advanced.process_priority.above_normal=较高(优先保证游戏运行,但可能会导致其他程序卡顿)
settings.advanced.process_priority.high=高(优先保证游戏运行,但可能会导致其他程序卡顿)
settings.advanced.post_exit_command=游戏结束后执行命令
settings.advanced.post_exit_command.prompt=将在游戏结束后调用
settings.advanced.server_ip=服务器地址
settings.advanced.server_ip.prompt=默认,启动游戏后可以直接进入对应服务器
settings.advanced.use_native_glfw=[Linux] 使用系统 GLFW