feat: download game in download page
This commit is contained in:
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui.download;
|
|||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.LibraryAnalyzer;
|
import org.jackhuang.hmcl.download.LibraryAnalyzer;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.game.GameRepository;
|
import org.jackhuang.hmcl.game.GameRepository;
|
||||||
@@ -41,7 +42,7 @@ class AdditionalInstallersPage extends InstallersPage {
|
|||||||
protected final String gameVersion;
|
protected final String gameVersion;
|
||||||
protected final Version version;
|
protected final Version version;
|
||||||
|
|
||||||
public AdditionalInstallersPage(String gameVersion, Version version, WizardController controller, HMCLGameRepository repository, InstallerWizardDownloadProvider downloadProvider) {
|
public AdditionalInstallersPage(String gameVersion, Version version, WizardController controller, HMCLGameRepository repository, DownloadProvider downloadProvider) {
|
||||||
super(controller, repository, gameVersion, downloadProvider);
|
super(controller, repository, gameVersion, downloadProvider);
|
||||||
this.gameVersion = gameVersion;
|
this.gameVersion = gameVersion;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ public class DownloadPage extends BorderPane implements DecoratorPage {
|
|||||||
item.setLeftGraphic(wrap(SVG.textureBox(null, 20, 20)));
|
item.setLeftGraphic(wrap(SVG.textureBox(null, 20, 20)));
|
||||||
item.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(resourcePackTab));
|
item.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(resourcePackTab));
|
||||||
item.setOnAction(e -> tab.getSelectionModel().select(resourcePackTab));
|
item.setOnAction(e -> tab.getSelectionModel().select(resourcePackTab));
|
||||||
|
})
|
||||||
|
.addNavigationDrawerItem(item -> {
|
||||||
|
item.setTitle(i18n("install.new_game"));
|
||||||
|
item.setLeftGraphic(wrap(SVG.gamepad(null, 20, 20)));
|
||||||
|
item.setOnAction(e -> Versions.addNewGame());
|
||||||
});
|
});
|
||||||
FXUtils.setLimitWidth(sideBar, 200);
|
FXUtils.setLimitWidth(sideBar, 200);
|
||||||
setLeft(sideBar);
|
setLeft(sideBar);
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Hello Minecraft! Launcher
|
|
||||||
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
|
|
||||||
*
|
|
||||||
* 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.jackhuang.hmcl.ui.download;
|
|
||||||
|
|
||||||
import org.jackhuang.hmcl.download.DownloadProvider;
|
|
||||||
import org.jackhuang.hmcl.download.VersionList;
|
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class InstallerWizardDownloadProvider implements DownloadProvider {
|
|
||||||
|
|
||||||
private DownloadProvider fallback;
|
|
||||||
|
|
||||||
public InstallerWizardDownloadProvider(DownloadProvider fallback) {
|
|
||||||
this.fallback = fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownloadProvider(DownloadProvider downloadProvider) {
|
|
||||||
fallback = downloadProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersionListURL() {
|
|
||||||
return fallback.getVersionListURL();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAssetBaseURL() {
|
|
||||||
return fallback.getAssetBaseURL();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<URL> getAssetObjectCandidates(String assetObjectLocation) {
|
|
||||||
return fallback.getAssetObjectCandidates(assetObjectLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String injectURL(String baseURL) {
|
|
||||||
return fallback.injectURL(baseURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<URL> injectURLWithCandidates(String baseURL) {
|
|
||||||
return fallback.injectURLWithCandidates(baseURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VersionList<?> getVersionListById(String id) {
|
|
||||||
return fallback.getVersionListById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getConcurrency() {
|
|
||||||
return fallback.getConcurrency();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,8 @@ package org.jackhuang.hmcl.ui.download;
|
|||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
import javafx.beans.property.*;
|
import javafx.beans.property.BooleanProperty;
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
@@ -30,6 +31,7 @@ import javafx.scene.control.SkinBase;
|
|||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.game.HMCLGameRepository;
|
import org.jackhuang.hmcl.game.HMCLGameRepository;
|
||||||
import org.jackhuang.hmcl.ui.InstallerItem;
|
import org.jackhuang.hmcl.ui.InstallerItem;
|
||||||
@@ -50,7 +52,7 @@ public class InstallersPage extends Control implements WizardPage {
|
|||||||
protected JFXTextField txtName = new JFXTextField();
|
protected JFXTextField txtName = new JFXTextField();
|
||||||
protected BooleanProperty installable = new SimpleBooleanProperty();
|
protected BooleanProperty installable = new SimpleBooleanProperty();
|
||||||
|
|
||||||
public InstallersPage(WizardController controller, HMCLGameRepository repository, String gameVersion, InstallerWizardDownloadProvider downloadProvider) {
|
public InstallersPage(WizardController controller, HMCLGameRepository repository, String gameVersion, DownloadProvider downloadProvider) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
|
||||||
txtName.getValidators().addAll(
|
txtName.getValidators().addAll(
|
||||||
|
|||||||
@@ -18,10 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.ui.download;
|
package org.jackhuang.hmcl.ui.download;
|
||||||
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import org.jackhuang.hmcl.download.ArtifactMalformedException;
|
import org.jackhuang.hmcl.download.*;
|
||||||
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
|
||||||
import org.jackhuang.hmcl.download.VersionMismatchException;
|
|
||||||
import org.jackhuang.hmcl.download.fabric.FabricInstallTask;
|
import org.jackhuang.hmcl.download.fabric.FabricInstallTask;
|
||||||
import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask;
|
import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask;
|
||||||
import org.jackhuang.hmcl.download.game.LibraryDownloadException;
|
import org.jackhuang.hmcl.download.game.LibraryDownloadException;
|
||||||
@@ -57,7 +54,7 @@ public final class UpdateInstallerWizardProvider implements WizardProvider {
|
|||||||
private final Version version;
|
private final Version version;
|
||||||
private final String libraryId;
|
private final String libraryId;
|
||||||
private final String oldLibraryVersion;
|
private final String oldLibraryVersion;
|
||||||
private final InstallerWizardDownloadProvider downloadProvider;
|
private final DownloadProvider downloadProvider;
|
||||||
|
|
||||||
public UpdateInstallerWizardProvider(@NotNull Profile profile, @NotNull String gameVersion, @NotNull Version version, @NotNull String libraryId, @Nullable String oldLibraryVersion) {
|
public UpdateInstallerWizardProvider(@NotNull Profile profile, @NotNull String gameVersion, @NotNull Version version, @NotNull String libraryId, @Nullable String oldLibraryVersion) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
@@ -65,7 +62,7 @@ public final class UpdateInstallerWizardProvider implements WizardProvider {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.libraryId = libraryId;
|
this.libraryId = libraryId;
|
||||||
this.oldLibraryVersion = oldLibraryVersion;
|
this.oldLibraryVersion = oldLibraryVersion;
|
||||||
this.downloadProvider = new InstallerWizardDownloadProvider(DownloadProviders.getDownloadProvider());
|
this.downloadProvider = DownloadProviders.getDownloadProvider();
|
||||||
this.dependencyManager = profile.getDependency(downloadProvider);
|
this.dependencyManager = profile.getDependency(downloadProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.download;
|
|||||||
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
||||||
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.GameBuilder;
|
import org.jackhuang.hmcl.download.GameBuilder;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.setting.DownloadProviders;
|
import org.jackhuang.hmcl.setting.DownloadProviders;
|
||||||
@@ -35,11 +36,11 @@ import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
|||||||
public final class VanillaInstallWizardProvider implements WizardProvider {
|
public final class VanillaInstallWizardProvider implements WizardProvider {
|
||||||
private final Profile profile;
|
private final Profile profile;
|
||||||
private final DefaultDependencyManager dependencyManager;
|
private final DefaultDependencyManager dependencyManager;
|
||||||
private final InstallerWizardDownloadProvider downloadProvider;
|
private final DownloadProvider downloadProvider;
|
||||||
|
|
||||||
public VanillaInstallWizardProvider(Profile profile) {
|
public VanillaInstallWizardProvider(Profile profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.downloadProvider = new InstallerWizardDownloadProvider(DownloadProviders.getDownloadProvider());
|
this.downloadProvider = DownloadProviders.getDownloadProvider();
|
||||||
this.dependencyManager = profile.getDependency(downloadProvider);
|
this.dependencyManager = profile.getDependency(downloadProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,20 +18,18 @@
|
|||||||
package org.jackhuang.hmcl.ui.download;
|
package org.jackhuang.hmcl.ui.download;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXCheckBox;
|
import com.jfoenix.controls.JFXCheckBox;
|
||||||
import com.jfoenix.controls.JFXComboBox;
|
|
||||||
import com.jfoenix.controls.JFXListView;
|
import com.jfoenix.controls.JFXListView;
|
||||||
import com.jfoenix.controls.JFXSpinner;
|
import com.jfoenix.controls.JFXSpinner;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.InvalidationListener;
|
import javafx.beans.InvalidationListener;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.scene.control.ListCell;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
import org.jackhuang.hmcl.download.RemoteVersion;
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
import org.jackhuang.hmcl.download.VersionList;
|
import org.jackhuang.hmcl.download.VersionList;
|
||||||
import org.jackhuang.hmcl.download.fabric.FabricRemoteVersion;
|
import org.jackhuang.hmcl.download.fabric.FabricRemoteVersion;
|
||||||
@@ -39,13 +37,13 @@ import org.jackhuang.hmcl.download.forge.ForgeRemoteVersion;
|
|||||||
import org.jackhuang.hmcl.download.game.GameRemoteVersion;
|
import org.jackhuang.hmcl.download.game.GameRemoteVersion;
|
||||||
import org.jackhuang.hmcl.download.liteloader.LiteLoaderRemoteVersion;
|
import org.jackhuang.hmcl.download.liteloader.LiteLoaderRemoteVersion;
|
||||||
import org.jackhuang.hmcl.download.optifine.OptiFineRemoteVersion;
|
import org.jackhuang.hmcl.download.optifine.OptiFineRemoteVersion;
|
||||||
import org.jackhuang.hmcl.setting.DownloadProviders;
|
|
||||||
import org.jackhuang.hmcl.task.TaskExecutor;
|
import org.jackhuang.hmcl.task.TaskExecutor;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
|
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
|
||||||
import org.jackhuang.hmcl.ui.animation.TransitionPane;
|
import org.jackhuang.hmcl.ui.animation.TransitionPane;
|
||||||
import org.jackhuang.hmcl.ui.construct.FloatListCell;
|
import org.jackhuang.hmcl.ui.construct.ComponentList;
|
||||||
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
|
import org.jackhuang.hmcl.ui.construct.IconedTwoLineListItem;
|
||||||
|
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
|
||||||
import org.jackhuang.hmcl.ui.wizard.Refreshable;
|
import org.jackhuang.hmcl.ui.wizard.Refreshable;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
import org.jackhuang.hmcl.ui.wizard.WizardController;
|
||||||
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||||
@@ -55,7 +53,6 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.ui.FXUtils.stringConverter;
|
|
||||||
import static org.jackhuang.hmcl.util.Logging.LOG;
|
import static org.jackhuang.hmcl.util.Logging.LOG;
|
||||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||||
|
|
||||||
@@ -84,14 +81,14 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
@FXML
|
@FXML
|
||||||
private HBox checkPane;
|
private HBox checkPane;
|
||||||
@FXML
|
@FXML
|
||||||
private VBox centrePane;
|
private ComponentList centrePane;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXComboBox<String> downloadSourceComboBox;
|
private StackPane center;
|
||||||
|
|
||||||
private VersionList<?> versionList;
|
private VersionList<?> versionList;
|
||||||
private TaskExecutor executor;
|
private TaskExecutor executor;
|
||||||
|
|
||||||
public VersionsPage(WizardController controller, String title, String gameVersion, InstallerWizardDownloadProvider downloadProvider, String libraryId, Runnable callback) {
|
public VersionsPage(WizardController controller, String title, String gameVersion, DownloadProvider downloadProvider, String libraryId, Runnable callback) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.gameVersion = gameVersion;
|
this.gameVersion = gameVersion;
|
||||||
this.libraryId = libraryId;
|
this.libraryId = libraryId;
|
||||||
@@ -99,42 +96,38 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
|
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/download/versions.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/download/versions.fxml");
|
||||||
|
|
||||||
downloadSourceComboBox.getItems().setAll(DownloadProviders.providersById.keySet());
|
versionList = downloadProvider.getVersionListById(libraryId);
|
||||||
downloadSourceComboBox.setConverter(stringConverter(key -> i18n("download.provider." + key)));
|
if (versionList.hasType()) {
|
||||||
downloadSourceComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, newValue) -> {
|
centrePane.getContent().setAll(checkPane, list);
|
||||||
controller.getSettings().put("downloadProvider", newValue);
|
} else {
|
||||||
downloadProvider.setDownloadProvider(DownloadProviders.getDownloadProviderByPrimaryId(newValue));
|
centrePane.getContent().setAll(list);
|
||||||
versionList = downloadProvider.getVersionListById(libraryId);
|
}
|
||||||
if (versionList.hasType()) {
|
|
||||||
centrePane.getChildren().setAll(checkPane, list);
|
|
||||||
} else {
|
|
||||||
centrePane.getChildren().setAll(list);
|
|
||||||
}
|
|
||||||
refresh();
|
|
||||||
});
|
|
||||||
downloadSourceComboBox.getSelectionModel().select((String)controller.getSettings().getOrDefault("downloadProvider", DownloadProviders.getPrimaryDownloadProviderId()));
|
|
||||||
|
|
||||||
InvalidationListener listener = o -> list.getItems().setAll(loadVersions());
|
InvalidationListener listener = o -> list.getItems().setAll(loadVersions());
|
||||||
chkRelease.selectedProperty().addListener(listener);
|
chkRelease.selectedProperty().addListener(listener);
|
||||||
chkSnapshot.selectedProperty().addListener(listener);
|
chkSnapshot.selectedProperty().addListener(listener);
|
||||||
chkOld.selectedProperty().addListener(listener);
|
chkOld.selectedProperty().addListener(listener);
|
||||||
|
|
||||||
list.setCellFactory(listView -> new FloatListCell<RemoteVersion>(list) {
|
list.setCellFactory(listView -> new ListCell<RemoteVersion>() {
|
||||||
ImageView imageView = new ImageView();
|
IconedTwoLineListItem content = new IconedTwoLineListItem();
|
||||||
TwoLineListItem content = new TwoLineListItem();
|
RipplerContainer ripplerContainer = new RipplerContainer(content);
|
||||||
|
StackPane pane = new StackPane();
|
||||||
|
|
||||||
{
|
{
|
||||||
HBox container = new HBox(12);
|
pane.getStyleClass().add("md-list-cell");
|
||||||
container.setPadding(new Insets(0, 0, 0, 6));
|
StackPane.setMargin(content, new Insets(10, 16, 10, 16));
|
||||||
container.setAlignment(Pos.CENTER_LEFT);
|
pane.getChildren().setAll(ripplerContainer);
|
||||||
pane.getChildren().add(container);
|
|
||||||
|
|
||||||
container.getChildren().setAll(imageView, content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateControl(RemoteVersion remoteVersion, boolean empty) {
|
public void updateItem(RemoteVersion remoteVersion, boolean empty) {
|
||||||
if (empty) return;
|
super.updateItem(remoteVersion, empty);
|
||||||
|
if (empty) {
|
||||||
|
setGraphic(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setGraphic(pane);
|
||||||
|
|
||||||
content.setTitle(remoteVersion.getSelfVersion());
|
content.setTitle(remoteVersion.getSelfVersion());
|
||||||
content.setSubtitle(remoteVersion.getGameVersion());
|
content.setSubtitle(remoteVersion.getGameVersion());
|
||||||
|
|
||||||
@@ -142,28 +135,28 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
switch (remoteVersion.getVersionType()) {
|
switch (remoteVersion.getVersionType()) {
|
||||||
case RELEASE:
|
case RELEASE:
|
||||||
content.setSubtitle(i18n("version.game.release"));
|
content.setSubtitle(i18n("version.game.release"));
|
||||||
imageView.setImage(new Image("/assets/img/grass.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/grass.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
case SNAPSHOT:
|
case SNAPSHOT:
|
||||||
content.setSubtitle(i18n("version.game.snapshot"));
|
content.setSubtitle(i18n("version.game.snapshot"));
|
||||||
imageView.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
content.setSubtitle(i18n("version.game.old"));
|
content.setSubtitle(i18n("version.game.old"));
|
||||||
imageView.setImage(new Image("/assets/img/craft_table.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/craft_table.png", 32, 32, false, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (remoteVersion instanceof LiteLoaderRemoteVersion) {
|
} else if (remoteVersion instanceof LiteLoaderRemoteVersion) {
|
||||||
imageView.setImage(new Image("/assets/img/chicken.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/chicken.png", 32, 32, false, true));
|
||||||
content.setSubtitle(remoteVersion.getGameVersion());
|
content.setSubtitle(remoteVersion.getGameVersion());
|
||||||
} else if (remoteVersion instanceof OptiFineRemoteVersion) {
|
} else if (remoteVersion instanceof OptiFineRemoteVersion) {
|
||||||
imageView.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/command.png", 32, 32, false, true));
|
||||||
content.setSubtitle(remoteVersion.getGameVersion());
|
content.setSubtitle(remoteVersion.getGameVersion());
|
||||||
} else if (remoteVersion instanceof ForgeRemoteVersion) {
|
} else if (remoteVersion instanceof ForgeRemoteVersion) {
|
||||||
imageView.setImage(new Image("/assets/img/forge.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/forge.png", 32, 32, false, true));
|
||||||
content.setSubtitle(remoteVersion.getGameVersion());
|
content.setSubtitle(remoteVersion.getGameVersion());
|
||||||
} else if (remoteVersion instanceof FabricRemoteVersion) {
|
} else if (remoteVersion instanceof FabricRemoteVersion) {
|
||||||
imageView.setImage(new Image("/assets/img/fabric.png", 32, 32, false, true));
|
content.setImage(new Image("/assets/img/fabric.png", 32, 32, false, true));
|
||||||
content.setSubtitle(remoteVersion.getGameVersion());
|
content.setSubtitle(remoteVersion.getGameVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,6 +168,7 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
controller.getSettings().put(libraryId, list.getSelectionModel().getSelectedItem());
|
controller.getSettings().put(libraryId, list.getSelectionModel().getSelectedItem());
|
||||||
callback.run();
|
callback.run();
|
||||||
});
|
});
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +209,7 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
} else {
|
} else {
|
||||||
list.getItems().setAll(items);
|
list.getItems().setAll(items);
|
||||||
}
|
}
|
||||||
root.setContent(centrePane, ContainerAnimations.FADE.getAnimationProducer());
|
root.setContent(center, ContainerAnimations.FADE.getAnimationProducer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,38 +4,39 @@
|
|||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import org.jackhuang.hmcl.ui.animation.TransitionPane?>
|
<?import org.jackhuang.hmcl.ui.animation.TransitionPane?>
|
||||||
|
<?import org.jackhuang.hmcl.ui.construct.ComponentList?>
|
||||||
|
<?import java.lang.String?>
|
||||||
<fx:root xmlns="http://javafx.com/javafx"
|
<fx:root xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
type="BorderPane"
|
type="BorderPane"
|
||||||
prefHeight="400.0" prefWidth="600.0">
|
prefHeight="400.0" prefWidth="600.0">
|
||||||
<top>
|
<top>
|
||||||
<VBox>
|
<VBox>
|
||||||
<StackPane styleClass="sponsor-pane" onMouseClicked="#onSponsor">
|
<StackPane style="-fx-padding: 10 10 0 10;">
|
||||||
<Label text="%sponsor.bmclapi" />
|
<StackPane onMouseClicked="#onSponsor">
|
||||||
|
<styleClass>
|
||||||
|
<String fx:value="card-non-transparent" />
|
||||||
|
<String fx:value="sponsor-pane" />
|
||||||
|
</styleClass>
|
||||||
|
<Label text="%sponsor.bmclapi" />
|
||||||
|
</StackPane>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<BorderPane style="-fx-padding: 0 16 16 16;">
|
|
||||||
<left>
|
|
||||||
<Label text="%settings.launcher.download_source" BorderPane.alignment="CENTER_LEFT" />
|
|
||||||
</left>
|
|
||||||
<right>
|
|
||||||
<JFXComboBox fx:id="downloadSourceComboBox">
|
|
||||||
</JFXComboBox>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
</top>
|
</top>
|
||||||
<center>
|
<center>
|
||||||
<TransitionPane fx:id="root">
|
<TransitionPane fx:id="root">
|
||||||
<JFXSpinner fx:id="spinner" styleClass="first-spinner" />
|
<JFXSpinner fx:id="spinner" styleClass="first-spinner" />
|
||||||
<VBox fx:id="centrePane">
|
<StackPane fx:id="center" style="-fx-padding: 10;">
|
||||||
<HBox fx:id="checkPane" spacing="10" style="-fx-padding: 10;">
|
<ComponentList fx:id="centrePane" styleClass="no-padding">
|
||||||
<JFXCheckBox fx:id="chkRelease" text="%version.game.release" selected="true" />
|
<HBox fx:id="checkPane" spacing="10" style="-fx-padding: 10;">
|
||||||
<JFXCheckBox fx:id="chkSnapshot" text="%version.game.snapshot" />
|
<JFXCheckBox fx:id="chkRelease" text="%version.game.release" selected="true" />
|
||||||
<JFXCheckBox fx:id="chkOld" text="%version.game.old" />
|
<JFXCheckBox fx:id="chkSnapshot" text="%version.game.snapshot" />
|
||||||
</HBox>
|
<JFXCheckBox fx:id="chkOld" text="%version.game.old" />
|
||||||
<JFXListView fx:id="list" styleClass="jfx-list-view-float" VBox.vgrow="ALWAYS">
|
</HBox>
|
||||||
</JFXListView>
|
<JFXListView fx:id="list" styleClass="jfx-list-view-float" VBox.vgrow="ALWAYS">
|
||||||
</VBox>
|
</JFXListView>
|
||||||
|
</ComponentList>
|
||||||
|
</StackPane>
|
||||||
<StackPane fx:id="failedPane" styleClass="notice-pane">
|
<StackPane fx:id="failedPane" styleClass="notice-pane">
|
||||||
<Label onMouseClicked="#onRefresh" text="%download.failed.refresh" />
|
<Label onMouseClicked="#onRefresh" text="%download.failed.refresh" />
|
||||||
</StackPane>
|
</StackPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user