From 57bb719cb8213ec230b33ddcc96214539aa42be4 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Wed, 1 Sep 2021 01:26:57 +0800 Subject: [PATCH] feat: show account creation dialog when no account exists at launching game. --- HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java | 4 ++++ .../main/java/org/jackhuang/hmcl/ui/versions/Versions.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java index 37c37568e..2b0e09501 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java @@ -218,6 +218,10 @@ public class RootPage extends DecoratorTabPage { if (checkedAccont) return; checkedAccont = true; + checkAccountForcibly(); + } + + public void checkAccountForcibly() { if (Accounts.getAccounts().isEmpty()) Platform.runLater(this::addNewAccount); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java index 9631833f0..55812f1f4 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java @@ -215,7 +215,7 @@ public final class Versions { private static boolean checkForLaunching(Profile profile, String id) { if (Accounts.getSelectedAccount() == null) - Controllers.getRootPage().checkAccount(); + Controllers.getRootPage().checkAccountForcibly(); else if (id == null || !profile.getRepository().isLoaded() || !profile.getRepository().hasVersion(id)) Controllers.dialog(i18n("version.empty.launch"), i18n("launch.failed"), MessageDialogPane.MessageType.ERROR, () -> { Controllers.navigate(Controllers.getGameListPage());