Update welcome.png

This commit is contained in:
huanghongxun 2018-10-14 18:50:47 +08:00
parent af571d533d
commit eaa6790013
6 changed files with 46 additions and 2 deletions

View File

@ -145,6 +145,9 @@ public final class Config implements Cloneable, Observable {
@SerializedName("_version")
private IntegerProperty configVersion = new SimpleIntegerProperty(0);
@SerializedName("uiVersion")
private IntegerProperty uiVersion = new SimpleIntegerProperty(0);
private transient ObservableHelper helper = new ObservableHelper(this);
public Config() {
@ -440,4 +443,27 @@ public final class Config implements Cloneable, Observable {
this.updateChannel.set(updateChannel);
}
public int getConfigVersion() {
return configVersion.get();
}
public IntegerProperty configVersionProperty() {
return configVersion;
}
public void setConfigVersion(int configVersion) {
this.configVersion.set(configVersion);
}
public int getUiVersion() {
return uiVersion.get();
}
public IntegerProperty uiVersionProperty() {
return uiVersion;
}
public void setUiVersion(int uiVersion) {
this.uiVersion.set(uiVersion);
}
}

View File

@ -29,6 +29,8 @@ import java.util.Map;
import static org.jackhuang.hmcl.util.Lang.tryCast;
final class ConfigUpgrader {
private static final int VERSION = 0;
private ConfigUpgrader() {
}
@ -37,10 +39,22 @@ final class ConfigUpgrader {
*
* @param deserialized deserialized config settings
* @param rawJson raw json structure of the config settings without modification
* @return true if config version is upgraded
*/
static void upgradeConfig(Config deserialized, Map<?, ?> rawJson) {
static boolean upgradeConfig(Config deserialized, Map<?, ?> rawJson) {
boolean upgraded;
if (deserialized.getConfigVersion() < VERSION) {
deserialized.setConfigVersion(VERSION);
// TODO: Add upgrade code here.
upgraded = true;
} else {
upgraded = false;
}
upgradeV2(deserialized, rawJson);
upgradeV3(deserialized, rawJson);
return upgraded;
}
/**

View File

@ -59,6 +59,7 @@ import static org.jackhuang.hmcl.setting.ConfigHolder.config;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public final class Controllers {
public static final int UI_VERSION = 1;
private static Scene scene;
private static Stage stage;

View File

@ -106,8 +106,11 @@ public class DecoratorController {
);
nowAnimation.play();
});
if (ConfigHolder.isNewlyCreated() && config().getLocalization().getLocale() == Locale.CHINA)
if (ConfigHolder.config().getUiVersion() < Controllers.UI_VERSION && config().getLocalization().getLocale() == Locale.CHINA) {
ConfigHolder.config().setUiVersion(Controllers.UI_VERSION);
decorator.getContainer().setAll(welcomeView);
}
setupBackground();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 KiB

After

Width:  |  Height:  |  Size: 941 KiB