Add prompt warning user that no game installed

This commit is contained in:
huangyuhui
2018-09-03 12:43:08 +08:00
parent 07079ee295
commit a9be348ddf
7 changed files with 24 additions and 2 deletions

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.ui;
import com.jfoenix.concurrency.JFXUtilities;
import javafx.application.Platform;
import javafx.beans.binding.When;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
@@ -92,7 +93,7 @@ public final class LeftPaneController extends AdvancedListBox {
// ==== Accounts ====
public void checkAccount() {
if (Accounts.getAccounts().isEmpty())
addNewAccount();
Platform.runLater(this::addNewAccount);
}
private void addNewAccount() {

View File

@@ -281,6 +281,8 @@ public class DecoratorController {
dialogPane = new StackContainerPane();
dialog.setContent(dialogPane);
if (decorator.getDrawerWrapper() == null)
throw new IllegalStateException("Decorator has not been initialized");
dialog.setDialogContainer(decorator.getDrawerWrapper());
dialog.setOverlayClose(false);
dialog.show();

View File

@@ -29,6 +29,8 @@ import org.jackhuang.hmcl.ui.construct.AdvancedListItem;
import java.io.File;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public class GameAdvancedListItem extends AdvancedListItem {
private final WeakListenerHelper helper = new WeakListenerHelper();
@@ -68,7 +70,13 @@ public class GameAdvancedListItem extends AdvancedListItem {
else
imageProperty().set(new Image("/assets/img/grass.png"));
if (version != null) {
titleProperty().set(version);
subtitleProperty().set(null);
} else {
titleProperty().set(i18n("version.empty"));
subtitleProperty().set(i18n("version.empty.add"));
}
});
}
}

View File

@@ -128,6 +128,8 @@ public class Versions {
public static void launch(Profile profile, String id) {
if (Accounts.getSelectedAccount() == null)
Controllers.getLeftPaneController().checkAccount();
else if (id == null)
Controllers.dialog(i18n("version.empty.launch"));
else
LauncherHelper.INSTANCE.launch(profile, Accounts.getSelectedAccount(), id, null);
}

View File

@@ -331,6 +331,9 @@ update.tooltip=Update
version=Games
version.cannot_read=Unable to gather the game version. Cannot continue auto-installing.
version.empty=No game
version.empty.add=Click btn right to install game
version.empty.launch=No game to launch, please install new game via game list page.
version.forbidden_name=Forbidden name, do not use this.
version.game.old=Old
version.game.release=Release

View File

@@ -331,6 +331,9 @@ update.tooltip=更新
version=遊戲
version.cannot_read=讀取遊戲版本失敗,無法進行自動安裝
version.empty=無遊戲版本
version.empty.add=點擊右側按鈕安裝
version.empty.launch=沒有可啟動的遊戲,你可以點擊左側遊戲欄內的設置按鈕進入遊戲列表安裝遊戲
version.forbidden_name=此版本名稱不受支援,請換一個名字
version.game.old=老舊版本
version.game.release=穩定版本

View File

@@ -331,6 +331,9 @@ update.tooltip=更新
version=游戏
version.cannot_read=读取游戏版本失败,无法进行自动安装
version.empty=没有游戏版本
version.empty.add=点击右侧按钮安装
version.empty.launch=没有可启动的游戏,你可以点击左侧游戏栏内的设置按钮进入游戏列表安装游戏
version.forbidden_name=此版本名称不受支持,请换一个名字
version.game.old=远古版
version.game.release=稳定版