aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-05 23:06:06 +0900
committersyeyoung <cyong06@naver.com>2021-02-05 23:06:06 +0900
commiteae4f215143ef9ce659f73c7d4e3dac08e894cec (patch)
treed0386d46a3771c9123ec58bfe26fde5b49d3096b /src/main/java/kr/syeyoung/dungeonsguide
parent6b4e2499ece7f4328381a88380baea85fe24246d (diff)
downloadSkyblock-Dungeons-Guide-eae4f215143ef9ce659f73c7d4e3dac08e894cec.tar.gz
Skyblock-Dungeons-Guide-eae4f215143ef9ce659f73c7d4e3dac08e894cec.tar.bz2
Skyblock-Dungeons-Guide-eae4f215143ef9ce659f73c7d4e3dac08e894cec.zip
mm
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java22
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java24
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java23
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java22
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java12
7 files changed, 108 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
index 0015672e..bf1de6b5 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
@@ -1,8 +1,16 @@
package kr.syeyoung.dungeonsguide.config.types;
+import lombok.Getter;
+import lombok.Setter;
+
import java.awt.*;
+@Getter
+@Setter
public class AColor extends Color {
+ private boolean chroma;
+ private float chromaSpeed;
+
public AColor(int r, int g, int b, int a) {
super(r, g, b, a);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
index 2b37b258..9f95e094 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
@@ -1,23 +1,35 @@
package kr.syeyoung.dungeonsguide.config.types;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import java.awt.*;
-public class TCAColor implements TypeConverter<Color> {
+public class TCAColor implements TypeConverter<AColor> {
@Override
public String getTypeString() {
return "acolor";
}
@Override
- public Color deserialize(JsonElement element) {
- return new AColor(element.getAsInt(), true);
+ public AColor deserialize(JsonElement element) {
+ if (element instanceof JsonPrimitive)
+ return new AColor(element.getAsInt(), true);
+
+ JsonObject object = element.getAsJsonObject();
+ AColor color = new AColor(object.get("color").getAsInt(), true);
+ color.setChroma(object.get("chroma").getAsBoolean());
+ color.setChromaSpeed(object.get("chromaSpeed").getAsFloat());
+ return color;
}
@Override
- public JsonElement serialize(Color element) {
- return new JsonPrimitive(element.getRGB());
+ public JsonElement serialize(AColor element) {
+ JsonObject object = new JsonObject();
+ object.addProperty("color", element.getRGB());
+ object.addProperty("chroma", element.isChroma());
+ object.addProperty("chromaSpeed", element.getChromaSpeed());
+ return object;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
new file mode 100644
index 00000000..3e43d65b
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
@@ -0,0 +1,24 @@
+package kr.syeyoung.dungeonsguide.config.types;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+import kr.syeyoung.dungeonsguide.features.text.TextStyle;
+
+import java.util.List;
+
+public class TCTextStyle implements TypeConverter<TextStyle> {
+ @Override
+ public String getTypeString() {
+ return "textstyle";
+ }
+
+ @Override
+ public TextStyle deserialize(JsonElement element) {
+ return new Color(element.getAsInt());
+ }
+
+ @Override
+ public JsonElement serialize(TextStyle element) {
+ return new JsonPrimitive(element.getRGB());
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
new file mode 100644
index 00000000..88a0aa66
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
@@ -0,0 +1,23 @@
+package kr.syeyoung.dungeonsguide.config.types;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonPrimitive;
+
+import java.util.List;
+
+public class TCTextStyleList implements TypeConverter<List> {
+ @Override
+ public String getTypeString() {
+ return "list_textStyle";
+ }
+
+ @Override
+ public List deserialize(JsonElement element) {
+ return new Color(element.getAsInt());
+ }
+
+ @Override
+ public JsonElement serialize(List element) {
+ return new JsonPrimitive(element.getRGB());
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
index 69f047a8..5e48b76c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
@@ -27,5 +27,7 @@ public class TypeConverterRegistry {
register(new TCColor());
register(new TCFloat());
register(new TCAColor());
+ register(new TCTextStyleList());
+ register(new TCTextStyle());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
new file mode 100644
index 00000000..d2cf793d
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
@@ -0,0 +1,22 @@
+package kr.syeyoung.dungeonsguide.features.text;
+
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class TextHUDFeature extends GuiFeature {
+ protected TextHUDFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) {
+ super(category, name, description, key, keepRatio, width, height);
+ this.parameters.put("textStyles", new FeatureParameter<List<TextStyle>>("textStyles", "", "", new ArrayList<TextStyle>(), "list_textstyle"));
+ }
+
+ public abstract List<String> getUsedTextStyle();
+
+ @Override
+ public void drawHUD(float partialTicks) {
+
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java
new file mode 100644
index 00000000..74e3c66a
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java
@@ -0,0 +1,12 @@
+package kr.syeyoung.dungeonsguide.features.text;
+
+import kr.syeyoung.dungeonsguide.config.types.AColor;
+import lombok.Data;
+
+import java.awt.*;
+
+@Data
+public class TextStyle {
+ private String groupName;
+ private AColor color;
+}