package org.saturnclient.config; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.saturnclient.config.property.CurveProperty; import org.saturnclient.config.property.IntProperty; import org.saturnclient.config.property.Property; public class AnimationConfig { public static ConfigManager config; // Logo public static final AnimationConfig logo = new AnimationConfig(true, 700, 0); // Main menu public static final AnimationConfig mainMenu = new AnimationConfig(true, 700, 120); // Mod menu public static final AnimationConfig modMenu = new AnimationConfig(true, 700, 20); // Shift menu public static final AnimationConfig shiftMenu = new AnimationConfig(true, 700, 100); // Cosmetics menu public static final AnimationConfig cosmeticsMenu = new AnimationConfig(true, 700, 40); // 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"); logo.init("Logo"); mainMenu.init("Main Menu"); modMenu.init("Mod Menu"); shiftMenu.init("Shift Menu"); cosmeticsMenu.init("Cosmetics Menu"); emoteWheel.init("Emote Wheel"); } // Animation properties public final IntProperty duration; public final IntProperty stagger; public final CurveProperty curve; public AnimationConfig(boolean enabled, int delay, int stagger) { this.duration = Property.integer(delay).range(0, 2000, 50).unit("ms"); this.stagger = Property.integer(stagger).range(0, 300, 10).unit("ms"); this.curve = Property.curve(1); } /** 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"); config.property(name + " Curve", this.curve, "Easing of the animation"); } }