Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2914aaf7 | ||
|
|
69c830d466 |
@@ -28,6 +28,9 @@ public class Config {
|
|||||||
public static FloatProperty titleScale = guiScale();
|
public static FloatProperty titleScale = guiScale();
|
||||||
public static FloatProperty menuScale = guiScale();
|
public static FloatProperty menuScale = guiScale();
|
||||||
public static FloatProperty hudMenuScale = guiScale();
|
public static FloatProperty hudMenuScale = guiScale();
|
||||||
|
|
||||||
|
/** Added in 0.1.3, so a config without it was saved by an older version */
|
||||||
|
static final String MENU_BLUR = "Menu blur";
|
||||||
public static KeybindingProperty openEmoteWheel = Property.keybinding(GLFWProvider.GLFW_KEY_B);
|
public static KeybindingProperty openEmoteWheel = Property.keybinding(GLFWProvider.GLFW_KEY_B);
|
||||||
|
|
||||||
private static FloatProperty guiScale() {
|
private static FloatProperty guiScale() {
|
||||||
@@ -57,7 +60,7 @@ public class Config {
|
|||||||
config.property("Cloak Physics", cloakPhysics, "Let cloaks swing as you move");
|
config.property("Cloak Physics", cloakPhysics, "Let cloaks swing as you move");
|
||||||
config.property("Stagger Animations", stagger, "Animate list items one after another");
|
config.property("Stagger Animations", stagger, "Animate list items one after another");
|
||||||
config.property("World blur", backgroundBlur, "How much the world or panorama behind Saturn's screens is blurred");
|
config.property("World blur", backgroundBlur, "How much the world or panorama behind Saturn's screens is blurred");
|
||||||
config.property("Menu blur", menuBlur, "How much the game is blurred through translucent menus");
|
config.property(MENU_BLUR, menuBlur, "How much the game is blurred through translucent menus");
|
||||||
config.property("Widget blur", widgetBlur, "How much the game is blurred through translucent buttons and the dock");
|
config.property("Widget blur", widgetBlur, "How much the game is blurred through translucent buttons and the dock");
|
||||||
config.property("Title screen scale", titleScale, "How big the title screen is, relative to Minecraft's GUI scale");
|
config.property("Title screen scale", titleScale, "How big the title screen is, relative to Minecraft's GUI scale");
|
||||||
config.property("Menu scale", menuScale, "How big the mods, settings and cosmetics menus are, relative to Minecraft's GUI scale");
|
config.property("Menu scale", menuScale, "How big the mods, settings and cosmetics menus are, relative to Minecraft's GUI scale");
|
||||||
|
|||||||
@@ -156,10 +156,25 @@ public class ConfigManager {
|
|||||||
* Load only a single property immediately after creation
|
* Load only a single property immediately after creation
|
||||||
*/
|
*/
|
||||||
private void loadSingleProperty(String name, Property prop) {
|
private void loadSingleProperty(String name, Property prop) {
|
||||||
|
JsonNode element = getSaved(name);
|
||||||
|
|
||||||
|
if (element != null) {
|
||||||
|
prop.loadFromJson(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the config file has a value for {@code name} in this namespace,
|
||||||
|
* which tells which version last saved it.
|
||||||
|
*/
|
||||||
|
public boolean isSaved(String name) {
|
||||||
|
return getSaved(name) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonNode getSaved(String name) {
|
||||||
JsonNode source = cachedJson != null ? cachedJson : loadAndCache();
|
JsonNode source = cachedJson != null ? cachedJson : loadAndCache();
|
||||||
if (source == null || !source.isObject())
|
if (source == null || !source.isObject())
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
JsonNode currentScope = source;
|
JsonNode currentScope = source;
|
||||||
|
|
||||||
@@ -170,16 +185,12 @@ public class ConfigManager {
|
|||||||
if (next != null && next.isObject()) {
|
if (next != null && next.isObject()) {
|
||||||
currentScope = next;
|
currentScope = next;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonNode element = currentScope.get(name);
|
return currentScope.get(name);
|
||||||
|
|
||||||
if (element != null) {
|
|
||||||
prop.loadFromJson(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -81,6 +81,29 @@ public class Theme {
|
|||||||
config.property("Widget Radius", WIDGET_RADIUS, "Corner rounding of buttons and cards");
|
config.property("Widget Radius", WIDGET_RADIUS, "Corner rounding of buttons and cards");
|
||||||
|
|
||||||
config.property("Font", FONT, "Font of every Saturn screen");
|
config.property("Font", FONT, "Font of every Saturn screen");
|
||||||
|
|
||||||
|
if (!parent.isSaved(Config.MENU_BLUR)) {
|
||||||
|
upgradeOpaqueColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before 0.1.3 panels and cards were made translucent in code, and the
|
||||||
|
* background and primary colors were saved fully opaque. Saved colors that
|
||||||
|
* are an old default or preset get the translucency the colors now carry
|
||||||
|
* themselves; colors the player picked are left as they are. Runs only on
|
||||||
|
* configs from older versions, so a preset color later set opaque on
|
||||||
|
* purpose stays opaque.
|
||||||
|
*/
|
||||||
|
private static void upgradeOpaqueColors() {
|
||||||
|
for (Preset preset : PRESETS) {
|
||||||
|
if (BACKGROUND.value == (preset.background() | 0xFF000000)) {
|
||||||
|
BACKGROUND.value = preset.background();
|
||||||
|
}
|
||||||
|
if (PRIMARY.value == (preset.primary() | 0xFF000000)) {
|
||||||
|
PRIMARY.value = preset.primary();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user