mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-13 05:54:17 +01:00
overlayn't
- add config options that allow some more customization of the overlay renderer (addresses #2020) - overlay position has been reset to its default position, because the config path changed - allow integer config values to be entered and displayed as hex or binary (inside the config gui only) - how integer values are displayed can be changed with a special comment - minor changes to theme, that allow keys to refer to one another
This commit is contained in:
parent
28d9df16f2
commit
e944906519
@ -13,6 +13,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.Theme;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
@ -34,6 +35,7 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.ITextProperties;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
public class GoggleOverlayRenderer {
|
||||
|
||||
@ -50,7 +52,7 @@ public class GoggleOverlayRenderer {
|
||||
if (!entry.isAlive())
|
||||
continue;
|
||||
Outline outline = entry.getOutline();
|
||||
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive)
|
||||
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,11 +152,16 @@ public class GoggleOverlayRenderer {
|
||||
|
||||
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
|
||||
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
|
||||
|
||||
|
||||
posX = Math.min(posX, tooltipScreen.width - tooltipTextWidth - 20);
|
||||
posY = Math.min(posY, tooltipScreen.height - tooltipHeight - 20);
|
||||
|
||||
tooltipScreen.renderComponentTooltip(ms, tooltip, posX, posY);
|
||||
|
||||
Boolean useCustom = AllConfigs.CLIENT.overlayCustomColor.get();
|
||||
int colorBackground = useCustom ? AllConfigs.CLIENT.overlayBackgroundColor.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BACKGROUND);
|
||||
int colorBorderTop = useCustom ? AllConfigs.CLIENT.overlayBorderColorTop.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, true);
|
||||
int colorBorderBot = useCustom ? AllConfigs.CLIENT.overlayBorderColorBot.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, false);
|
||||
GuiUtils.drawHoveringText(ms, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1, colorBackground, colorBorderTop, colorBorderBot, mc.font);
|
||||
|
||||
|
||||
ItemStack item = AllItems.GOGGLES.asStack();
|
||||
GuiGameElement.of(item)
|
||||
|
@ -4,6 +4,7 @@ public class CClient extends ConfigBase {
|
||||
|
||||
public ConfigGroup client = group(0, "client",
|
||||
"Client-only settings - If you're looking for general settings, look inside your worlds serverconfig folder!");
|
||||
//no group
|
||||
public ConfigBool tooltips = b(true, "enableTooltips", "Show item descriptions on Shift and controls on Ctrl.");
|
||||
public ConfigBool enableOverstressedTooltip =
|
||||
b(true, "enableOverstressedTooltip", "Display a tooltip when looking at overstressed components.");
|
||||
@ -15,29 +16,39 @@ public class CClient extends ConfigBase {
|
||||
public ConfigBool experimentalRendering =
|
||||
b(true, "experimentalRendering", "Use modern OpenGL features to drastically increase performance.");
|
||||
public ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
|
||||
"The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag");
|
||||
"The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag");//no group
|
||||
public ConfigInt mainMenuConfigButtonRow = i(2, 0, 4, "mainMenuConfigButtonRow",
|
||||
"Choose the menu row that the Create config button appears on in the main menu",
|
||||
"Set to 0 to disable the button altogether");
|
||||
public ConfigInt mainMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "mainMenuConfigButtonOffsetX",
|
||||
"Offset the Create config button in the main menu by this many pixels on the X axis",
|
||||
"The sign (+/-) of this value determines what side of the row the button appears on (right/left)");
|
||||
|
||||
public ConfigInt ingameMenuConfigButtonRow = i(3, 0, 5, "ingameMenuConfigButtonRow",
|
||||
"Choose the menu row that the Create config button appears on in the in-game menu",
|
||||
"Set to 0 to disable the button altogether");
|
||||
public ConfigInt ingameMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "ingameMenuConfigButtonOffsetX",
|
||||
"Offset the Create config button in the in-game menu by this many pixels on the X axis",
|
||||
"The sign (+/-) of this value determines what side of the row the button appears on (right/left)");
|
||||
|
||||
public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning",
|
||||
"Setting this to true will prevent Create from sending you a warning when playing with Fabulous graphics enabled");
|
||||
|
||||
//overlay group
|
||||
public ConfigGroup overlay = group(1, "goggleOverlay", "Settings for the Goggle Overlay");
|
||||
public ConfigInt overlayOffsetX = i(20, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX",
|
||||
"Offset the overlay from goggle- and hover- information by this many pixels on the X axis; Use /create overlay");
|
||||
public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY",
|
||||
"Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay");
|
||||
public ConfigBool overlayCustomColor = b(false, "customColorsOverlay", "Enable this to use your custom colors for the Goggle- and Hover- Overlay");
|
||||
public ConfigInt overlayBackgroundColor = i(0xf0_100010, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBackgroundOverlay",
|
||||
"The custom background color to use for the Goggle- and Hover- Overlays, if enabled", "[in Hex: #AaRrGgBb]", "[@cui:IntDisplay:#]");
|
||||
public ConfigInt overlayBorderColorTop = i(0x50_5000ff, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderTopOverlay",
|
||||
"The custom top color of the border gradient to use for the Goggle- and Hover- Overlays, if enabled", "[in Hex: #AaRrGgBb]", "[@cui:IntDisplay:#]");
|
||||
public ConfigInt overlayBorderColorBot = i(0x50_28007f, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderBotOverlay",
|
||||
"The custom bot color of the border gradient to use for the Goggle- and Hover- Overlays, if enabled", "[in Hex: #AaRrGgBb]", "[@cui:IntDisplay:#]");
|
||||
|
||||
public ConfigInt mainMenuConfigButtonRow = i(2, 0, 4, "mainMenuConfigButtonRow",
|
||||
"Choose the menu row that the Create config button appears on in the main menu",
|
||||
"Set to 0 to disable the button altogether");
|
||||
public ConfigInt mainMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "mainMenuConfigButtonOffsetX",
|
||||
"Offset the Create config button in the main menu by this many pixels on the X axis",
|
||||
"The sign (+/-) of this value determines what side of the row the button appears on (right/left)");
|
||||
|
||||
public ConfigInt ingameMenuConfigButtonRow = i(3, 0, 5, "ingameMenuConfigButtonRow",
|
||||
"Choose the menu row that the Create config button appears on in the in-game menu",
|
||||
"Set to 0 to disable the button altogether");
|
||||
public ConfigInt ingameMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "ingameMenuConfigButtonOffsetX",
|
||||
"Offset the Create config button in the in-game menu by this many pixels on the X axis",
|
||||
"The sign (+/-) of this value determines what side of the row the button appears on (right/left)");
|
||||
|
||||
public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning",
|
||||
"Setting this to true will prevent Create from sending you a warning when playing with Fabulous graphics enabled");
|
||||
|
||||
//placement assist group
|
||||
public ConfigGroup placementAssist = group(1, "placementAssist", "Settings for the Placement Assist");
|
||||
public ConfigEnum<PlacementIndicatorSetting> placementIndicator = e(PlacementIndicatorSetting.TEXTURE,
|
||||
"indicatorType",
|
||||
@ -46,10 +57,12 @@ public class CClient extends ConfigBase {
|
||||
public ConfigFloat indicatorScale =
|
||||
f(1.0f, 0f, "indicatorScale", "Change the size of the Indicator by this multiplier");
|
||||
|
||||
//ponder group
|
||||
public ConfigGroup ponder = group(1, "ponder", "Ponder settings");
|
||||
public ConfigBool comfyReading =
|
||||
b(false, "comfyReading", "Slow down a ponder scene whenever there is text on screen.");
|
||||
|
||||
//sound group
|
||||
public ConfigGroup sound = group(1, "sound", "Sound settings");
|
||||
public ConfigBool enableAmbientSounds = b(true, "enableAmbientSounds", "Make cogs rumble and machines clatter.");
|
||||
public ConfigFloat ambientVolumeCap = f(.1f, 0, 1, "ambientVolumeCap", "Maximum volume modifier of Ambient noise");
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.simibubi.create.foundation.config.ui;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
@ -31,4 +33,29 @@ public class ConfigTextField extends TextFieldWidget {
|
||||
|
||||
ConfigScreenList.currentText = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_) {
|
||||
//prevent input of hex-keys from exiting the current config screen, in case they match the inventory key
|
||||
boolean ret = false;
|
||||
|
||||
switch (p_231046_1_) {
|
||||
case GLFW.GLFW_KEY_A:
|
||||
case GLFW.GLFW_KEY_B:
|
||||
case GLFW.GLFW_KEY_C:
|
||||
case GLFW.GLFW_KEY_D:
|
||||
case GLFW.GLFW_KEY_E:
|
||||
case GLFW.GLFW_KEY_F:
|
||||
ret = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return true;
|
||||
|
||||
|
||||
return super.keyPressed(p_231046_1_, p_231046_2_, p_231046_3_);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.simibubi.create.foundation.config.ui.entries;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -39,7 +40,27 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
|
||||
public NumberEntry(String label, ForgeConfigSpec.ConfigValue<T> value, ForgeConfigSpec.ValueSpec spec) {
|
||||
super(label, value, spec);
|
||||
textField = new ConfigTextField(Minecraft.getInstance().font, 0, 0, 200, 20, unit);
|
||||
textField.setValue(String.valueOf(getValue()));
|
||||
if (this instanceof IntegerEntry && annotations.containsKey("IntDisplay")) {
|
||||
String intDisplay = annotations.get("IntDisplay");
|
||||
int intValue = (Integer) getValue();
|
||||
String textValue;
|
||||
switch (intDisplay) {
|
||||
case "#":
|
||||
textValue = "#" + Integer.toHexString(intValue).toUpperCase(Locale.ROOT);
|
||||
break;
|
||||
case "0x":
|
||||
textValue = "0x" + Integer.toHexString(intValue).toUpperCase(Locale.ROOT);
|
||||
break;
|
||||
case "0b":
|
||||
textValue = "0b" + Integer.toBinaryString(intValue);
|
||||
break;
|
||||
default:
|
||||
textValue = String.valueOf(intValue);
|
||||
}
|
||||
textField.setValue(textValue);
|
||||
} else {
|
||||
textField.setValue(String.valueOf(getValue()));
|
||||
}
|
||||
textField.setTextColor(Theme.i(Theme.Key.TEXT));
|
||||
|
||||
Object range = spec.getRange();
|
||||
@ -82,6 +103,7 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
|
||||
}
|
||||
});
|
||||
|
||||
textField.moveCursorToStart();
|
||||
listeners.add(textField);
|
||||
onReset();
|
||||
}
|
||||
@ -107,11 +129,13 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
|
||||
@Override
|
||||
public void onValueChange(T newValue) {
|
||||
super.onValueChange(newValue);
|
||||
String newText = String.valueOf(newValue);
|
||||
if (textField.getValue().equals(newText))
|
||||
return;
|
||||
|
||||
textField.setValue(newText);
|
||||
try {
|
||||
T current = getParser().apply(textField.getValue());
|
||||
if (!current.equals(newValue)) {
|
||||
textField.setValue(String.valueOf(newValue));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,7 +185,17 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
|
||||
|
||||
@Override
|
||||
protected Function<String, Integer> getParser() {
|
||||
return Integer::parseInt;
|
||||
return (string) -> {
|
||||
if (string.startsWith("#")) {
|
||||
return Integer.parseUnsignedInt(string.substring(1), 16);
|
||||
} else if (string.startsWith("0x")) {
|
||||
return Integer.parseUnsignedInt(string.substring(2), 16);
|
||||
} else if (string.startsWith("0b")) {
|
||||
return Integer.parseUnsignedInt(string.substring(2), 2);
|
||||
} else {
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.simibubi.create.foundation.config.ui.entries;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@ -30,9 +32,11 @@ public class ValueEntry<T> extends ConfigScreenList.LabeledEntry {
|
||||
protected static final IFormattableTextComponent modComponent = new StringTextComponent("* ").withStyle(TextFormatting.BOLD, TextFormatting.DARK_BLUE).append(StringTextComponent.EMPTY.plainCopy().withStyle(TextFormatting.RESET));
|
||||
protected static final int resetWidth = 28;//including 6px offset on either side
|
||||
public static final Pattern unitPattern = Pattern.compile("\\[(in .*)]");
|
||||
public static final Pattern annotationPattern = Pattern.compile("\\[@cui:([^:]*)(?::(.*))?]");
|
||||
|
||||
protected ForgeConfigSpec.ConfigValue<T> value;
|
||||
protected ForgeConfigSpec.ValueSpec spec;
|
||||
protected Map<String, String> annotations;
|
||||
protected BoxWidget resetButton;
|
||||
protected boolean editable = true;
|
||||
protected String path;
|
||||
@ -53,6 +57,7 @@ public class ValueEntry<T> extends ConfigScreenList.LabeledEntry {
|
||||
|
||||
listeners.add(resetButton);
|
||||
|
||||
annotations = new HashMap<>();
|
||||
List<String> path = value.getPath();
|
||||
labelTooltip.add(new StringTextComponent(label).withStyle(TextFormatting.WHITE));
|
||||
String comment = spec.getComment();
|
||||
@ -67,16 +72,27 @@ public class ValueEntry<T> extends ConfigScreenList.LabeledEntry {
|
||||
continue;
|
||||
}
|
||||
|
||||
Matcher matcher = unitPattern.matcher(commentLines[i]);
|
||||
if (!matcher.matches())
|
||||
continue;
|
||||
Matcher matcher = annotationPattern.matcher(commentLines[i]);
|
||||
if (matcher.matches()) {
|
||||
String annotation = matcher.group(1);
|
||||
String aValue = matcher.group(2);
|
||||
annotations.putIfAbsent(annotation, aValue);
|
||||
|
||||
commentLines = ArrayUtils.remove(commentLines, i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
matcher = unitPattern.matcher(commentLines[i]);
|
||||
if (matcher.matches()) {
|
||||
String u = matcher.group(1);
|
||||
if (u.equals("in Revolutions per Minute"))
|
||||
u = "in RPM";
|
||||
if (u.equals("in Stress Units"))
|
||||
u = "in SU";
|
||||
unit = u;
|
||||
}
|
||||
|
||||
String u = matcher.group(1);
|
||||
if (u.equals("in Revolutions per Minute"))
|
||||
u = "in RPM";
|
||||
if (u.equals("in Stress Units"))
|
||||
u = "in SU";
|
||||
unit = u;
|
||||
}
|
||||
// add comment to tooltip
|
||||
labelTooltip.addAll(Arrays.stream(commentLines)
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.simibubi.create.foundation.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -11,32 +15,31 @@ import com.simibubi.create.foundation.utility.Couple;
|
||||
|
||||
public class Theme {
|
||||
|
||||
private static final Theme base = new Theme();
|
||||
private static Theme custom = null;
|
||||
private static final List<Theme> themes = new ArrayList<>();
|
||||
private static final Theme base = addTheme(new Theme());
|
||||
|
||||
public static void setTheme(@Nullable Theme theme) {
|
||||
custom = theme;
|
||||
public static Theme addTheme(@Nonnull Theme theme) {
|
||||
themes.add(theme);
|
||||
themes.sort(Comparator.comparingInt(Theme::getPriority).reversed());
|
||||
return theme;
|
||||
}
|
||||
|
||||
public static void removeTheme(Theme theme) {
|
||||
themes.remove(theme);
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
base.init();
|
||||
if (custom != null)
|
||||
custom.init();
|
||||
themes.forEach(Theme::init);
|
||||
}
|
||||
|
||||
private static ColorHolder resolve(String key) {
|
||||
ColorHolder h = null;
|
||||
|
||||
if (custom != null)
|
||||
h = custom.get(key);
|
||||
|
||||
if (h == null)
|
||||
h = base.get(key);
|
||||
|
||||
if (h == null)
|
||||
h = ColorHolder.missing;
|
||||
|
||||
return h;
|
||||
return themes
|
||||
.stream()
|
||||
.map(theme -> theme.get(key))
|
||||
.filter(Objects::nonNull)
|
||||
.findFirst()
|
||||
.map(holder -> holder.lookupKey == null ? holder : resolve(holder.lookupKey))
|
||||
.orElse(ColorHolder.missing);
|
||||
}
|
||||
|
||||
@Nonnull public static Couple<Color> p(@Nonnull Key key) {return p(key.get());}
|
||||
@ -57,12 +60,20 @@ public class Theme {
|
||||
//-----------//
|
||||
|
||||
protected final Map<String, ColorHolder> colors;
|
||||
private int priority = 0;
|
||||
|
||||
protected Theme() {
|
||||
colors = new HashMap<>();
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Small note to addons: if you also want to make use of Theme,
|
||||
* and add new Keys, please do not use mixins. Instead make a Theme
|
||||
* subclass, override init and apply it via the static #addTheme
|
||||
*
|
||||
**/
|
||||
|
||||
protected void init() {
|
||||
put(Key.BUTTON_IDLE, new Color(0xdd_8ab6d6, true), new Color(0x90_8ab6d6, true));
|
||||
put(Key.BUTTON_HOVER, new Color(0xff_9ABBD3, true), new Color(0xd0_9ABBD3, true));
|
||||
@ -75,6 +86,8 @@ public class Theme {
|
||||
put(Key.TEXT_ACCENT_STRONG, new Color(0xff_8ab6d6), new Color(0xff_8ab6d6));
|
||||
put(Key.TEXT_ACCENT_SLIGHT, new Color(0xff_ddeeff), new Color(0xff_a0b0c0));
|
||||
put(Key.STREAK, new Color(0x101010, false));
|
||||
put(Key.VANILLA_TOOLTIP_BORDER, new Color(0x50_5000ff, true), new Color(0x50_28007f, true));
|
||||
put(Key.VANILLA_TOOLTIP_BACKGROUND, new Color(0xf0_100010, true));
|
||||
|
||||
put(Key.PONDER_BUTTON_IDLE, new Color(0x60_c0c0ff, true), new Color(0x30_c0c0ff, true));
|
||||
put(Key.PONDER_BUTTON_HOVER, new Color(0xf0_c0c0ff, true), new Color(0xa0_c0c0ff, true));
|
||||
@ -89,7 +102,8 @@ public class Theme {
|
||||
put(Key.PONDER_BACK_ARROW, new Color(0xf0aa9999, true), new Color(0x30aa9999, true));
|
||||
put(Key.PONDER_PROGRESSBAR, new Color(0x80ffeedd, true), new Color(0x50ffeedd, true));
|
||||
put(Key.PONDER_MISSING_CREATE, new Color(0x70_984500, true), new Color(0x70_692400, true));
|
||||
put(Key.PONDER_MISSING_VANILLA, new Color(0x50_5000ff, true), new Color(0x50_300077, true));
|
||||
//put(Key.PONDER_MISSING_VANILLA, new Color(0x50_5000ff, true), new Color(0x50_300077, true));
|
||||
lookup(Key.PONDER_MISSING_VANILLA, Key.VANILLA_TOOLTIP_BORDER);
|
||||
put(Key.CONFIG_TITLE_A, new Color(0xffc69fbc, true), new Color(0xfff6b8bb, true));
|
||||
put(Key.CONFIG_TITLE_B, new Color(0xfff6b8bb, true), new Color(0xfffbf994, true));
|
||||
//put(Key., new Color(0x, true), new Color(0x, true));
|
||||
@ -111,10 +125,23 @@ public class Theme {
|
||||
put(key.get(), c1 , c2);
|
||||
}
|
||||
|
||||
protected void lookup(Key key, Key source) {
|
||||
colors.put(key.get(), ColorHolder.lookup(source.get()));
|
||||
}
|
||||
|
||||
@Nullable protected ColorHolder get(String key) {
|
||||
return colors.get(key);
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public Theme setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Key {
|
||||
|
||||
public static Key BUTTON_IDLE = new Key();
|
||||
@ -130,6 +157,8 @@ public class Theme {
|
||||
public static Key TEXT_ACCENT_SLIGHT = new Key();
|
||||
|
||||
public static Key STREAK = new Key();
|
||||
public static Key VANILLA_TOOLTIP_BORDER = new Key();
|
||||
public static Key VANILLA_TOOLTIP_BACKGROUND = new Key();
|
||||
|
||||
public static Key PONDER_BACKGROUND_TRANSPARENT = new Key();
|
||||
public static Key PONDER_BACKGROUND_FLAT = new Key();
|
||||
@ -172,6 +201,7 @@ public class Theme {
|
||||
private static final ColorHolder missing = ColorHolder.single(Color.BLACK);
|
||||
|
||||
private Couple<Color> colors;
|
||||
private String lookupKey;
|
||||
|
||||
private static ColorHolder single(Color c) {
|
||||
ColorHolder h = new ColorHolder();
|
||||
@ -185,6 +215,12 @@ public class Theme {
|
||||
return h;
|
||||
}
|
||||
|
||||
private static ColorHolder lookup(String key) {
|
||||
ColorHolder h = new ColorHolder();
|
||||
h.lookupKey = key;
|
||||
return h;
|
||||
}
|
||||
|
||||
private Color get() {
|
||||
return colors.getFirst();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user