feat(download): resourcepack game version selection.
This commit is contained in:
@@ -93,7 +93,7 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage
|
|||||||
return page;
|
return page;
|
||||||
}));
|
}));
|
||||||
modTab.setNodeSupplier(loadVersionFor(() -> new ModDownloadListPage((profile, version, file) -> download(profile, version, file, "mods"), true)));
|
modTab.setNodeSupplier(loadVersionFor(() -> new ModDownloadListPage((profile, version, file) -> download(profile, version, file, "mods"), true)));
|
||||||
resourcePackTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.RESOURCE_PACKS, (profile, version, file) -> download(profile, version, file, "resourcepacks"))));
|
resourcePackTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.RESOURCE_PACKS, (profile, version, file) -> download(profile, version, file, "resourcepacks"), true)));
|
||||||
customizationTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.CUSTOMIZATIONS)));
|
customizationTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.CUSTOMIZATIONS)));
|
||||||
worldTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.WORLDS)));
|
worldTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.WORLDS)));
|
||||||
tab = new TabHeader(newGameTab, modpackTab, modTab, resourcePackTab, worldTab);
|
tab = new TabHeader(newGameTab, modpackTab, modTab, resourcePackTab, worldTab);
|
||||||
@@ -193,9 +193,10 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadVersions(Profile profile) {
|
private void loadVersions(Profile profile) {
|
||||||
WeakListenerHolder listenerHolder = new WeakListenerHolder();
|
listenerHolder = new WeakListenerHolder();
|
||||||
runInFX(() -> {
|
runInFX(() -> {
|
||||||
if (profile == Profiles.getSelectedProfile()) {
|
if (profile == Profiles.getSelectedProfile()) {
|
||||||
|
listenerHolder.add(FXUtils.onWeakChangeAndOperate(profile.selectedVersionProperty(), version -> {
|
||||||
if (modTab.isInitialized()) {
|
if (modTab.isInitialized()) {
|
||||||
modTab.getNode().loadVersion(profile, null);
|
modTab.getNode().loadVersion(profile, null);
|
||||||
}
|
}
|
||||||
@@ -211,6 +212,7 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage
|
|||||||
if (worldTab.isInitialized()) {
|
if (worldTab.isInitialized()) {
|
||||||
worldTab.getNode().loadVersion(profile, null);
|
worldTab.getNode().loadVersion(profile, null);
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,19 +238,28 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
|
|||||||
{
|
{
|
||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
|
|
||||||
if (control.versionSelection && control.downloadSources.getSize() > 1) {
|
if (control.versionSelection) {
|
||||||
JFXComboBox<String> versionsComboBox = new JFXComboBox<>();
|
JFXComboBox<String> versionsComboBox = new JFXComboBox<>();
|
||||||
versionsComboBox.setMaxWidth(Double.MAX_VALUE);
|
versionsComboBox.setMaxWidth(Double.MAX_VALUE);
|
||||||
Bindings.bindContent(versionsComboBox.getItems(), control.versions);
|
Bindings.bindContent(versionsComboBox.getItems(), control.versions);
|
||||||
selectedItemPropertyFor(versionsComboBox).bindBidirectional(control.selectedVersion);
|
selectedItemPropertyFor(versionsComboBox).bindBidirectional(control.selectedVersion);
|
||||||
|
|
||||||
|
searchPane.addRow(rowIndex, new Label(i18n("version")), versionsComboBox);
|
||||||
|
|
||||||
|
if (control.downloadSources.getSize() > 1) {
|
||||||
JFXComboBox<String> downloadSourceComboBox = new JFXComboBox<>();
|
JFXComboBox<String> downloadSourceComboBox = new JFXComboBox<>();
|
||||||
downloadSourceComboBox.setMaxWidth(Double.MAX_VALUE);
|
downloadSourceComboBox.setMaxWidth(Double.MAX_VALUE);
|
||||||
downloadSourceComboBox.getItems().setAll(control.downloadSources.get());
|
downloadSourceComboBox.getItems().setAll(control.downloadSources.get());
|
||||||
downloadSourceComboBox.setConverter(stringConverter(I18n::i18n));
|
downloadSourceComboBox.setConverter(stringConverter(I18n::i18n));
|
||||||
selectedItemPropertyFor(downloadSourceComboBox).bindBidirectional(control.downloadSource);
|
selectedItemPropertyFor(downloadSourceComboBox).bindBidirectional(control.downloadSource);
|
||||||
|
|
||||||
searchPane.addRow(rowIndex++, new Label(i18n("version")), versionsComboBox, new Label(i18n("settings.launcher.download_source")), downloadSourceComboBox);
|
searchPane.add(new Label(i18n("settings.launcher.download_source")), 2, rowIndex);
|
||||||
|
searchPane.add(downloadSourceComboBox, 3, rowIndex);
|
||||||
|
} else {
|
||||||
|
GridPane.setColumnSpan(versionsComboBox, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
JFXTextField nameField = new JFXTextField();
|
JFXTextField nameField = new JFXTextField();
|
||||||
|
|||||||
Reference in New Issue
Block a user