diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java index 72001cabe..916e6b786 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java @@ -99,6 +99,9 @@ public final class Config implements Cloneable { @SerializedName("logLines") public final IntegerProperty logLines = new SimpleIntegerProperty(100); + @SerializedName("firstLaunch") + public final BooleanProperty firstLaunch = new SimpleBooleanProperty(true); + public final ObservableList authlibInjectorServers = FXCollections.observableArrayList(); @Override diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java index 6003265ee..09cb5ad42 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java @@ -79,7 +79,11 @@ public class Settings { private final Map accounts = new ConcurrentHashMap<>(); + private final boolean firstLaunch; + private Settings() { + firstLaunch = SETTINGS.firstLaunch.get(); + loadProxy(); for (Iterator> iterator = SETTINGS.accounts.iterator(); iterator.hasNext();) { @@ -140,6 +144,7 @@ public class Settings { public void save() { try { SETTINGS.accounts.clear(); + SETTINGS.firstLaunch.set(false); for (Account account : accounts.values()) { Map storage = account.toStorage(); storage.put("type", Accounts.getAccountType(account)); @@ -152,6 +157,10 @@ public class Settings { } } + public boolean isFirstLaunch() { + return firstLaunch; + } + private final StringProperty commonPath = new ImmediateStringProperty(this, "commonPath", SETTINGS.commonDirectory.get()) { @Override public void invalidated() { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java index 6ee2faf52..308949ae0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java @@ -22,6 +22,10 @@ import com.jfoenix.controls.JFXDialog; import com.jfoenix.controls.JFXDrawer; import com.jfoenix.controls.JFXHamburger; import com.jfoenix.svg.SVGGlyph; +import javafx.animation.Interpolator; +import javafx.animation.KeyFrame; +import javafx.animation.KeyValue; +import javafx.animation.Timeline; import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; @@ -38,6 +42,7 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.Tooltip; import javafx.scene.image.Image; +import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.*; import javafx.scene.paint.Color; @@ -45,6 +50,7 @@ import javafx.scene.shape.Rectangle; import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.StageStyle; +import javafx.util.Duration; import org.jackhuang.hmcl.Launcher; import org.jackhuang.hmcl.setting.EnumBackgroundImage; import org.jackhuang.hmcl.setting.Settings; @@ -129,6 +135,8 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza private JFXButton btnClose; @FXML private HBox navLeft; + @FXML + private ImageView welcomeView; public Decorator(Stage primaryStage, Node mainPage, String title) { this(primaryStage, mainPage, title, true, true); @@ -172,6 +180,19 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza dialog.setDialogContainer(drawerWrapper); dialog.setContent(dialogPane); + welcomeView.setCursor(Cursor.HAND); + welcomeView.setOnMouseClicked(e -> { + Timeline nowAnimation = new Timeline(); + nowAnimation.getKeyFrames().addAll( + new KeyFrame(Duration.ZERO, new KeyValue(welcomeView.opacityProperty(), 1.0D, Interpolator.EASE_BOTH)), + new KeyFrame(new Duration(300), new KeyValue(welcomeView.opacityProperty(), 0.0D, Interpolator.EASE_BOTH)), + new KeyFrame(new Duration(300), e2 -> drawerWrapper.getChildren().remove(welcomeView)) + ); + nowAnimation.play(); + }); + if (!Settings.INSTANCE.isFirstLaunch()) + drawerWrapper.getChildren().remove(welcomeView); + if (!min) buttonsContainer.getChildren().remove(btnMin); if (!max) buttonsContainer.getChildren().remove(btnMax); diff --git a/HMCL/src/main/resources/assets/fxml/decorator.fxml b/HMCL/src/main/resources/assets/fxml/decorator.fxml index fdbda6f8f..44cac5509 100644 --- a/HMCL/src/main/resources/assets/fxml/decorator.fxml +++ b/HMCL/src/main/resources/assets/fxml/decorator.fxml @@ -8,6 +8,8 @@ + + @@ -44,6 +46,9 @@ + + + diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 6ac579604..e0b07fc20 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -173,7 +173,7 @@ message.unknown=Unknown modpack=Mod pack -modpack.choose=Choose a modpack zip file which you want to import. If you want to update the modpack, please enter the version you want to update. +modpack.choose=Choose a modpack zip file which you want to install. modpack.desc=Describe your modpack, including precautions, changlog, supporting Markdown(also supporting online pictures). modpack.enter_name=Enter your desired name for this game. modpack.export=Export Modpack diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index fbd0332fb..d2f0aeb43 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -173,7 +173,7 @@ message.unknown=未知 modpack=整合包 -modpack.choose=选择要导入的游戏整合包文件,如果您希望更新整合包,请输入要更新的版本名 +modpack.choose=选择要安装的游戏整合包文件 modpack.desc=描述你要制作的整合包,比如整合包注意事项和更新记录,支持 Markdown(图片请用网络图)。 modpack.enter_name=给游戏起个你喜欢的名字 modpack.export=导出整合包