优化离线账户中包含非 ASCII 字符时的提示 (#3853)
This commit is contained in:
@@ -19,6 +19,9 @@ package org.jackhuang.hmcl.ui.account;
|
|||||||
|
|
||||||
import com.jfoenix.controls.*;
|
import com.jfoenix.controls.*;
|
||||||
import com.jfoenix.validation.base.ValidatorBase;
|
import com.jfoenix.validation.base.ValidatorBase;
|
||||||
|
import javafx.animation.KeyFrame;
|
||||||
|
import javafx.animation.KeyValue;
|
||||||
|
import javafx.animation.Timeline;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.NamedArg;
|
import javafx.beans.NamedArg;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
@@ -36,6 +39,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.control.TextInputControl;
|
import javafx.scene.control.TextInputControl;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
|
import javafx.util.Duration;
|
||||||
import org.jackhuang.hmcl.Metadata;
|
import org.jackhuang.hmcl.Metadata;
|
||||||
import org.jackhuang.hmcl.auth.AccountFactory;
|
import org.jackhuang.hmcl.auth.AccountFactory;
|
||||||
import org.jackhuang.hmcl.auth.CharacterSelector;
|
import org.jackhuang.hmcl.auth.CharacterSelector;
|
||||||
@@ -264,16 +268,33 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (factory instanceof OfflineAccountFactory && username != null && !USERNAME_CHECKER_PATTERN.matcher(username).matches()) {
|
if (factory instanceof OfflineAccountFactory && username != null && !USERNAME_CHECKER_PATTERN.matcher(username).matches()) {
|
||||||
Controllers.confirm(
|
JFXButton btnYes = new JFXButton(i18n("button.ok"));
|
||||||
|
btnYes.getStyleClass().add("dialog-error");
|
||||||
|
btnYes.setOnAction(e -> doCreate.run());
|
||||||
|
btnYes.setDisable(true);
|
||||||
|
|
||||||
|
int countdown = 10;
|
||||||
|
KeyFrame[] keyFrames = new KeyFrame[countdown + 1];
|
||||||
|
for (int i = 0; i < countdown; i++) {
|
||||||
|
keyFrames[i] = new KeyFrame(Duration.seconds(i),
|
||||||
|
new KeyValue(btnYes.textProperty(), i18n("button.ok.countdown", countdown - i)));
|
||||||
|
}
|
||||||
|
keyFrames[countdown] = new KeyFrame(Duration.seconds(countdown),
|
||||||
|
new KeyValue(btnYes.textProperty(), i18n("button.ok")),
|
||||||
|
new KeyValue(btnYes.disableProperty(), false));
|
||||||
|
|
||||||
|
Timeline timeline = new Timeline(keyFrames);
|
||||||
|
Controllers.confirmAction(
|
||||||
i18n("account.methods.offline.name.invalid"), i18n("message.warning"),
|
i18n("account.methods.offline.name.invalid"), i18n("message.warning"),
|
||||||
MessageDialogPane.MessageType.WARNING,
|
MessageDialogPane.MessageType.WARNING,
|
||||||
doCreate,
|
btnYes,
|
||||||
() -> {
|
() -> {
|
||||||
lblErrorMessage.setText(i18n("account.methods.offline.name.invalid.tip"));
|
timeline.stop();
|
||||||
body.setDisable(false);
|
body.setDisable(false);
|
||||||
spinner.hideSpinner();
|
spinner.hideSpinner();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
timeline.play();
|
||||||
} else {
|
} else {
|
||||||
doCreate.run();
|
doCreate.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,13 +124,12 @@ account.methods.microsoft.snapshot=You are using an unofficial build of HMCL. Pl
|
|||||||
account.methods.microsoft.snapshot.website=Official Website
|
account.methods.microsoft.snapshot.website=Official Website
|
||||||
account.methods.offline=Offline
|
account.methods.offline=Offline
|
||||||
account.methods.offline.name.special_characters=Using only English letters, numbers, and underscores is recommended
|
account.methods.offline.name.special_characters=Using only English letters, numbers, and underscores is recommended
|
||||||
account.methods.offline.name.invalid.tip=It is recommended to use only English letters, numbers and underscores for the username, and the length should not exceed 16 characters.
|
|
||||||
account.methods.offline.name.invalid=It is recommended to use only English letters, numbers and underscores for the username, and the length should not exceed 16 characters.\n\
|
account.methods.offline.name.invalid=It is recommended to use only English letters, numbers and underscores for the username, and the length should not exceed 16 characters.\n\
|
||||||
\n\
|
\n\
|
||||||
\ · Legitimate: HuangYu, huang_Yu, Huang_Yu_123;\n\
|
\ · Legitimate: HuangYu, huang_Yu, Huang_Yu_123;\n\
|
||||||
\ · Illegal: Huang Yu, Huang-Yu_%%%, Huang_Yu_hello_world_hello_world.\n\
|
\ · Illegal: Huang Yu, Huang-Yu_%%%, Huang_Yu_hello_world_hello_world.\n\
|
||||||
\n\
|
\n\
|
||||||
If you believe there is a corresponding mod or plugin on the server side to remove this restriction, you can ignore this warning.
|
Using the illegal username will prevent you from joining most servers and may conflict with some mods, causing the game to crash.
|
||||||
account.methods.offline.uuid=UUID
|
account.methods.offline.uuid=UUID
|
||||||
account.methods.offline.uuid.hint=UUID is a unique identifier for Minecraft players, and each launcher may generate UUIDs differently. Changing it to the one generated by other launchers allows you to keep your items in your offline account inventory.\n\
|
account.methods.offline.uuid.hint=UUID is a unique identifier for Minecraft players, and each launcher may generate UUIDs differently. Changing it to the one generated by other launchers allows you to keep your items in your offline account inventory.\n\
|
||||||
\n\
|
\n\
|
||||||
@@ -181,6 +180,7 @@ button.install=Install
|
|||||||
button.export=Export
|
button.export=Export
|
||||||
button.no=No
|
button.no=No
|
||||||
button.ok=OK
|
button.ok=OK
|
||||||
|
button.ok.countdown=OK (%d)
|
||||||
button.refresh=Refresh
|
button.refresh=Refresh
|
||||||
button.remove=Remove
|
button.remove=Remove
|
||||||
button.remove.confirm=Are you sure you want to permanently remove it? This action cannot be undone!
|
button.remove.confirm=Are you sure you want to permanently remove it? This action cannot be undone!
|
||||||
|
|||||||
@@ -130,13 +130,12 @@ account.methods.microsoft.snapshot=你正在使用第三方提供的 HMCL,請
|
|||||||
account.methods.microsoft.snapshot.website=官方網站
|
account.methods.microsoft.snapshot.website=官方網站
|
||||||
account.methods.offline=離線模式
|
account.methods.offline=離線模式
|
||||||
account.methods.offline.name.special_characters=建議使用英文字母、數字以及底線命名
|
account.methods.offline.name.special_characters=建議使用英文字母、數字以及底線命名
|
||||||
account.methods.offline.name.invalid.tip=遊戲使用者名稱建議僅使用英文字母、數字及底線,且長度不超過 16 個字元。
|
|
||||||
account.methods.offline.name.invalid=遊戲使用者名稱建議僅使用英文字母、數字及底線,且長度不超過 16 個字元。\n\
|
account.methods.offline.name.invalid=遊戲使用者名稱建議僅使用英文字母、數字及底線,且長度不超過 16 個字元。\n\
|
||||||
\n\
|
\n\
|
||||||
\ · 一些有效的使用者名稱:HuangYu、huang_Yu、Huang_Yu_123;\n\
|
\ · 一些有效的使用者名稱:HuangYu、huang_Yu、Huang_Yu_123;\n\
|
||||||
\ · 一些無效的使用者名稱:黃魚,Huang Yu、Huang-Yu_%%%、Huang_Yu_hello_world_hello_world。\n\
|
\ · 一些無效的使用者名稱:黃魚,Huang Yu、Huang-Yu_%%%、Huang_Yu_hello_world_hello_world。\n\
|
||||||
\n\
|
\n\
|
||||||
如果你相信伺服器端有相應的模組或插件來解除此限制,你可以忽略本警告。
|
使用非法使用者名稱會導致你無法加入大部分伺服器,並可能與部分模組衝突而使遊戲崩潰。
|
||||||
account.methods.offline.uuid=UUID
|
account.methods.offline.uuid=UUID
|
||||||
account.methods.offline.uuid.hint=UUID 是 Minecraft 玩家的唯一標識符,每個啟動器生成 UUID 的方式可能不同。\n透過修改 UUID 選項至原啟動器所生成的 UUID,你可以保證在切換啟動器後,遊戲還能將你的遊戲角色識別為給定 UUID 所對應的角色,從而保留原來角色的背包物品。\nUUID 選項為進階選項,除非你知道你在做什麼,否則你不需要調整該選項。
|
account.methods.offline.uuid.hint=UUID 是 Minecraft 玩家的唯一標識符,每個啟動器生成 UUID 的方式可能不同。\n透過修改 UUID 選項至原啟動器所生成的 UUID,你可以保證在切換啟動器後,遊戲還能將你的遊戲角色識別為給定 UUID 所對應的角色,從而保留原來角色的背包物品。\nUUID 選項為進階選項,除非你知道你在做什麼,否則你不需要調整該選項。
|
||||||
account.methods.offline.uuid.malformed=格式錯誤
|
account.methods.offline.uuid.malformed=格式錯誤
|
||||||
@@ -184,6 +183,7 @@ button.install=安裝
|
|||||||
button.export=匯出
|
button.export=匯出
|
||||||
button.no=否
|
button.no=否
|
||||||
button.ok=確定
|
button.ok=確定
|
||||||
|
button.ok.countdown=確定 (%d)
|
||||||
button.refresh=重新整理
|
button.refresh=重新整理
|
||||||
button.remove=刪除
|
button.remove=刪除
|
||||||
button.remove.confirm=你確認要刪除嗎?該操作無法復原!
|
button.remove.confirm=你確認要刪除嗎?該操作無法復原!
|
||||||
|
|||||||
@@ -138,14 +138,12 @@ account.methods.microsoft.snapshot=你正在使用第三方提供的 HMCL,请
|
|||||||
account.methods.microsoft.snapshot.website=官方网站
|
account.methods.microsoft.snapshot.website=官方网站
|
||||||
account.methods.offline=离线模式
|
account.methods.offline=离线模式
|
||||||
account.methods.offline.name.special_characters=建议使用英文字符、数字以及下划线命名
|
account.methods.offline.name.special_characters=建议使用英文字符、数字以及下划线命名
|
||||||
account.methods.offline.name.invalid.tip=游戏用户名建议仅使用英文字母、数字及下划线,且长度不超过 16 个字符。
|
|
||||||
account.methods.offline.name.invalid=游戏用户名建议仅使用英文字母、数字及下划线,且长度不超过 16 个字符。\n\
|
account.methods.offline.name.invalid=游戏用户名建议仅使用英文字母、数字及下划线,且长度不超过 16 个字符。\n\
|
||||||
\n\
|
\n\
|
||||||
\ · 一些合法用户名:HuangYu、huang_Yu、Huang_Yu_123;\n\
|
\ · 一些合法用户名:HuangYu、huang_Yu、Huang_Yu_123;\n\
|
||||||
\ · 一些非法用户名:黄鱼、Huang Yu、Huang-Yu_%%%、Huang_Yu_hello_world_hello_world。\n\
|
\ · 一些非法用户名:黄鱼、Huang Yu、Huang-Yu_%%%、Huang_Yu_hello_world_hello_world。\n\
|
||||||
\n\
|
\n\
|
||||||
如果你相信服务端有相应模组或插件解除此限制,可以忽略本警告。\n\
|
使用非法用户名会导致你无法加入大部分服务器,并可能与部分模组冲突而使游戏崩溃。
|
||||||
如遇到问题,你可以点击右上角帮助按钮进行求助。
|
|
||||||
account.methods.offline.uuid=UUID
|
account.methods.offline.uuid=UUID
|
||||||
account.methods.offline.uuid.hint=UUID 是 Minecraft 玩家的唯一标识符,每个启动器生成 UUID 的方式可能不同。通过将 UUID 修改为原启动器所生成的 UUID,你可以保证在切换启动器后,游戏还能将你的游戏角色识别为给定 UUID 所对应的角色,从而保留原角色的背包物品。UUID 选项为高级选项,除非你知道你在做什么,否则你不需要调整该选项。
|
account.methods.offline.uuid.hint=UUID 是 Minecraft 玩家的唯一标识符,每个启动器生成 UUID 的方式可能不同。通过将 UUID 修改为原启动器所生成的 UUID,你可以保证在切换启动器后,游戏还能将你的游戏角色识别为给定 UUID 所对应的角色,从而保留原角色的背包物品。UUID 选项为高级选项,除非你知道你在做什么,否则你不需要调整该选项。
|
||||||
account.methods.offline.uuid.malformed=格式错误
|
account.methods.offline.uuid.malformed=格式错误
|
||||||
@@ -193,6 +191,7 @@ button.install=安装
|
|||||||
button.export=导出
|
button.export=导出
|
||||||
button.no=否
|
button.no=否
|
||||||
button.ok=确定
|
button.ok=确定
|
||||||
|
button.ok.countdown=确定 (%d)
|
||||||
button.refresh=刷新
|
button.refresh=刷新
|
||||||
button.remove=删除
|
button.remove=删除
|
||||||
button.remove.confirm=你确定要删除吗?此操作无法撤销!
|
button.remove.confirm=你确定要删除吗?此操作无法撤销!
|
||||||
|
|||||||
Reference in New Issue
Block a user