diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java index 5c1399733..8e274c1a3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java @@ -40,7 +40,7 @@ import org.jackhuang.hmcl.ui.construct.DialogCloseEvent; import org.jackhuang.hmcl.ui.construct.IconedItem; import org.jackhuang.hmcl.ui.profile.ProfileAdvancedListItem; import org.jackhuang.hmcl.ui.versions.GameAdvancedListItem; -import org.jackhuang.hmcl.upgrade.UpdateChecker; +import org.jackhuang.hmcl.ui.versions.Versions; import java.io.File; import java.util.concurrent.atomic.AtomicReference; @@ -55,12 +55,17 @@ public final class LeftPaneController extends AdvancedListBox { accountListItem.setOnAction(e -> Controllers.navigate(Controllers.getAccountListPage())); accountListItem.accountProperty().bind(Accounts.selectedAccountProperty()); GameAdvancedListItem gameListItem = new GameAdvancedListItem(); - gameListItem.setOnAction(e -> Controllers.navigate(Controllers.getGameListPage())); + gameListItem.actionButtonVisibleProperty().bind(Profiles.selectedVersionProperty().isNotNull()); + gameListItem.setOnAction(e -> Versions.modifyGameSettings(Profiles.getSelectedProfile(), Profiles.getSelectedVersion())); ProfileAdvancedListItem profileListItem = new ProfileAdvancedListItem(); profileListItem.setOnAction(e -> Controllers.navigate(Controllers.getProfileListPage())); profileListItem.profileProperty().bind(Profiles.selectedProfileProperty()); - IconedItem launcherSettingsItem = new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), "iconed-item"); + IconedItem gameItem = new IconedItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 20, 20), 32, 20), "iconed-item"); + gameItem.getLabel().setText(i18n("version.manage")); + gameItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getGameListPage())); + + IconedItem launcherSettingsItem = new IconedItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 20, 20), 32, 20), "iconed-item"); launcherSettingsItem.getLabel().setText(i18n("settings.launcher")); launcherSettingsItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage())); @@ -70,6 +75,7 @@ public final class LeftPaneController extends AdvancedListBox { .add(accountListItem) .startCategory(i18n("version").toUpperCase()) .add(gameListItem) + .add(gameItem) .startCategory(i18n("profile.title").toUpperCase()) .add(profileListItem) .startCategory(i18n("launcher").toUpperCase()) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java index 6fb1ad8b5..37721c253 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java @@ -17,10 +17,7 @@ */ package org.jackhuang.hmcl.ui.construct; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.beans.property.StringProperty; +import javafx.beans.property.*; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Rectangle2D; @@ -29,9 +26,10 @@ import javafx.scene.control.Skin; import javafx.scene.image.Image; public class AdvancedListItem extends Control { - private final ObjectProperty image = new SimpleObjectProperty<>(); - private final StringProperty title = new SimpleStringProperty(); - private final StringProperty subtitle = new SimpleStringProperty(); + private final ObjectProperty image = new SimpleObjectProperty<>(this, "image"); + private final StringProperty title = new SimpleStringProperty(this, "title"); + private final StringProperty subtitle = new SimpleStringProperty(this, "subtitle"); + private final BooleanProperty actionButtonVisible = new SimpleBooleanProperty(this, "actionButtonVisible", true); public ObjectProperty imageProperty() { return image; @@ -45,6 +43,10 @@ public class AdvancedListItem extends Control { return subtitle; } + public BooleanProperty actionButtonVisibleProperty() { + return actionButtonVisible; + } + public final ObjectProperty> onActionProperty() { return onAction; } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItemSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItemSkin.java index f743f99b3..1a6f31a77 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItemSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItemSkin.java @@ -93,6 +93,11 @@ public class AdvancedListItemSkin extends SkinBase { right.getChildren().setAll(settings); root.setRight(right); + FXUtils.onChangeAndOperate(skinnable.actionButtonVisibleProperty(), newValue -> { + if (newValue) root.setRight(right); + else root.setRight(null); + }); + stackPane.setStyle("-fx-padding: 10 16 10 16;"); stackPane.getStyleClass().setAll("transparent"); stackPane.setPickOnBounds(false); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index ced51b096..2e3a562e0 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -361,7 +361,7 @@ 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.add=Install game in game list 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 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index af9740203..7c7d0e4f9 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -361,7 +361,7 @@ update.tooltip=更新 version=遊戲 version.cannot_read=讀取遊戲版本失敗,無法進行自動安裝 version.empty=無遊戲版本 -version.empty.add=點擊右側按鈕安裝 +version.empty.add=進入遊戲列表安裝 version.empty.launch=沒有可啟動的遊戲,你可以點擊左側遊戲欄內的設置按鈕進入遊戲列表安裝遊戲 version.forbidden_name=此版本名稱不受支援,請換一個名字 version.game.old=老舊版本 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 24dc5a3e6..d3318921e 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -361,7 +361,7 @@ update.tooltip=更新 version=游戏 version.cannot_read=读取游戏版本失败,无法进行自动安装 version.empty=没有游戏版本 -version.empty.add=点击右侧按钮安装 +version.empty.add=进入游戏列表安装 version.empty.launch=没有可启动的游戏,你可以点击左侧游戏栏内的设置按钮进入游戏列表安装游戏 version.forbidden_name=此版本名称不受支持,请换一个名字 version.game.old=远古版