|
29 | 29 | import javafx.scene.input.DragEvent; |
30 | 30 | import javafx.scene.input.TransferMode; |
31 | 31 | import javafx.scene.layout.*; |
32 | | -import org.jackhuang.hmcl.ui.skin.SkinCanvas; |
33 | | -import org.jackhuang.hmcl.ui.skin.animation.SkinAniRunning; |
34 | | -import org.jackhuang.hmcl.ui.skin.animation.SkinAniWavingArms; |
35 | 32 | import org.jackhuang.hmcl.auth.offline.OfflineAccount; |
36 | 33 | import org.jackhuang.hmcl.auth.offline.Skin; |
37 | 34 | import org.jackhuang.hmcl.auth.yggdrasil.TextureModel; |
|
40 | 37 | import org.jackhuang.hmcl.ui.Controllers; |
41 | 38 | import org.jackhuang.hmcl.ui.FXUtils; |
42 | 39 | import org.jackhuang.hmcl.ui.construct.*; |
| 40 | +import org.jackhuang.hmcl.ui.skin.SkinCanvas; |
| 41 | +import org.jackhuang.hmcl.ui.skin.animation.SkinAniRunning; |
| 42 | +import org.jackhuang.hmcl.ui.skin.animation.SkinAniWavingArms; |
43 | 43 | import org.jackhuang.hmcl.util.io.FileUtils; |
44 | 44 |
|
45 | 45 | import java.nio.file.Path; |
|
48 | 48 |
|
49 | 49 | import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed; |
50 | 50 | import static org.jackhuang.hmcl.ui.FXUtils.stringConverter; |
51 | | -import static org.jackhuang.hmcl.util.logging.Logger.LOG; |
52 | 51 | import static org.jackhuang.hmcl.util.i18n.I18n.i18n; |
| 52 | +import static org.jackhuang.hmcl.util.logging.Logger.LOG; |
53 | 53 |
|
54 | 54 | public class OfflineAccountSkinPane extends StackPane { |
55 | 55 | private final OfflineAccount account; |
@@ -110,6 +110,7 @@ public OfflineAccountSkinPane(OfflineAccount account) { |
110 | 110 |
|
111 | 111 | cslApiField.setPromptText(i18n("account.skin.type.csl_api.location.hint")); |
112 | 112 | cslApiField.setValidators(new URLValidator()); |
| 113 | + FXUtils.setValidateWhileTextChanged(cslApiField, true); |
113 | 114 |
|
114 | 115 | skinItem.loadChildren(Arrays.asList( |
115 | 116 | new MultiFileItem.Option<>(i18n("message.default"), Skin.Type.DEFAULT), |
@@ -218,6 +219,10 @@ public OfflineAccountSkinPane(OfflineAccount account) { |
218 | 219 | cancelButton.setOnAction(e -> fireEvent(new DialogCloseEvent())); |
219 | 220 | onEscPressed(this, cancelButton::fire); |
220 | 221 |
|
| 222 | + acceptButton.disableProperty().bind( |
| 223 | + skinItem.selectedDataProperty().isEqualTo(Skin.Type.CUSTOM_SKIN_LOADER_API) |
| 224 | + .and(cslApiField.activeValidatorProperty().isNotNull())); |
| 225 | + |
221 | 226 | layout.setActions(littleSkinLink, acceptButton, cancelButton); |
222 | 227 | } |
223 | 228 |
|
|
0 commit comments