Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40360cf18a | ||
|
|
139e2ee78d | ||
|
|
3ff466462c |
No files matched your search
@@ -193,8 +193,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
private void loadVersions(Profile profile) {
|
||||
this.profile = profile;
|
||||
List<Node> children = new LinkedList<>();
|
||||
List<Version> versions = new LinkedList<>(profile.getRepository().getVersions());
|
||||
for (Version version : versions) {
|
||||
for (Version version : profile.getRepository().getVersions()) {
|
||||
children.add(buildNode(profile, version.getId(), GameVersion.minecraftVersion(profile.getRepository().getVersionJar(version.getId())).orElse("Unknown")));
|
||||
}
|
||||
FXUtils.resetChildren(masonryPane, children);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
package org.jackhuang.hmcl.ui;
|
||||
|
||||
import com.jfoenix.controls.*;
|
||||
import com.jfoenix.effects.JFXDepthManager;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
@@ -41,7 +43,7 @@ import org.jackhuang.hmcl.util.Lang;
|
||||
import java.net.Proxy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class SettingsPage extends StackPane implements DecoratorPage {
|
||||
private final StringProperty title = new SimpleStringProperty(this, "title", Main.i18n("settings.launcher"));
|
||||
@@ -77,7 +79,7 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
||||
@FXML
|
||||
private MultiFileItem backgroundItem;
|
||||
@FXML
|
||||
private MultiColorItem themeItem;
|
||||
private StackPane themeColorPickerContainer;
|
||||
@FXML
|
||||
private JFXRadioButton chkNoProxy;
|
||||
@FXML
|
||||
@@ -193,38 +195,17 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
||||
Settings.INSTANCE.setBackgroundImageType((EnumBackgroundImage) newValue.getUserData()));
|
||||
|
||||
// theme
|
||||
themeItem.loadChildren(Arrays.asList(
|
||||
themeItem.createChildren(Main.i18n("color.blue"), Theme.BLUE),
|
||||
themeItem.createChildren(Main.i18n("color.dark_blue"), Theme.DARK_BLUE),
|
||||
themeItem.createChildren(Main.i18n("color.green"), Theme.GREEN),
|
||||
themeItem.createChildren(Main.i18n("color.orange"), Theme.ORANGE),
|
||||
themeItem.createChildren(Main.i18n("color.purple"), Theme.PURPLE),
|
||||
themeItem.createChildren(Main.i18n("color.red"), Theme.RED)
|
||||
));
|
||||
|
||||
if (Settings.INSTANCE.getTheme().isCustom())
|
||||
themeItem.setColor(Color.web(Settings.INSTANCE.getTheme().getColor()));
|
||||
|
||||
themeItem.setToggleSelectedListener(newValue -> {
|
||||
if (newValue.getUserData() != null) {
|
||||
Settings.INSTANCE.setTheme((Theme) newValue.getUserData());
|
||||
themeItem.setOnColorPickerChanged(null);
|
||||
} else {
|
||||
themeItem.setOnColorPickerChanged(color ->
|
||||
Settings.INSTANCE.setTheme(Theme.custom(Theme.getColorDisplayName(color))));
|
||||
}
|
||||
});
|
||||
|
||||
themeItem.getGroup().getToggles().stream().filter(it -> Settings.INSTANCE.getTheme() == it.getUserData() || Settings.INSTANCE.getTheme().isCustom() && themeItem.isCustomToggle(it)).findFirst().ifPresent(it -> it.setSelected(true));
|
||||
|
||||
Settings.INSTANCE.themeProperty().setChangedListenerAndOperate(it -> {
|
||||
if (it.isCustom())
|
||||
themeItem.setSubtitle(it.getName());
|
||||
else
|
||||
themeItem.setSubtitle(Main.i18n("color." + it.getName().toLowerCase()));
|
||||
|
||||
Controllers.getScene().getStylesheets().setAll(it.getStylesheets());
|
||||
JFXColorPicker picker = new JFXColorPicker(Color.web(Settings.INSTANCE.getTheme().getColor()), null);
|
||||
picker.setCustomColorText(Main.i18n("color.custom"));
|
||||
picker.setRecentColorsText(Main.i18n("color.recent"));
|
||||
picker.getCustomColors().setAll(Arrays.stream(Theme.VALUES).map(Theme::getColor).map(Color::web).collect(Collectors.toList()));
|
||||
picker.setOnAction(e -> {
|
||||
Theme theme = Theme.custom(Theme.getColorDisplayName(picker.getValue()));
|
||||
Settings.INSTANCE.setTheme(theme);
|
||||
Controllers.getScene().getStylesheets().setAll(theme.getStylesheets());
|
||||
});
|
||||
themeColorPickerContainer.getChildren().setAll(picker);
|
||||
Platform.runLater(() -> JFXDepthManager.setDepth(picker, 0));
|
||||
}
|
||||
|
||||
private void initBackgroundItemSubtitle() {
|
||||
|
||||
@@ -108,7 +108,14 @@
|
||||
</VBox>
|
||||
</ComponentList>
|
||||
|
||||
<MultiColorItem fx:id="themeItem" title="%settings.launcher.theme" hasSubtitle="true" />
|
||||
<BorderPane>
|
||||
<left>
|
||||
<Label text="%settings.launcher.theme" BorderPane.alignment="CENTER_LEFT" />
|
||||
</left>
|
||||
<right>
|
||||
<StackPane fx:id="themeColorPickerContainer" minHeight="30" />
|
||||
</right>
|
||||
</BorderPane>
|
||||
|
||||
<VBox spacing="5">
|
||||
<BorderPane><left><Label text="%settings.launcher.log_font" BorderPane.alignment="CENTER_LEFT" /></left><right><HBox spacing="3"><FontComboBox fontSize="12" enableStyle="false" fx:id="cboFont" /><JFXTextField fx:id="txtFontSize" maxWidth="50" minWidth="50" /></HBox></right></BorderPane>
|
||||
|
||||
@@ -89,6 +89,8 @@ color.green=Green
|
||||
color.orange=Orange
|
||||
color.purple=Purple
|
||||
color.red=Red
|
||||
color.recent=Recommended
|
||||
color.custom=Custom Color
|
||||
|
||||
crash.NoClassDefFound=Please check "HMCL" software is complete.
|
||||
crash.advice.ClassNotFoundException=Minecraft or mods are incomplete. Retry if there are some libraries that have not downloaded or update your game and mods! Or you can try Game Settings -> Manage (Version) -> Delete library files to solve the problem.
|
||||
|
||||
@@ -89,6 +89,8 @@ color.green=绿色
|
||||
color.orange=橙色
|
||||
color.purple=紫色
|
||||
color.red=红色
|
||||
color.recent=推荐
|
||||
color.custom=自定义颜色
|
||||
|
||||
crash.NoClassDefFound=请确认HMCL本体是否完整
|
||||
crash.advice.ClassNotFoundException=Minecraft不完整或Mod冲突,如果有未能下载的文件请下载成功后重试或是客户端损坏请重试请重新制作客户端或下载整合包解决问题,另可尝试游戏设置->(版本)管理->删除库文件解决问题
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.jackhuang.hmcl.download;
|
||||
|
||||
import org.jackhuang.hmcl.download.game.*;
|
||||
import org.jackhuang.hmcl.game.SimpleVersionProvider;
|
||||
import org.jackhuang.hmcl.game.Version;
|
||||
import org.jackhuang.hmcl.task.ParallelTask;
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
@@ -51,7 +52,7 @@ public class DefaultGameBuilder extends GameBuilder {
|
||||
public Task buildAsync() {
|
||||
return new VersionJsonDownloadTask(gameVersion, dependencyManager).then(variables -> {
|
||||
Version version = Constants.GSON.fromJson(variables.<String>get(VersionJsonDownloadTask.ID), Version.class);
|
||||
version = version.setId(name).setJar(null);
|
||||
version = version.setId(name).setJar(null).resolve(new SimpleVersionProvider());
|
||||
variables.set("version", version);
|
||||
Task result = new ParallelTask(
|
||||
new GameAssetDownloadTask(dependencyManager, version),
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.logging.Level;
|
||||
public class DefaultGameRepository implements GameRepository {
|
||||
|
||||
private File baseDirectory;
|
||||
protected final Map<String, Version> versions = new TreeMap<>();
|
||||
protected Map<String, Version> versions;
|
||||
protected boolean loaded = false;
|
||||
|
||||
public DefaultGameRepository(File baseDirectory) {
|
||||
@@ -143,6 +143,8 @@ public class DefaultGameRepository implements GameRepository {
|
||||
}
|
||||
|
||||
public boolean removeVersionFromDisk(String id) {
|
||||
if (!versions.containsKey(id))
|
||||
return true;
|
||||
File file = getVersionRoot(id);
|
||||
if (!file.exists())
|
||||
return true;
|
||||
@@ -151,7 +153,7 @@ public class DefaultGameRepository implements GameRepository {
|
||||
}
|
||||
|
||||
protected void refreshVersionsImpl() {
|
||||
versions.clear();
|
||||
Map<String, Version> versions = new TreeMap<>();
|
||||
|
||||
if (ClassicVersion.hasClassicVersion(getBaseDirectory())) {
|
||||
Version version = new ClassicVersion();
|
||||
@@ -172,7 +174,10 @@ public class DefaultGameRepository implements GameRepository {
|
||||
if (!json.exists()) {
|
||||
List<File> jsons = FileUtils.listFilesByExtension(dir, "json");
|
||||
if (jsons.size() == 1)
|
||||
jsons.get(0).renameTo(json);
|
||||
if (!jsons.get(0).renameTo(json)) {
|
||||
Logging.LOG.warning("Cannot rename json file " + jsons.get(0) + " to " + json + ", ignoring version " + id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Version version;
|
||||
@@ -216,6 +221,7 @@ public class DefaultGameRepository implements GameRepository {
|
||||
}
|
||||
}
|
||||
|
||||
this.versions = versions;
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
|
||||
Binary file not shown.
Reference in new issue
Block a user