Redesign the mod menu, settings and cosmetics screens #6
@@ -1,5 +1,9 @@
|
|||||||
package org.saturnclient.config;
|
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.IntProperty;
|
||||||
import org.saturnclient.config.property.Property;
|
import org.saturnclient.config.property.Property;
|
||||||
import org.saturnclient.config.property.SelectProperty;
|
import org.saturnclient.config.property.SelectProperty;
|
||||||
@@ -25,6 +29,10 @@ public class AnimationConfig {
|
|||||||
// Emote wheel
|
// Emote wheel
|
||||||
public static final AnimationConfig emoteWheel = new AnimationConfig(true, 700, 40);
|
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<AnimationConfig> ALL = List.of(logo, mainMenu, modMenu, shiftMenu, cosmeticsMenu,
|
||||||
|
emoteWheel);
|
||||||
|
|
||||||
public static void init(ConfigManager parent) {
|
public static void init(ConfigManager parent) {
|
||||||
config = new ConfigManager(parent, "Animations");
|
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");
|
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<String, Property> getProperties() {
|
||||||
|
Map<String, Property> properties = new LinkedHashMap<>();
|
||||||
|
properties.put("Duration", duration);
|
||||||
|
properties.put("Stagger", stagger);
|
||||||
|
properties.put("Curve", curve);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
public void init(String name) {
|
public void init(String name) {
|
||||||
|
this.name = name;
|
||||||
// config.property("Enable " + name + " Animations", this.enabled);
|
// config.property("Enable " + name + " Animations", this.enabled);
|
||||||
config.property(name + " Duration", this.duration, "How long the animation takes");
|
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 + " Stagger", this.stagger, "Delay between items appearing one after another");
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class ClientSettings extends PanelScreen {
|
|||||||
switch (section) {
|
switch (section) {
|
||||||
case GENERAL -> PropertyList.draw(scroll, getGeneralProperties(), Set.of(), listWidth, 0);
|
case GENERAL -> PropertyList.draw(scroll, getGeneralProperties(), Set.of(), listWidth, 0);
|
||||||
case UI_STYLE -> drawUiStyle(scroll, listWidth);
|
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));
|
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);
|
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.
|
* The top-level settings. The namespaces have sections of their own.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user