feat(skin): custom model.

This commit is contained in:
huanghongxun
2021-10-09 17:49:17 +08:00
parent f528f3bf40
commit 20957106df
6 changed files with 64 additions and 13 deletions

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.ui.account;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXDialogLayout;
import com.jfoenix.controls.JFXTextField;
import javafx.application.Platform;
@@ -46,6 +47,7 @@ import java.util.Arrays;
import java.util.logging.Level;
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
import static org.jackhuang.hmcl.ui.FXUtils.stringConverter;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
@@ -54,6 +56,7 @@ public class OfflineAccountSkinPane extends StackPane {
private final MultiFileItem<Skin.Type> skinItem = new MultiFileItem<>();
private final JFXTextField cslApiField = new JFXTextField();
private final JFXComboBox<TextureModel> modelCombobox = new JFXComboBox<>();
private final FileSelector skinSelector = new FileSelector();
private final FileSelector capeSelector = new FileSelector();
@@ -95,7 +98,7 @@ public class OfflineAccountSkinPane extends StackPane {
}
});
TransitionPane skinOptionPane = new TransitionPane();
StackPane skinOptionPane = new StackPane();
skinOptionPane.setMaxWidth(300);
VBox optionPane = new VBox(skinItem, skinOptionPane);
pane.setRight(optionPane);
@@ -114,11 +117,16 @@ public class OfflineAccountSkinPane extends StackPane {
new MultiFileItem.Option<>(i18n("account.skin.type.csl_api"), Skin.Type.CUSTOM_SKIN_LOADER_API)
));
modelCombobox.setConverter(stringConverter(model -> i18n("account.skin.model." + model.modelName)));
modelCombobox.getItems().setAll(TextureModel.STEVE, TextureModel.ALEX);
if (account.getSkin() == null) {
skinItem.setSelectedData(Skin.Type.DEFAULT);
modelCombobox.setValue(TextureModel.STEVE);
} else {
skinItem.setSelectedData(account.getSkin().getType());
cslApiField.setText(account.getSkin().getCslApi());
modelCombobox.setValue(account.getSkin().getTextureModel());
skinSelector.setValue(account.getSkin().getLocalSkinPath());
capeSelector.setValue(account.getSkin().getLocalCapePath());
}
@@ -150,18 +158,23 @@ public class OfflineAccountSkinPane extends StackPane {
case DEFAULT:
case STEVE:
case ALEX:
break;
case LITTLE_SKIN:
HintPane hint = new HintPane(MessageDialogPane.MessageType.INFO);
hint.setText(i18n("account.skin.type.little_skin.hint"));
gridPane.addRow(0, hint);
break;
case LOCAL_FILE:
gridPane.addRow(0, new Label(i18n("account.skin")), skinSelector);
gridPane.addRow(1, new Label(i18n("account.cape")), capeSelector);
gridPane.addRow(0, new Label(i18n("account.skin.model")), modelCombobox);
gridPane.addRow(1, new Label(i18n("account.skin")), skinSelector);
gridPane.addRow(2, new Label(i18n("account.cape")), capeSelector);
break;
case CUSTOM_SKIN_LOADER_API:
gridPane.addRow(0, new Label(i18n("account.skin.type.csl_api.location")), cslApiField);
break;
}
skinOptionPane.setContent(gridPane, ContainerAnimations.NONE.getAnimationProducer());
skinOptionPane.getChildren().setAll(gridPane);
});
JFXButton acceptButton = new JFXButton(i18n("button.ok"));
@@ -171,7 +184,7 @@ public class OfflineAccountSkinPane extends StackPane {
fireEvent(new DialogCloseEvent());
});
JFXHyperlink littleSkinLink = new JFXHyperlink(i18n("account.skin.type.little_skin.hint"));
JFXHyperlink littleSkinLink = new JFXHyperlink(i18n("account.skin.type.little_skin"));
littleSkinLink.setOnAction(e -> FXUtils.openLink("https://mcskin.littleservice.cn/"));
JFXButton cancelButton = new JFXButton(i18n("button.cancel"));
cancelButton.getStyleClass().add("dialog-cancel");
@@ -182,7 +195,7 @@ public class OfflineAccountSkinPane extends StackPane {
}
private Skin getSkin() {
return new Skin(skinItem.getSelectedData(), cslApiField.getText(), skinSelector.getValue(), capeSelector.getValue());
return new Skin(skinItem.getSelectedData(), cslApiField.getText(), modelCombobox.getValue(), skinSelector.getValue(), capeSelector.getValue());
}
private boolean isDefaultSlim() {

View File

@@ -113,10 +113,14 @@ account.not_logged_in=Not logged in
account.password=Password
account.skin=Skin
account.skin.file=Skin image file
account.skin.model=Model
account.skin.model.default=Classic (Steve)
account.skin.model.slim=Slim (Alex)
account.skin.type.csl_api=Blessing Skin
account.skin.type.csl_api.location=Address
account.skin.type.csl_api.location.hint=CustomSkinAPI
account.skin.type.little_skin.hint=LittleSkin
account.skin.type.little_skin=LittleSkin
account.skin.type.little_skin.hint=You need to create a character in skin website. And the skin of this offline account will be bound to the skin of the character in the skin website with the same name.
account.skin.type.local_file=Local skin image file
account.skin.upload=Upload skin
account.skin.upload.failed=Failed to upload skin

View File

@@ -113,10 +113,14 @@ account.not_logged_in=未登入
account.password=密碼
account.skin=皮膚
account.skin.file=皮膚圖片檔案
account.skin.model=模型
account.skin.model.default=經典Steve
account.skin.model.slim=苗條Alex
account.skin.type.csl_api=Blessing Skin 伺服器
account.skin.type.csl_api.location=伺服器位址
account.skin.type.csl_api.location.hint=CustomSkinAPI 位址
account.skin.type.little_skin.hint=LittleSkin 皮膚站
account.skin.type.little_skin=LittleSkin 皮膚站
account.skin.type.little_skin.hint=你需要在皮膚站中創建並使用和該離線帳戶角色同名角色,此時離線帳戶皮膚將為皮膚站上角色所設定的皮膚。
account.skin.type.local_file=本地皮膚圖片檔案
account.skin.upload=上傳皮膚
account.skin.upload.failed=皮膚上傳失敗

View File

@@ -113,10 +113,14 @@ account.not_logged_in=未登录
account.password=密码
account.skin=皮肤
account.skin.file=皮肤图片文件
account.skin.model=模型
account.skin.model.default=经典Steve
account.skin.model.slim=苗条Alex
account.skin.type.csl_api=Blessing Skin 服务器
account.skin.type.csl_api.location=服务器地址
account.skin.type.csl_api.location.hint=CustomSkinAPI 地址
account.skin.type.little_skin.hint=LittleSkin 皮肤站
account.skin.type.little_skin=LittleSkin 皮肤站
account.skin.type.little_skin.hint=你需要在皮肤站中创建并使用和该离线帐户角色同名角色,此时离线帐户皮肤将为皮肤站上角色所设定的皮肤。
account.skin.type.local_file=本地皮肤图片文件
account.skin.upload=上传皮肤
account.skin.upload.failed=皮肤上传失败