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 386c01cc6..02def50ee 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java @@ -142,9 +142,6 @@ public final class Config implements Cloneable, Observable { @SerializedName("updateChannel") private ObjectProperty updateChannel = new SimpleObjectProperty<>(UpdateChannel.STABLE); - @SerializedName("enableMainPageGameList") - private BooleanProperty enableMainPageGameList = new SimpleBooleanProperty(false); - @SerializedName("_version") private IntegerProperty configVersion = new SimpleIntegerProperty(0); @@ -443,15 +440,4 @@ public final class Config implements Cloneable, Observable { this.updateChannel.set(updateChannel); } - public boolean isEnableMainPageGameList() { - return enableMainPageGameList.get(); - } - - public BooleanProperty enableMainPageGameListProperty() { - return enableMainPageGameList; - } - - public void setEnableMainPageGameList(boolean enableMainPageGameList) { - this.enableMainPageGameList.set(enableMainPageGameList); - } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java index fa690b14e..08c907bbe 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java @@ -31,12 +31,14 @@ import javafx.beans.value.ObservableValue; import javafx.beans.value.WeakChangeListener; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; +import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.input.ScrollEvent; import javafx.scene.layout.Region; +import javafx.scene.layout.StackPane; import javafx.scene.shape.Rectangle; import javafx.util.Callback; import javafx.util.Duration; @@ -201,6 +203,14 @@ public final class FXUtils { return region.getMaxHeight(); } + public static Node limitingSize(Node node, double width, double height) { + StackPane pane = new StackPane(node); + pane.setAlignment(Pos.CENTER); + FXUtils.setLimitWidth(pane, width); + FXUtils.setLimitHeight(pane, height); + return pane; + } + public static void smoothScrolling(ScrollPane scrollPane) { JFXScrollPane.smoothScrolling(scrollPane); } @@ -465,4 +475,11 @@ public final class FXUtils { return "Interpolator.SINE"; } }; + + public static Runnable withJFXPopupClosing(Runnable runnable, JFXPopup popup) { + return () -> { + runnable.run(); + popup.hide(); + }; + } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameVersionListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameVersionListPage.java deleted file mode 100644 index 0b2df4cc1..000000000 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameVersionListPage.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see {http://www.gnu.org/licenses/}. - */ -package org.jackhuang.hmcl.ui; - -import com.jfoenix.concurrency.JFXUtilities; -import com.jfoenix.controls.*; -import javafx.geometry.Insets; -import javafx.geometry.Pos; -import javafx.scene.Node; -import javafx.scene.control.ScrollPane; -import javafx.scene.image.Image; -import javafx.scene.input.MouseButton; -import javafx.scene.layout.Region; -import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; -import javafx.stage.FileChooser; -import org.jackhuang.hmcl.download.LibraryAnalyzer; -import org.jackhuang.hmcl.event.EventBus; -import org.jackhuang.hmcl.event.RefreshedVersionsEvent; -import org.jackhuang.hmcl.event.RefreshingVersionsEvent; -import org.jackhuang.hmcl.game.GameVersion; -import org.jackhuang.hmcl.game.HMCLGameRepository; -import org.jackhuang.hmcl.game.ModpackHelper; -import org.jackhuang.hmcl.game.Version; -import org.jackhuang.hmcl.mod.MismatchedModpackTypeException; -import org.jackhuang.hmcl.mod.UnsupportedModpackException; -import org.jackhuang.hmcl.setting.Profile; -import org.jackhuang.hmcl.setting.Profiles; -import org.jackhuang.hmcl.setting.Theme; -import org.jackhuang.hmcl.task.Schedulers; -import org.jackhuang.hmcl.task.Task; -import org.jackhuang.hmcl.task.TaskExecutor; -import org.jackhuang.hmcl.ui.construct.DialogCloseEvent; -import org.jackhuang.hmcl.ui.construct.MessageBox; -import org.jackhuang.hmcl.ui.versions.Versions; -import org.jackhuang.hmcl.util.Lang; -import org.jackhuang.hmcl.util.VersionNumber; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; - -import static org.jackhuang.hmcl.util.StringUtils.removePrefix; -import static org.jackhuang.hmcl.util.StringUtils.removeSuffix; -import static org.jackhuang.hmcl.util.i18n.I18n.i18n; - -public class GameVersionListPage extends StackPane { - private final JFXSpinner spinner; - private final StackPane contentPane; - private final JFXMasonryPane masonryPane; - - private Profile profile; - - public GameVersionListPage() { - spinner = new JFXSpinner(); - spinner.getStyleClass().setAll("first-spinner"); - - contentPane = new StackPane(); - - ScrollPane scrollPane = new ScrollPane(); - scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); - scrollPane.setFitToWidth(true); - - masonryPane = new JFXMasonryPane(); - masonryPane.setHSpacing(3); - masonryPane.setVSpacing(3); - masonryPane.setCellWidth(182); - masonryPane.setCellHeight(153); - - scrollPane.setContent(masonryPane); - - VBox vBox = new VBox(); - vBox.setPadding(new Insets(15)); - vBox.setPickOnBounds(false); - vBox.setAlignment(Pos.BOTTOM_RIGHT); - vBox.setSpacing(15); - - JFXButton btnRefresh = new JFXButton(); - btnRefresh.setPrefWidth(40); - btnRefresh.setPrefHeight(40); - btnRefresh.setButtonType(JFXButton.ButtonType.RAISED); - btnRefresh.getStyleClass().setAll("jfx-button-raised-round"); - btnRefresh.setGraphic(SVG.refresh(Theme.foregroundFillBinding(), -1, -1)); - btnRefresh.setOnMouseClicked(e -> profile.getRepository().refreshVersionsAsync().start()); - FXUtils.installTooltip(btnRefresh, i18n("button.refresh")); - - vBox.getChildren().setAll(btnRefresh); - - contentPane.getChildren().setAll(scrollPane, vBox); - - getChildren().setAll(spinner); - - Profiles.selectedProfileProperty().addListener((o, a, b) -> this.profile = b); - profile = Profiles.getSelectedProfile(); - - EventBus.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(event -> { - if (event.getSource() == profile.getRepository()) - loadVersions((HMCLGameRepository) event.getSource()); - }); - EventBus.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(event -> { - if (event.getSource() == profile.getRepository()) - // This will occupy 0.5s. Too slow! - JFXUtilities.runInFX(this::loadingVersions); - }); - if (profile.getRepository().isLoaded()) - loadVersions(profile.getRepository()); - else - profile.getRepository().refreshVersionsAsync().start(); - } - - private String modifyVersion(String gameVersion, String version) { - return removeSuffix(removePrefix(removeSuffix(removePrefix(version.replace(gameVersion, "").trim(), "-"), "-"), "_"), "_"); - } - - private Node buildNode(HMCLGameRepository repository, Version version, Callable gameCallable) { - Profile profile = repository.getProfile(); - String id = version.getId(); - VersionItem item = new VersionItem(); - item.setUpdate(repository.isModpack(id)); - Task.ofResult("game", gameCallable).subscribe(Schedulers.javafx(), vars -> { - String game = vars.get("game"); - item.setGameVersion(game); - - StringBuilder libraries = new StringBuilder(); - LibraryAnalyzer analyzer = LibraryAnalyzer.analyze(version); - analyzer.getForge().ifPresent(library -> libraries.append(i18n("install.installer.forge")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)forge", ""))).append("\n")); - analyzer.getLiteLoader().ifPresent(library -> libraries.append(i18n("install.installer.liteloader")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)liteloader", ""))).append("\n")); - analyzer.getOptiFine().ifPresent(library -> libraries.append(i18n("install.installer.optifine")).append(": ").append(modifyVersion(game, library.getVersion().replaceAll("(?i)optifine", ""))).append("\n")); - - item.setLibraries(libraries.toString()); - }); - item.setVersionName(id); - item.setOnLaunchButtonClicked(e -> Versions.launch(profile, id)); - item.setOnScriptButtonClicked(e -> Versions.generateLaunchScript(profile, id)); - item.setOnSettingsButtonClicked(e -> { - Controllers.getVersionPage().load(id, profile); - Controllers.navigate(Controllers.getVersionPage()); - }); - item.setOnUpdateButtonClicked(event -> { - FileChooser chooser = new FileChooser(); - chooser.setTitle(i18n("modpack.choose")); - chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(i18n("modpack"), "*.zip")); - File selectedFile = chooser.showOpenDialog(Controllers.getStage()); - if (selectedFile != null) { - AtomicReference region = new AtomicReference<>(); - try { - TaskExecutor executor = ModpackHelper.getUpdateTask(profile, selectedFile, id, ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(id))) - .then(Task.of(Schedulers.javafx(), () -> region.get().fireEvent(new DialogCloseEvent()))).executor(); - region.set(Controllers.taskDialog(executor, i18n("modpack.update"), "")); - executor.start(); - } catch (UnsupportedModpackException e) { - region.get().fireEvent(new DialogCloseEvent()); - Controllers.dialog(i18n("modpack.unsupported"), i18n("message.error"), MessageBox.ERROR_MESSAGE); - } catch (MismatchedModpackTypeException e) { - region.get().fireEvent(new DialogCloseEvent()); - Controllers.dialog(i18n("modpack.mismatched_type"), i18n("message.error"), MessageBox.ERROR_MESSAGE); - } catch (IOException e) { - region.get().fireEvent(new DialogCloseEvent()); - Controllers.dialog(i18n("modpack.invalid"), i18n("message.error"), MessageBox.ERROR_MESSAGE); - } - } - }); - item.setOnMouseClicked(event -> { - if (event.getButton() == MouseButton.SECONDARY) { - JFXListView versionList = new JFXListView<>(); - JFXPopup versionPopup = new JFXPopup(versionList); - versionList.getStyleClass().add("option-list-view"); - FXUtils.setLimitWidth(versionList, 150); - versionList.getItems().setAll(Lang.immutableListOf( - i18n("version.manage.rename"), - i18n("version.manage.remove"), - i18n("modpack.export"), - i18n("folder.game") - )); - versionList.setOnMouseClicked(e -> { - versionPopup.hide(); - switch (versionList.getSelectionModel().getSelectedIndex()) { - case 0: - Versions.renameVersion(profile, id); - break; - case 1: - Versions.deleteVersion(profile, id); - break; - case 2: - Versions.exportVersion(profile, id); - break; - case 3: - FXUtils.openFolder(repository.getRunDirectory(id)); - break; - default: - break; - } - }); - versionPopup.show(item, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, event.getX(), event.getY()); - } else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) { - Versions.launch(profile, id); - } - }); - File iconFile = repository.getVersionIcon(id); - if (iconFile.exists()) - item.setImage(new Image("file:" + iconFile.getAbsolutePath())); - return item; - } - - private void loadingVersions() { - getChildren().setAll(spinner); - masonryPane.getChildren().clear(); - } - - private void loadVersions(HMCLGameRepository repository) { - List children = repository.getVersions().parallelStream() - .filter(version -> !version.isHidden()) - .sorted((a, b) -> VersionNumber.COMPARATOR.compare(VersionNumber.asVersion(a.getId()), VersionNumber.asVersion(b.getId()))) - .map(version -> buildNode(repository, version, () -> GameVersion.minecraftVersion(repository.getVersionJar(version.getId())).orElse("Unknown"))) - .collect(Collectors.toList()); - JFXUtilities.runInFX(() -> { - if (profile == repository.getProfile()) { - masonryPane.getChildren().setAll(children); - getChildren().setAll(contentPane); - } - }); - } -} diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java index b8658424b..bcf8dbbbd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java @@ -28,11 +28,9 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import org.jackhuang.hmcl.event.EventBus; import org.jackhuang.hmcl.event.RefreshedVersionsEvent; -import org.jackhuang.hmcl.event.RefreshingVersionsEvent; import org.jackhuang.hmcl.game.HMCLGameRepository; import org.jackhuang.hmcl.setting.ConfigHolder; import org.jackhuang.hmcl.setting.Profile; @@ -69,16 +67,10 @@ public final class MainPage extends StackPane implements DecoratorPage { { FXUtils.loadFXML(this, "/assets/fxml/main.fxml"); - FXUtils.onChangeAndOperate(ConfigHolder.config().enableMainPageGameListProperty(), newValue -> { - if (newValue) - getChildren().setAll(new GameVersionListPage()); - else - getChildren().setAll(main); - }); - btnLaunch.setClip(new Rectangle(-100, -100, 280, 200)); btnMenu.setClip(new Rectangle(181, -100, 100, 200)); menu.setMinWidth(200); + menu.getStyleClass().setAll("menu"); StackPane graphic = new StackPane(); Node svg = SVG.triangle(Theme.whiteFillBinding(), 10, 10); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java index c6530c7f5..9e0068b6a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java @@ -154,4 +154,8 @@ public final class SVG { public static Node triangle(ObjectBinding fill, double width, double height) { return createSVGPath("M1,21H23L12,2", fill, width, height); } + + public static Node home(ObjectBinding fill, double width, double height) { + return createSVGPath("M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z", fill, width, height); + } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java index 6d61847ac..f7a935e91 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java @@ -64,8 +64,6 @@ public final class SettingsPage extends SettingsView implements DecoratorPage { selectedItemPropertyFor(cboDownloadSource).bindBidirectional(config().downloadTypeProperty()); // ==== - chkEnableGameList.selectedProperty().bindBidirectional(config().enableMainPageGameListProperty()); - cboFont.initValue(Settings.instance().getFont()); cboFont.valueProperty().addListener((a, b, newValue) -> { Font font = Font.font(newValue, Settings.instance().getFont().getSize()); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsView.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsView.java index d233fcbec..dfe2a5231 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsView.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsView.java @@ -64,7 +64,6 @@ public abstract class SettingsView extends StackPane { protected final JFXCheckBox chkProxyAuthentication; protected final GridPane authPane; protected final Pane proxyPane; - protected final JFXToggleButton chkEnableGameList; public SettingsView() { scroll = new ScrollPane(); @@ -165,23 +164,6 @@ public abstract class SettingsView extends StackPane { settingsPane.getContent().add(backgroundItem); } - { - BorderPane borderPane = new BorderPane(); - - Label left = new Label(i18n("settings.launcher.enable_game_list")); - BorderPane.setAlignment(left, Pos.CENTER_LEFT); - borderPane.setLeft(left); - - chkEnableGameList = new JFXToggleButton(); - chkEnableGameList.setSize(8); - FXUtils.setLimitHeight(chkEnableGameList, 20); - borderPane.setRight(chkEnableGameList); - - // Do not uncomment this line, - // since option for user to enable game list in main page is unnecessary - // settingsPane.addChildren(borderPane); - } - { BorderPane downloadSourcePane = new BorderPane(); { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java deleted file mode 100644 index 11d9897f9..000000000 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Hello Minecraft! Launcher. - * Copyright (C) 2018 huangyuhui - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see {http://www.gnu.org/licenses/}. - */ -package org.jackhuang.hmcl.ui; - -import com.jfoenix.concurrency.JFXUtilities; -import com.jfoenix.controls.JFXButton; -import javafx.beans.binding.Bindings; -import javafx.event.EventHandler; -import javafx.fxml.FXML; -import javafx.geometry.Insets; -import javafx.geometry.Pos; -import javafx.scene.control.Label; -import javafx.scene.effect.BlurType; -import javafx.scene.effect.DropShadow; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.input.MouseButton; -import javafx.scene.input.MouseEvent; -import javafx.scene.layout.*; -import javafx.scene.paint.Color; -import javafx.scene.text.TextAlignment; -import org.jackhuang.hmcl.setting.Theme; - -import java.util.Optional; - -import static org.jackhuang.hmcl.util.i18n.I18n.i18n; - -public final class VersionItem extends StackPane { - @FXML - private Pane icon; - @FXML - private VBox content; - @FXML - private StackPane header; - @FXML - private StackPane body; - @FXML - private JFXButton btnSettings; - @FXML - private JFXButton btnUpdate; - @FXML - private JFXButton btnLaunch; - @FXML - private JFXButton btnScript; - @FXML - private Label lblVersionName; - @FXML - private Label lblGameVersion; - @FXML - private Label lblLibraries; - @FXML - private ImageView iconView; - - private EventHandler launchClickedHandler = null; - - private void initializeComponents() { - setPickOnBounds(false); - FXUtils.setLimitWidth(this, 160); - FXUtils.setLimitHeight(this, 149); - - content = new VBox(); - { - header = new StackPane(); - VBox.setVgrow(header, Priority.ALWAYS); - header.setPickOnBounds(false); - header.setPadding(new Insets(8)); - header.setStyle("-fx-background-radius: 2 2 0 0; -fx-background-color: rgb(255,255,255,0.87);"); - { - VBox headerContent = new VBox(); - headerContent.setPadding(new Insets(8, 8, 0, 8)); - { - lblVersionName = new Label(); - lblVersionName.setStyle("-fx-font-size: 15;"); - lblVersionName.setTextAlignment(TextAlignment.JUSTIFY); - lblVersionName.setWrapText(true); - headerContent.getChildren().add(lblVersionName); - - lblGameVersion = new Label(); - lblGameVersion.setStyle("-fx-font-size: 11;"); - lblGameVersion.setTextAlignment(TextAlignment.JUSTIFY); - lblGameVersion.setWrapText(true); - headerContent.getChildren().add(lblGameVersion); - - lblLibraries = new Label(); - lblLibraries.setStyle("-fx-font-size: 10; -fx-text-fill: gray;"); - lblLibraries.setTextAlignment(TextAlignment.JUSTIFY); - lblLibraries.setWrapText(true); - headerContent.getChildren().add(lblLibraries); - } - header.getChildren().add(headerContent); - } - content.getChildren().add(header); - - body = new StackPane(); - body.setStyle("-fx-background-radius: 0 0 2 2; -fx-background-color: rgb(255,255,255,0.87); -fx-padding: 8;"); - body.setMinHeight(40); - body.setPickOnBounds(false); - { - BorderPane bodyContent = new BorderPane(); - { - HBox hbox = new HBox(); - hbox.setSpacing(8); - { - btnSettings = new JFXButton(); - btnSettings.getStyleClass().add("toggle-icon4"); - FXUtils.setLimitWidth(btnSettings, 30); - FXUtils.setLimitHeight(btnSettings, 30); - hbox.getChildren().add(btnSettings); - - btnUpdate = new JFXButton(); - btnUpdate.getStyleClass().add("toggle-icon4"); - FXUtils.setLimitWidth(btnUpdate, 30); - FXUtils.setLimitHeight(btnUpdate, 30); - hbox.getChildren().add(btnUpdate); - } - bodyContent.setLeft(hbox); - } - { - HBox hbox = new HBox(); - hbox.setSpacing(8); - { - btnScript = new JFXButton(); - btnScript.getStyleClass().add("toggle-icon4"); - FXUtils.setLimitWidth(btnScript, 30); - FXUtils.setLimitHeight(btnScript, 30); - hbox.getChildren().add(btnScript); - - btnLaunch = new JFXButton(); - btnLaunch.getStyleClass().add("toggle-icon4"); - FXUtils.setLimitWidth(btnLaunch, 30); - FXUtils.setLimitHeight(btnLaunch, 30); - hbox.getChildren().add(btnLaunch); - } - bodyContent.setRight(hbox); - } - body.getChildren().setAll(bodyContent); - } - content.getChildren().add(body); - } - getChildren().add(content); - - icon = new StackPane(); - StackPane.setAlignment(icon, Pos.TOP_RIGHT); - icon.setPickOnBounds(false); - { - iconView = new ImageView(); - StackPane.setAlignment(iconView, Pos.CENTER_RIGHT); - StackPane.setMargin(iconView, new Insets(0, 12, 0, 0)); - iconView.setImage(new Image("/assets/img/icon.png")); - icon.getChildren().add(iconView); - } - getChildren().add(icon); - } - - public VersionItem() { - initializeComponents(); - setEffect(new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.26), 5.0, 0.12, -1.0, 1.0)); - btnSettings.setGraphic(SVG.gear(Theme.blackFillBinding(), 15, 15)); - btnUpdate.setGraphic(SVG.update(Theme.blackFillBinding(), 15, 15)); - btnLaunch.setGraphic(SVG.launch(Theme.blackFillBinding(), 15, 15)); - btnScript.setGraphic(SVG.script(Theme.blackFillBinding(), 15, 15)); - - JFXUtilities.runInFX(() -> { - FXUtils.installTooltip(btnSettings, i18n("version.settings")); - FXUtils.installTooltip(btnUpdate, i18n("version.update")); - FXUtils.installTooltip(btnLaunch, i18n("version.launch")); - FXUtils.installTooltip(btnScript, i18n("version.launch_script")); - }); - - icon.translateYProperty().bind(Bindings.createDoubleBinding(() -> header.getBoundsInParent().getHeight() - icon.getHeight() / 2 - 16, header.boundsInParentProperty(), icon.heightProperty())); - FXUtils.limitSize(iconView, 32, 32); - - setOnMouseClicked(e -> { - if (e.getButton() == MouseButton.PRIMARY) - if (e.getClickCount() == 2) - Optional.ofNullable(launchClickedHandler).ifPresent(h -> h.handle(e)); - }); - } - - public void setUpdate(boolean update) { - btnUpdate.setVisible(update); - } - - public void setVersionName(String versionName) { - lblVersionName.setText(versionName); - } - - public void setGameVersion(String gameVersion) { - lblGameVersion.setText(gameVersion); - } - - public void setLibraries(String libraries) { - lblLibraries.setText(libraries); - } - - public void setImage(Image image) { - iconView.setImage(image); - } - - public void setOnSettingsButtonClicked(EventHandler handler) { - btnSettings.setOnMouseClicked(handler); - } - - public void setOnScriptButtonClicked(EventHandler handler) { - btnScript.setOnMouseClicked(handler); - } - - public void setOnLaunchButtonClicked(EventHandler handler) { - launchClickedHandler = handler; - btnLaunch.setOnMouseClicked(handler); - } - - public void setOnUpdateButtonClicked(EventHandler handler) { - btnUpdate.setOnMouseClicked(handler); - } -} diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MenuSeparator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MenuSeparator.java new file mode 100644 index 000000000..a747fc368 --- /dev/null +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MenuSeparator.java @@ -0,0 +1,19 @@ +package org.jackhuang.hmcl.ui.construct; + +import javafx.geometry.Insets; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Rectangle; + +public class MenuSeparator extends StackPane { + + public MenuSeparator() { + Rectangle rect = new Rectangle(); + rect.widthProperty().bind(widthProperty().add(-14)); + rect.setHeight(1); + rect.setFill(Color.GRAY); + maxHeightProperty().set(10); + setPadding(new Insets(3)); + getChildren().setAll(rect); + } +} diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Navigator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Navigator.java index f499bb191..bc37b9602 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Navigator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Navigator.java @@ -17,6 +17,7 @@ */ package org.jackhuang.hmcl.ui.construct; +import javafx.application.Platform; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyBooleanWrapper; import javafx.beans.property.SimpleObjectProperty; @@ -43,6 +44,9 @@ public class Navigator extends StackPane { public Navigator(Node init) { stack.push(init); getChildren().setAll(init); + + Platform.runLater(() -> + fireEvent(new NavigationEvent(this, init, NavigationEvent.NAVIGATED))); } public void navigate(Node node) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorControl.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorControl.java index 6725fe552..fedea6f00 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorControl.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorControl.java @@ -45,6 +45,7 @@ public class DecoratorControl extends Control { private final BooleanProperty canRefresh = new SimpleBooleanProperty(false); private final BooleanProperty canBack = new SimpleBooleanProperty(false); private final BooleanProperty canClose = new SimpleBooleanProperty(false); + private final BooleanProperty showCloseAsHome = new SimpleBooleanProperty(false); private final Stage primaryStage; private StackPane drawerWrapper; @@ -174,6 +175,10 @@ public class DecoratorControl extends Control { return canClose; } + public BooleanProperty showCloseAsHomeProperty() { + return showCloseAsHome; + } + public ObjectProperty> onBackNavButtonActionProperty() { return onBackNavButtonAction; } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorController.java index 3e6040972..8b44072ad 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorController.java @@ -251,9 +251,11 @@ public class DecoratorController { if (to instanceof DecoratorPage) { decorator.drawerTitleProperty().bind(((DecoratorPage) to).titleProperty()); + decorator.showCloseAsHomeProperty().set(!((DecoratorPage) to).canForceToClose()); } else { decorator.drawerTitleProperty().unbind(); decorator.drawerTitleProperty().set(""); + decorator.showCloseAsHomeProperty().set(true); } decorator.canBackProperty().set(navigator.canGoBack()); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java index 317332d2c..5bafbb4af 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java @@ -201,6 +201,13 @@ public class DecoratorSkin extends SkinBase { if (newValue) navLeft.getChildren().setAll(backNavButton, closeNavButton); else navLeft.getChildren().setAll(backNavButton); }); + + skinnable.showCloseAsHomeProperty().addListener((a, b, newValue) -> { + if (newValue) + closeNavButton.setGraphic(SVG.home(Theme.foregroundFillBinding(), -1, -1)); + else + closeNavButton.setGraphic(SVG.close(Theme.foregroundFillBinding(), -1, -1)); + }); } navBar.setLeft(navLeft); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java index 916581e41..6ad6eb59b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java @@ -19,12 +19,10 @@ package org.jackhuang.hmcl.ui.versions; import com.jfoenix.concurrency.JFXUtilities; import com.jfoenix.controls.JFXButton; -import com.jfoenix.controls.JFXListView; import com.jfoenix.controls.JFXPopup; import com.jfoenix.controls.JFXRadioButton; import com.jfoenix.effects.JFXDepthManager; import javafx.geometry.Pos; -import javafx.scene.Node; import javafx.scene.control.SkinBase; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; @@ -34,13 +32,10 @@ import javafx.scene.layout.VBox; import org.jackhuang.hmcl.setting.Theme; import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.ui.SVG; -import org.jackhuang.hmcl.ui.construct.IconedItem; import org.jackhuang.hmcl.ui.construct.IconedMenuItem; +import org.jackhuang.hmcl.ui.construct.MenuSeparator; import org.jackhuang.hmcl.ui.construct.TwoLineListItem; -import java.util.function.Consumer; -import java.util.function.Function; - import static org.jackhuang.hmcl.util.i18n.I18n.i18n; public class GameListItemSkin extends SkinBase { @@ -76,29 +71,20 @@ public class GameListItemSkin extends SkinBase { root.setCenter(center); VBox menu = new VBox(); + menu.getStyleClass().setAll("menu"); JFXPopup popup = new JFXPopup(menu); - Function wrap = r -> () -> { - r.run(); - popup.hide(); - }; - - Function limitWidth = node -> { - StackPane pane = new StackPane(node); - pane.setAlignment(Pos.CENTER); - FXUtils.setLimitWidth(pane, 14); - FXUtils.setLimitHeight(pane, 14); - return pane; - }; - menu.getChildren().setAll( - new IconedMenuItem(limitWidth.apply(SVG.gear(Theme.blackFillBinding(), 14, 14)), i18n("version.manage.manage"), wrap.apply(skinnable::modifyGameSettings)), - new IconedMenuItem(limitWidth.apply(SVG.pencil(Theme.blackFillBinding(), 14, 14)), i18n("version.manage.rename"), wrap.apply(skinnable::rename)), - new IconedMenuItem(limitWidth.apply(SVG.delete(Theme.blackFillBinding(), 14, 14)), i18n("version.manage.remove"), wrap.apply(skinnable::remove)), - new IconedMenuItem(limitWidth.apply(SVG.export(Theme.blackFillBinding(), 14, 14)), i18n("modpack.export"), wrap.apply(skinnable::export)), - new IconedMenuItem(limitWidth.apply(SVG.folderOpen(Theme.blackFillBinding(), 14, 14)), i18n("folder.game"), wrap.apply(skinnable::browse)), - new IconedMenuItem(limitWidth.apply(SVG.launch(Theme.blackFillBinding(), 14, 14)), i18n("version.launch"), wrap.apply(skinnable::launch)), - new IconedMenuItem(limitWidth.apply(SVG.script(Theme.blackFillBinding(), 14, 14)), i18n("version.launch_script"), wrap.apply(skinnable::generateLaunchScript))); + new IconedMenuItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("version.manage.manage"), FXUtils.withJFXPopupClosing(skinnable::modifyGameSettings, popup)), + new MenuSeparator(), + new IconedMenuItem(FXUtils.limitingSize(SVG.pencil(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("version.manage.rename"), FXUtils.withJFXPopupClosing(skinnable::rename, popup)), + new IconedMenuItem(FXUtils.limitingSize(SVG.delete(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("version.manage.remove"), FXUtils.withJFXPopupClosing(skinnable::remove, popup)), + new IconedMenuItem(FXUtils.limitingSize(SVG.export(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("modpack.export"), FXUtils.withJFXPopupClosing(skinnable::export, popup)), + new MenuSeparator(), + new IconedMenuItem(FXUtils.limitingSize(SVG.folderOpen(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("folder.game"), FXUtils.withJFXPopupClosing(skinnable::browse, popup)), + new MenuSeparator(), + new IconedMenuItem(FXUtils.limitingSize(SVG.launch(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("version.launch"), FXUtils.withJFXPopupClosing(skinnable::launch, popup)), + new IconedMenuItem(FXUtils.limitingSize(SVG.script(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("version.launch_script"), FXUtils.withJFXPopupClosing(skinnable::generateLaunchScript, popup))); HBox right = new HBox(); right.setAlignment(Pos.CENTER_RIGHT); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java index 612d01bef..967bed484 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java @@ -18,7 +18,6 @@ package org.jackhuang.hmcl.ui.versions; import com.jfoenix.controls.JFXButton; -import com.jfoenix.controls.JFXListView; import com.jfoenix.controls.JFXPopup; import com.jfoenix.controls.JFXTabPane; import javafx.beans.property.ReadOnlyStringProperty; @@ -26,9 +25,11 @@ import javafx.beans.property.ReadOnlyStringWrapper; import javafx.fxml.FXML; import javafx.scene.control.Tab; import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask; import org.jackhuang.hmcl.setting.Profile; import org.jackhuang.hmcl.ui.FXUtils; +import org.jackhuang.hmcl.ui.construct.IconedMenuItem; import org.jackhuang.hmcl.ui.decorator.DecoratorPage; import org.jackhuang.hmcl.util.FileUtils; @@ -50,10 +51,6 @@ public final class VersionPage extends StackPane implements DecoratorPage { @FXML private WorldListPage world; @FXML - private JFXListView browseList; - @FXML - private JFXListView managementList; - @FXML private JFXButton btnBrowseMenu; @FXML private JFXButton btnDelete; @@ -77,10 +74,27 @@ public final class VersionPage extends StackPane implements DecoratorPage { { FXUtils.loadFXML(this, "/assets/fxml/version/version.fxml"); - getChildren().removeAll(browseList, managementList); - + VBox browseList = new VBox(); + browseList.getStyleClass().setAll("menu"); browsePopup = new JFXPopup(browseList); + browseList.getChildren().setAll( + new IconedMenuItem(null, i18n("folder.game"), FXUtils.withJFXPopupClosing(() -> onBrowse(""), browsePopup)), + new IconedMenuItem(null, i18n("folder.mod"), FXUtils.withJFXPopupClosing(() -> onBrowse("mods"), browsePopup)), + new IconedMenuItem(null, i18n("folder.config"), FXUtils.withJFXPopupClosing(() -> onBrowse("config"), browsePopup)), + new IconedMenuItem(null, i18n("folder.resourcepacks"), FXUtils.withJFXPopupClosing(() -> onBrowse("resourcepacks"), browsePopup)), + new IconedMenuItem(null, i18n("folder.screenshots"), FXUtils.withJFXPopupClosing(() -> onBrowse("screenshots"), browsePopup)), + new IconedMenuItem(null, i18n("folder.saves"), FXUtils.withJFXPopupClosing(() -> onBrowse("resourcepacks"), browsePopup)) + ); + + VBox managementList = new VBox(); + managementList.getStyleClass().setAll("menu"); managementPopup = new JFXPopup(managementList); + managementList.getChildren().setAll( + new IconedMenuItem(null, i18n("version.manage.rename"), FXUtils.withJFXPopupClosing(() -> Versions.renameVersion(profile, version), managementPopup)), + new IconedMenuItem(null, i18n("version.manage.remove"), FXUtils.withJFXPopupClosing(() -> Versions.deleteVersion(profile, version), managementPopup)), + new IconedMenuItem(null, i18n("version.manage.redownload_assets_index"), FXUtils.withJFXPopupClosing(() -> new GameAssetIndexDownloadTask(profile.getDependency(), profile.getRepository().getResolvedVersion(version)).start(), managementPopup)), + new IconedMenuItem(null, i18n("version.manage.remove_libraries"), FXUtils.withJFXPopupClosing(() -> FileUtils.deleteDirectoryQuietly(new File(profile.getRepository().getBaseDirectory(), "libraries")), managementPopup)) + ); FXUtils.installTooltip(btnDelete, i18n("version.manage.remove")); FXUtils.installTooltip(btnBrowseMenu, i18n("settings.game.exploration")); @@ -104,67 +118,18 @@ public final class VersionPage extends StackPane implements DecoratorPage { @FXML private void onBrowseMenu() { - browseList.getSelectionModel().select(-1); - browsePopup.show(btnBrowseMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15); + browsePopup.show(btnBrowseMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, 0, btnBrowseMenu.getHeight()); } @FXML private void onManagementMenu() { - managementList.getSelectionModel().select(-1); - managementPopup.show(btnManagementMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15); + managementPopup.show(btnManagementMenu, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, 0, btnManagementMenu.getHeight()); } - @FXML - private void onBrowse() { - String sub; - switch (browseList.getSelectionModel().getSelectedIndex()) { - case 0: - sub = ""; - break; - case 1: - sub = "mods"; - break; - case 2: - sub = "coremods"; - break; - case 3: - sub = "config"; - break; - case 4: - sub = "resourcepacks"; - break; - case 5: - sub = "screenshots"; - break; - case 6: - sub = "saves"; - break; - default: - return; - } + private void onBrowse(String sub) { FXUtils.openFolder(new File(profile.getRepository().getRunDirectory(version), sub)); } - @FXML - private void onManagement() { - switch (managementList.getSelectionModel().getSelectedIndex()) { - case 0: // rename a version - Versions.renameVersion(profile, version); - break; - case 1: // remove a version - Versions.deleteVersion(profile, version); - break; - case 2: // redownload asset index - new GameAssetIndexDownloadTask(profile.getDependency(), profile.getRepository().getResolvedVersion(version)).start(); - break; - case 3: // delete libraries - FileUtils.deleteDirectoryQuietly(new File(profile.getRepository().getBaseDirectory(), "libraries")); - break; - case 4: - throw new Error(); - } - } - public String getTitle() { return title.get(); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItem.java index 7d448cd5d..1273aef45 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItem.java @@ -1,6 +1,9 @@ package org.jackhuang.hmcl.ui.versions; -import javafx.beans.property.*; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.scene.control.Control; import javafx.scene.control.Skin; import javafx.scene.image.Image; @@ -12,6 +15,7 @@ import org.jackhuang.hmcl.util.IntVersionNumber; import org.jackhuang.hmcl.util.VersionNumber; import java.io.File; +import java.text.SimpleDateFormat; import java.util.Date; import static org.jackhuang.hmcl.util.i18n.I18n.i18n; @@ -21,12 +25,14 @@ public class WorldListItem extends Control { private final StringProperty subtitle = new SimpleStringProperty(); private final ObjectProperty image = new SimpleObjectProperty<>(); private final World world; + private final SimpleDateFormat simpleDateFormat; public WorldListItem(World world) { this.world = world; + this.simpleDateFormat = new SimpleDateFormat(i18n("world.time")); title.set(world.getWorldName()); - subtitle.set(i18n("world.description", world.getFileName(), new Date(world.getLastPlayed()).toString(), world.getGameVersion() == null ? i18n("message.unknown") : world.getGameVersion())); + subtitle.set(i18n("world.description", world.getFileName(), simpleDateFormat.format(new Date(world.getLastPlayed())), world.getGameVersion() == null ? i18n("message.unknown") : world.getGameVersion())); } @Override diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItemSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItemSkin.java index ee37c025d..96edc0efd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItemSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListItemSkin.java @@ -4,7 +4,6 @@ import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXPopup; import com.jfoenix.effects.JFXDepthManager; import javafx.geometry.Pos; -import javafx.scene.Node; import javafx.scene.control.SkinBase; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; @@ -17,8 +16,6 @@ import org.jackhuang.hmcl.ui.SVG; import org.jackhuang.hmcl.ui.construct.IconedMenuItem; import org.jackhuang.hmcl.ui.construct.TwoLineListItem; -import java.util.function.Function; - import static org.jackhuang.hmcl.util.i18n.I18n.i18n; public class WorldListItemSkin extends SkinBase { @@ -47,24 +44,12 @@ public class WorldListItemSkin extends SkinBase { root.setCenter(center); VBox menu = new VBox(); + menu.getStyleClass().setAll("menu"); JFXPopup popup = new JFXPopup(menu); - Function wrap = r -> () -> { - r.run(); - popup.hide(); - }; - - Function limitWidth = node -> { - StackPane pane = new StackPane(node); - pane.setAlignment(Pos.CENTER); - FXUtils.setLimitWidth(pane, 14); - FXUtils.setLimitHeight(pane, 14); - return pane; - }; - menu.getChildren().setAll( - new IconedMenuItem(limitWidth.apply(SVG.gear(Theme.blackFillBinding(), 14, 14)), i18n("world.datapack"), wrap.apply(skinnable::manageDatapacks)), - new IconedMenuItem(limitWidth.apply(SVG.export(Theme.blackFillBinding(), 14, 14)), i18n("world.export"), wrap.apply(skinnable::export))); + new IconedMenuItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("world.datapack"), FXUtils.withJFXPopupClosing(skinnable::manageDatapacks, popup)), + new IconedMenuItem(FXUtils.limitingSize(SVG.export(Theme.blackFillBinding(), 14, 14), 14, 14), i18n("world.export"), FXUtils.withJFXPopupClosing(skinnable::export, popup))); HBox right = new HBox(); right.setAlignment(Pos.CENTER_RIGHT); diff --git a/HMCL/src/main/resources/assets/css/root.css b/HMCL/src/main/resources/assets/css/root.css index 83fad8c6d..3c99506aa 100644 --- a/HMCL/src/main/resources/assets/css/root.css +++ b/HMCL/src/main/resources/assets/css/root.css @@ -59,6 +59,10 @@ -fx-padding: 20 0 20 0; } +.iconed-item { + -jfx-rippler-fill: -fx-base-color; +} + .iconed-item .iconed-item-container { -fx-padding: 10 16 10 16; -fx-spacing: 10; @@ -66,13 +70,21 @@ -fx-alignment: CENTER_LEFT; } +.iconed-menu-item { + -jfx-rippler-fill: -fx-base-color; +} + .iconed-menu-item .iconed-item-container { - -fx-padding: 10 16 10 16; + -fx-padding: 8 16 8 16; -fx-spacing: 10; -fx-font-size: 12; -fx-alignment: CENTER_LEFT; } +.menu { + -fx-padding: 4 0 4 0; +} + /******************************************************************************* * * * JFX Tab Pane * @@ -181,7 +193,6 @@ .jfx-popup-container { -fx-background-color: WHITE; - -fx-pref-width: 151.0px; } .popup-list-view { @@ -309,6 +320,7 @@ } .jfx-tool-bar-second { + -fx-pref-height: 42; -fx-padding: 2 2 2 2; -fx-background-color: -fx-base-check-color; } @@ -318,7 +330,7 @@ } .jfx-tool-bar-button { - -fx-toggle-icon4-size: 35px; + -fx-toggle-icon4-size: 37px; -fx-pref-height: -fx-toggle-icon4-size; -fx-max-height: -fx-toggle-icon4-size; -fx-min-height: -fx-toggle-icon4-size; diff --git a/HMCL/src/main/resources/assets/fxml/version/version.fxml b/HMCL/src/main/resources/assets/fxml/version/version.fxml index 45f7d7d12..50f35d22e 100644 --- a/HMCL/src/main/resources/assets/fxml/version/version.fxml +++ b/HMCL/src/main/resources/assets/fxml/version/version.fxml @@ -29,7 +29,7 @@ - + @@ -44,23 +44,4 @@ - - - - - - diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index cd3f49d7b..5fe05ee53 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -23,7 +23,7 @@ about.thanks_to=Thanks to about.thanks_to.statement=bangbang93 (BMCLAPI, https://bmclapi2.bangbang93.com/)\ngamerteam (Default background image)\nAll contributors who participated in this project via issues, pull requests, etc. about.dependency=Dependencies # Due to space limitations, only first authors are listed -about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner(jenkins-ci, CDDL, GPL 2) +about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner (jenkins-ci, CDDL, GPL 2)\nOpenNBT (Steveice10, BSD 3-Clause) about.claim=Statement about.claim.statement=Minecraft is copyrighted by Mojang AB. We are not responsible for any copyright infringement arising from the use of this software. about.open_source=Open Source @@ -102,10 +102,9 @@ fatal.migration_requires_manual_reboot=The upgrade is about to be completed. Ple fatal.apply_update_failure=We're sorry that HMCL couldn't finish the upgrade because something went wrong.\nBut you can still manually finish the upgrade by downloading HMCL from %s.\nPlease consider reporting this issue to us. folder.config=Configs -folder.coremod=Core Mod -folder.game=Game Dir +folder.game=Game Directory folder.mod=Mod -folder.resourcepacks=Resourcepacks +folder.resourcepacks=Resource packs folder.saves=Saves folder.screenshots=Screenshots @@ -266,6 +265,7 @@ world.import.choose=Choose the save zip to be imported world.import.failed=Unable to import this world: %s world.name=World Name world.name.enter=Enter the world name +world.time=EEE, MMM d, yyyy HH:mm:ss profile=Game Directories profile.default=Current directory @@ -370,7 +370,7 @@ version.launch_script.failed=Unable to make launch script. version.launch_script.save=Save the launch script version.launch_script.success=Finished script creation, %s. version.manage=Game List -version.manage.manage=Game Management +version.manage.manage=Manage Game version.manage.redownload_assets_index=Redownload Assets Index version.manage.remove=Delete this game version.manage.remove.confirm=Sure to remove game %s? You cannot restore this game again! diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index a130ce130..7aab875fc 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -23,7 +23,7 @@ about.thanks_to=鳴謝 about.thanks_to.statement=bangbang93 (BMCLAPI, https://bmclapi2.bangbang93.com/)\ngamerteam (預設背景圖)\n所有通過 Issues、Pull Requests 等方式參與本項目的貢獻者 about.dependency=依賴 # 由於篇幅限制,僅列出第一作者 -about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner(jenkins-ci, CDDL, GPL 2) +about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner (jenkins-ci, CDDL, GPL 2)\nOpenNBT (Steveice10, BSD 3-Clause) about.claim=免責聲明 about.claim.statement=Minecraft 版權歸 Mojang AB 所有,使用本軟體產生的版權問題,軟體製作方概不負責。請支援正版。 about.open_source=開源 @@ -102,7 +102,6 @@ fatal.migration_requires_manual_reboot=HMCL 即將升級完成,請重新打開 fatal.apply_update_failure=我們很抱歉 HMCL 無法自動完成升級程序,因為出現了一些問題。\n但你依然可以從 %s 處手動下載 HMCL 來完成升級。\n請考慮向我們回報該問題。 folder.config=設定資料夾 -folder.coremod=核心 MOD 模組資料夾 folder.game=遊戲資料夾 folder.mod=MOD 模組資料夾 folder.resourcepacks=資源包資料夾 @@ -266,10 +265,11 @@ world.import.failed=無法導入此世界: %s world.game_version=遊戲版本 world.name=世界名稱 world.name.enter=輸入世界名稱 +world.time=yyyy 年 MM 月 dd 日 HH:mm:ss profile=遊戲目錄 profile.default=目前目錄 -profile.home=主資料夾 +profile.home=官方啟動器目錄 profile.instance_directory=遊戲路徑 profile.instance_directory.choose=選擇遊戲路徑 profile.manage=遊戲目錄列表 @@ -371,7 +371,7 @@ version.launch_script.save=儲存啟動腳本 version.launch_script.success=啟動腳本已生成完畢:%s version.manage=遊戲列表 version.manage.manage=游戏管理 -version.manage.redownload_assets_index=重新下載資源設定(assets_index.json) +version.manage.redownload_assets_index=更新資源列表 version.manage.remove=刪除該版本 version.manage.remove.confirm=真的要刪除版本 %s 嗎?你將無法找回被刪除的檔案! version.manage.remove.confirm.trash=真的要刪除版本 %s 嗎?你可以在系統的資源回收桶 (或垃圾桶) 中還原資料夾 %s 來找回該版本。 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 2dfdc0306..12cccf98d 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -23,7 +23,7 @@ about.thanks_to=鸣谢 about.thanks_to.statement=bangbang93 (BMCLAPI, https://bmclapi2.bangbang93.com/)\ngamerteam (默认背景图)\n所有通过 Issues、Pull Requests 等方式参与本项目的贡献者 about.dependency=依赖 # 由于篇幅限制,仅列出第一作者 -about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner(jenkins-ci, CDDL, GPL 2) +about.dependency.statement=JFoenix (Shadi Shaheen, Apache 2.0)\nGson (Google, Apache 2.0)\nApache Commons Compress (ASF, Apache 2.0)\nXZ for Java (Lasse Collin, Public Domain)\nfx-gson (Joffrey Bion, MIT)\nConstant Pool Scanner (jenkins-ci, CDDL, GPL 2)\nOpenNBT (Steveice10, BSD 3-Clause) about.claim=免责声明 about.claim.statement=Minecraft 版权归 Mojang AB 所有,使用本软件产生的版权问题,软件制作方概不负责。请支持正版。 about.open_source=开源 @@ -102,7 +102,6 @@ fatal.migration_requires_manual_reboot=HMCL 即将完成升级,请重新打开 fatal.apply_update_failure=我们很抱歉 HMCL 无法自动完成升级,因为出现了一些问题。\n但你依然可以从 %s 处手动下载 HMCL 来完成升级。\n请考虑向我们反馈该问题。 folder.config=配置文件夹 -folder.coremod=核心 MOD 文件夹 folder.game=游戏文件夹 folder.mod=MOD文件夹 folder.resourcepacks=资源包文件夹 @@ -266,10 +265,11 @@ world.import.choose=选择要导入的存档压缩包 world.import.failed=无法导入此世界:%s world.name=世界名称 world.name.enter=输入世界名称 +world.time=yyyy 年 MM 月 dd 日 HH:mm:ss profile=游戏目录 profile.default=当前目录 -profile.home=主文件夹 +profile.home=官方启动器目录 profile.instance_directory=游戏路径 profile.instance_directory.choose=选择游戏路径 profile.manage=游戏目录列表 @@ -371,7 +371,7 @@ version.launch_script.save=保存启动脚本 version.launch_script.success=启动脚本已生成完毕:%s version.manage=游戏列表 version.manage.manage=游戏管理 -version.manage.redownload_assets_index=重新下载资源配置(assets_index.json) +version.manage.redownload_assets_index=更新资源列表 version.manage.remove=删除该版本 version.manage.remove.confirm=真的要删除版本 %s 吗?你将无法找回被删除的文件! version.manage.remove.confirm.trash=真的要删除版本 %s 吗?你可以在系统的回收站中恢复文件夹 %s 来找回该版本。 diff --git a/HMCL/src/main/resources/assets/svg/delete-black.fxml b/HMCL/src/main/resources/assets/svg/delete-black.fxml deleted file mode 100644 index 954d8e7e2..000000000 --- a/HMCL/src/main/resources/assets/svg/delete-black.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/delete-white.fxml b/HMCL/src/main/resources/assets/svg/delete-white.fxml deleted file mode 100644 index 6d7341964..000000000 --- a/HMCL/src/main/resources/assets/svg/delete-white.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/dots-vertical.fxml b/HMCL/src/main/resources/assets/svg/dots-vertical.fxml deleted file mode 100644 index 1c88fe511..000000000 --- a/HMCL/src/main/resources/assets/svg/dots-vertical.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/export.fxml b/HMCL/src/main/resources/assets/svg/export.fxml deleted file mode 100644 index d96a43f9e..000000000 --- a/HMCL/src/main/resources/assets/svg/export.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/HMCL/src/main/resources/assets/svg/folder-black.fxml b/HMCL/src/main/resources/assets/svg/folder-black.fxml deleted file mode 100644 index 3452e40e0..000000000 --- a/HMCL/src/main/resources/assets/svg/folder-black.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/paper-plane.fxml b/HMCL/src/main/resources/assets/svg/paper-plane.fxml deleted file mode 100644 index 4188fdd10..000000000 --- a/HMCL/src/main/resources/assets/svg/paper-plane.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/pencil.fxml b/HMCL/src/main/resources/assets/svg/pencil.fxml deleted file mode 100644 index 7522a8fda..000000000 --- a/HMCL/src/main/resources/assets/svg/pencil.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/plus-black.fxml b/HMCL/src/main/resources/assets/svg/plus-black.fxml deleted file mode 100644 index cd301a5d3..000000000 --- a/HMCL/src/main/resources/assets/svg/plus-black.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/refresh-black.fxml b/HMCL/src/main/resources/assets/svg/refresh-black.fxml deleted file mode 100644 index 983750f10..000000000 --- a/HMCL/src/main/resources/assets/svg/refresh-black.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/HMCL/src/main/resources/assets/svg/rocket.fxml b/HMCL/src/main/resources/assets/svg/rocket.fxml deleted file mode 100644 index 915742f19..000000000 --- a/HMCL/src/main/resources/assets/svg/rocket.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/script.fxml b/HMCL/src/main/resources/assets/svg/script.fxml deleted file mode 100644 index f71133022..000000000 --- a/HMCL/src/main/resources/assets/svg/script.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/HMCL/src/main/resources/assets/svg/update.fxml b/HMCL/src/main/resources/assets/svg/update.fxml deleted file mode 100644 index 608d83a75..000000000 --- a/HMCL/src/main/resources/assets/svg/update.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/HMCL/src/main/resources/assets/svg/wrench-black.fxml b/HMCL/src/main/resources/assets/svg/wrench-black.fxml deleted file mode 100644 index b67b3af70..000000000 --- a/HMCL/src/main/resources/assets/svg/wrench-black.fxml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file