aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-05 23:43:38 +0900
committersyeyoung <cyong06@naver.com>2021-02-05 23:43:38 +0900
commitfe4dfe76628650cdd186726f7e419e8a2c4a624e (patch)
tree529c624fa00a38081db4572ab35a003175711457 /src/main/java/kr/syeyoung/dungeonsguide/config
parenteae4f215143ef9ce659f73c7d4e3dac08e894cec (diff)
downloadSkyblock-Dungeons-Guide-fe4dfe76628650cdd186726f7e419e8a2c4a624e.tar.gz
Skyblock-Dungeons-Guide-fe4dfe76628650cdd186726f7e419e8a2c4a624e.tar.bz2
Skyblock-Dungeons-Guide-fe4dfe76628650cdd186726f7e419e8a2c4a624e.zip
mnn text
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java24
4 files changed, 30 insertions, 9 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
index a712c08b..72cbf4b9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
@@ -31,7 +31,7 @@ public class MParameter extends MPanel {
private PanelDefaultParameterConfig config;
private MLabel label2;
- public MParameter(AbstractFeature abstractFeature, final FeatureParameter parameter, final PanelDefaultParameterConfig config, final GuiConfig config2) {
+ public MParameter(AbstractFeature abstractFeature, final FeatureParameter parameter, final GuiConfig config2) {
this.config = config;
this.parameter = parameter;
this.feature = abstractFeature;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java
index 708d510b..ee31fe36 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java
@@ -36,7 +36,7 @@ public class PanelDefaultParameterConfig extends MPanel {
public PanelDefaultParameterConfig(final GuiConfig config, AbstractFeature feature) {
this.config = config;
for (FeatureParameter parameter: feature.getParameters()) {
- add(new MParameter(feature, parameter, this, config));
+ add(new MParameter(feature, parameter, config));
}
setBackgroundColor(new Color(38, 38, 38, 255));
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
index 3e43d65b..4965b3bd 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.config.types;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import kr.syeyoung.dungeonsguide.features.text.TextStyle;
@@ -14,11 +15,17 @@ public class TCTextStyle implements TypeConverter<TextStyle> {
@Override
public TextStyle deserialize(JsonElement element) {
- return new Color(element.getAsInt());
+ TextStyle textStyle = new TextStyle();
+ textStyle.setColor(TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("color")));
+ textStyle.setGroupName(element.getAsJsonObject().get("group").getAsString());
+ return textStyle;
}
@Override
public JsonElement serialize(TextStyle element) {
- return new JsonPrimitive(element.getRGB());
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.add("color", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getColor()));
+ jsonObject.addProperty("group", element.getGroupName());
+ return jsonObject;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
index 88a0aa66..4fd75da2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
@@ -1,23 +1,37 @@
package kr.syeyoung.dungeonsguide.config.types;
+import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
+import kr.syeyoung.dungeonsguide.features.text.TextStyle;
+import java.util.ArrayList;
import java.util.List;
-public class TCTextStyleList implements TypeConverter<List> {
+public class TCTextStyleList implements TypeConverter<List<TextStyle>> {
@Override
public String getTypeString() {
return "list_textStyle";
}
@Override
- public List deserialize(JsonElement element) {
- return new Color(element.getAsInt());
+ public List<TextStyle> deserialize(JsonElement element) {
+ JsonArray arr = element.getAsJsonArray();
+ TypeConverter<TextStyle> conv = TypeConverterRegistry.getTypeConverter("textstyle", TextStyle.class);
+ List<TextStyle> texts = new ArrayList<TextStyle>();
+ for (JsonElement element2:arr) {
+ texts.add(conv.deserialize(element2));
+ }
+ return texts;
}
@Override
- public JsonElement serialize(List element) {
- return new JsonPrimitive(element.getRGB());
+ public JsonElement serialize(List<TextStyle> element) {
+ JsonArray array = new JsonArray();
+ TypeConverter<TextStyle> conv = TypeConverterRegistry.getTypeConverter("textstyle", TextStyle.class);
+ for (TextStyle st:element) {
+ array.add(conv.serialize(st));
+ }
+ return array;
}
}