From 55b78989ce55a517d226c4661c148a1b499e21e3 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Sun, 27 Sep 2026 18:12:30 +0200 Subject: [PATCH] Group animation settings per menu The Animations section shows each menu's duration, stagger and curve under the menu's name instead of one flat list of 18 rows. AnimationConfig keeps its name and lists every menu's config; it's saved under the same keys as before, so existing settings keep loading. Co-Authored-By: Claude Opus 5.5 --- .../saturnclient/config/AnimationConfig.java | 26 +++++++++++++++++++ .../ui/screens/ClientSettings.java | 14 +++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/saturnclient/config/AnimationConfig.java b/src/main/java/org/saturnclient/config/AnimationConfig.java index 180673b..32861de 100644 --- a/src/main/java/org/saturnclient/config/AnimationConfig.java +++ b/src/main/java/org/saturnclient/config/AnimationConfig.java @@ -1,5 +1,9 @@ package org.saturnclient.config; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + import org.saturnclient.config.property.IntProperty; import org.saturnclient.config.property.Property; import org.saturnclient.config.property.SelectProperty; @@ -25,6 +29,10 @@ public class AnimationConfig { // Emote wheel public static final AnimationConfig emoteWheel = new AnimationConfig(true, 700, 40); + /** Every menu's animation, in the order they're shown in the settings */ + public static final List ALL = List.of(logo, mainMenu, modMenu, shiftMenu, cosmeticsMenu, + emoteWheel); + public static void init(ConfigManager parent) { config = new ConfigManager(parent, "Animations"); @@ -47,7 +55,25 @@ public class AnimationConfig { this.curve = Property.select(1, "Ease In Out Cubic", "Ease Out Cubic", "Ease In Out Back"); } + /** The menu this animates, like "Mod Menu" */ + public String name; + + /** + * This animation's settings under short names ("Duration"), for showing + * them grouped under {@link #name}. They're saved under longer names + * ("Mod Menu Duration"), which stay as they are so saved settings keep + * loading. + */ + public Map getProperties() { + Map properties = new LinkedHashMap<>(); + properties.put("Duration", duration); + properties.put("Stagger", stagger); + properties.put("Curve", curve); + return properties; + } + public void init(String name) { + this.name = name; // config.property("Enable " + name + " Animations", this.enabled); config.property(name + " Duration", this.duration, "How long the animation takes"); config.property(name + " Stagger", this.stagger, "Delay between items appearing one after another"); diff --git a/src/main/java/org/saturnclient/ui/screens/ClientSettings.java b/src/main/java/org/saturnclient/ui/screens/ClientSettings.java index db3fd4e..e6cfbb3 100644 --- a/src/main/java/org/saturnclient/ui/screens/ClientSettings.java +++ b/src/main/java/org/saturnclient/ui/screens/ClientSettings.java @@ -92,7 +92,7 @@ public class ClientSettings extends PanelScreen { switch (section) { case GENERAL -> PropertyList.draw(scroll, getGeneralProperties(), Set.of(), listWidth, 0); case UI_STYLE -> drawUiStyle(scroll, listWidth); - case ANIMATIONS -> PropertyList.draw(scroll, AnimationConfig.config.getProperties(), Set.of(), listWidth, 0); + case ANIMATIONS -> drawAnimations(scroll, listWidth); } draw(scroll.dimensions(scrollWidth(width), contentHeight - LIST_Y).position(x, contentY + LIST_Y)); @@ -118,6 +118,18 @@ public class ClientSettings extends PanelScreen { PropertyList.draw(scroll, properties, getNames(properties, p -> p instanceof ColorProperty), width, y); } + /** + * Each menu's animation settings under the menu's name. + */ + private static void drawAnimations(Scroll scroll, int width) { + int y = 0; + + for (AnimationConfig animation : AnimationConfig.ALL) { + y = PropertyList.drawSection(scroll, animation.name, y) + 4; + y = PropertyList.draw(scroll, animation.getProperties(), Set.of(), width, y) + SECTION_GAP; + } + } + /** * The top-level settings. The namespaces have sections of their own. */