feat: show account creation dialog when no account exists at launching game.

This commit is contained in:
huanghongxun
2021-09-01 01:26:57 +08:00
parent 981127c355
commit 57bb719cb8
2 changed files with 5 additions and 1 deletions

View File

@@ -218,6 +218,10 @@ public class RootPage extends DecoratorTabPage {
if (checkedAccont) if (checkedAccont)
return; return;
checkedAccont = true; checkedAccont = true;
checkAccountForcibly();
}
public void checkAccountForcibly() {
if (Accounts.getAccounts().isEmpty()) if (Accounts.getAccounts().isEmpty())
Platform.runLater(this::addNewAccount); Platform.runLater(this::addNewAccount);
} }

View File

@@ -215,7 +215,7 @@ public final class Versions {
private static boolean checkForLaunching(Profile profile, String id) { private static boolean checkForLaunching(Profile profile, String id) {
if (Accounts.getSelectedAccount() == null) if (Accounts.getSelectedAccount() == null)
Controllers.getRootPage().checkAccount(); Controllers.getRootPage().checkAccountForcibly();
else if (id == null || !profile.getRepository().isLoaded() || !profile.getRepository().hasVersion(id)) else if (id == null || !profile.getRepository().isLoaded() || !profile.getRepository().hasVersion(id))
Controllers.dialog(i18n("version.empty.launch"), i18n("launch.failed"), MessageDialogPane.MessageType.ERROR, () -> { Controllers.dialog(i18n("version.empty.launch"), i18n("launch.failed"), MessageDialogPane.MessageType.ERROR, () -> {
Controllers.navigate(Controllers.getGameListPage()); Controllers.navigate(Controllers.getGameListPage());