Properties can carry a one-line description, set with NamedProperty.description for mods, a ConfigManager.property overload for the client's config, and a helper in ModLayout. PropertyList rows show it under the setting's name in muted text. Every mod, HUD layout, general, UI style and animation setting now has one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
68 lines
2.4 KiB
Java
68 lines
2.4 KiB
Java
package org.saturnclient.mod;
|
||
|
||
import java.util.LinkedHashMap;
|
||
import java.util.Map;
|
||
|
||
import org.saturnclient.config.property.Property;
|
||
import org.saturnclient.config.property.SelectProperty;
|
||
import org.saturnclient.config.property.ColorProperty;
|
||
import org.saturnclient.config.property.FloatProperty;
|
||
import org.saturnclient.config.property.IntProperty;
|
||
import org.saturnclient.config.property.NamedProperty;
|
||
|
||
public class ModLayout {
|
||
public IntProperty x = Property.integer(0);
|
||
public IntProperty y = Property.integer(0);
|
||
public FloatProperty scale = Property.floatProp(1.0f).range(0.5f, 4f, 0.1f).unit("×");
|
||
public ColorProperty bgColor = Property.color(0x00000000);
|
||
public ColorProperty fgColor = Property.color(0xFFffffff);
|
||
public IntProperty radius = Property.integer(0).range(0, 20);
|
||
public SelectProperty font = Property.font(0);
|
||
public boolean renderBackground = true;
|
||
|
||
public int width = 0;
|
||
public int height = 0;
|
||
|
||
public NamedProperty prop() {
|
||
// A LinkedHashMap, unlike Map.of, keeps the order the settings are shown in.
|
||
Map<String, Property> props = new LinkedHashMap<>();
|
||
put(props, "X", x, "Distance from the left of the screen");
|
||
put(props, "Y", y, "Distance from the top of the screen");
|
||
put(props, "Scale", scale, "Size of the display");
|
||
put(props, "Background Color", bgColor, "Fill behind the display");
|
||
put(props, "Foreground Color", fgColor, "Color of the text");
|
||
put(props, "Corner Radius", radius, "Rounding of the background's corners");
|
||
put(props, "Font", font, "Font of the text");
|
||
|
||
return Property.namespace(props).named("In-Game Display");
|
||
}
|
||
|
||
private static void put(Map<String, Property> props, String name, Property prop, String description) {
|
||
prop.description = description;
|
||
props.put(name, prop);
|
||
}
|
||
|
||
public ModLayout() {
|
||
}
|
||
|
||
public ModLayout(int width, int height) {
|
||
this.width = width;
|
||
this.height = height;
|
||
}
|
||
|
||
public ModLayout(int x, int y, int width, int height) {
|
||
this.x.value = x;
|
||
this.y.value = y;
|
||
this.width = width;
|
||
this.height = height;
|
||
}
|
||
|
||
public ModLayout(int x, int y, int width, int height, float scale) {
|
||
this.x.value = x;
|
||
this.y.value = y;
|
||
this.scale.value = scale;
|
||
this.width = width;
|
||
this.height = height;
|
||
}
|
||
}
|