diff options
author | syeyoung <cyong06@naver.com> | 2021-02-06 14:43:37 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-06 14:43:37 +0900 |
commit | e7d6517b2e1fb4aa7a5993e53739006a3fca39c8 (patch) | |
tree | ab097980bcd8809c2bcfa55b832367fd44f38036 /src/main/java/kr/syeyoung/dungeonsguide/config | |
parent | 5f51b33a4f19454072c92638e040647d4a3f6f38 (diff) | |
download | Skyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.tar.gz Skyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.tar.bz2 Skyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.zip |
THE period to gui overhaul
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config')
3 files changed, 63 insertions, 19 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 72cbf4b9..6906f615 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java @@ -1,8 +1,11 @@ package kr.syeyoung.dungeonsguide.config.guiconfig; +import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; +import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; import kr.syeyoung.dungeonsguide.roomedit.Parameter; import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MLabel; @@ -40,25 +43,52 @@ public class MParameter extends MPanel { this.label.setText(parameter.getName()); { - MButton button = new MButton(); - button.setText("Edit"); - button.setOnActionPerformed(new Runnable() { - @Override - public void run() { - final GuiParameterValueEdit guiParameterValueEdit = new GuiParameterValueEdit(parameter.getValue(), config2); - guiParameterValueEdit.setOnUpdate(new Runnable() { - @Override - public void run() { - Parameter parameter1 = guiParameterValueEdit.getParameter(); - parameter.setValue(parameter1.getNewData()); - label2.setText(parameter.getValue().toString()); - } - }); - Minecraft.getMinecraft().displayGuiScreen(guiParameterValueEdit); - } - }); - addons.add(button); - add(button); + if (parameter.getValue_type().equalsIgnoreCase("boolean")) { + final MToggleButton button = new MToggleButton(); + button.setOnToggle(new Runnable() { + @Override + public void run() { + parameter.setValue(button.isEnabled()); + label2.setText(parameter.getValue().toString()); + } + }); + button.setEnabled((Boolean) parameter.getValue()); + addons.add(button); + add(button); + } else if (parameter.getValue_type().equalsIgnoreCase("acolor")) { + final MEditableAColor button = new MEditableAColor(); + button.setEnableEdit(true); + button.setOnUpdate(new Runnable() { + @Override + public void run() { + parameter.setValue(button.getColor()); + label2.setText(parameter.getValue().toString()); + } + }); + button.setColor((AColor) parameter.getValue()); + addons.add(button); + add(button); + } else { + MButton button = new MButton(); + button.setText("Edit"); + button.setOnActionPerformed(new Runnable() { + @Override + public void run() { + final GuiParameterValueEdit guiParameterValueEdit = new GuiParameterValueEdit(parameter.getValue(), config2); + guiParameterValueEdit.setOnUpdate(new Runnable() { + @Override + public void run() { + Parameter parameter1 = guiParameterValueEdit.getParameter(); + parameter.setValue(parameter1.getNewData()); + label2.setText(parameter.getValue().toString()); + } + }); + Minecraft.getMinecraft().displayGuiScreen(guiParameterValueEdit); + } + }); + addons.add(button); + add(button); + } } { MLabel button = new MLabel(); 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 bf1de6b5..17525276 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java @@ -18,4 +18,15 @@ public class AColor extends Color { public AColor(int rgba, boolean hasalpha) { super(rgba, hasalpha); } + + @Override + public String toString() { + return "AColor{" + + ", r="+getRed()+ + ", g="+getGreen()+ + ", b="+getBlue()+ + ", a="+getAlpha()+ + ", chromaSpeed=" + chromaSpeed + + '}'; + } } 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 4965b3bd..44251237 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java @@ -17,6 +17,8 @@ public class TCTextStyle implements TypeConverter<TextStyle> { public TextStyle deserialize(JsonElement element) { TextStyle textStyle = new TextStyle(); textStyle.setColor(TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("color"))); + textStyle.setBackground(element.getAsJsonObject().has("background") ? TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("background")) + : new AColor(0x00777777, true)); textStyle.setGroupName(element.getAsJsonObject().get("group").getAsString()); return textStyle; } @@ -25,6 +27,7 @@ public class TCTextStyle implements TypeConverter<TextStyle> { public JsonElement serialize(TextStyle element) { JsonObject jsonObject = new JsonObject(); jsonObject.add("color", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getColor())); + jsonObject.add("background", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getBackground())); jsonObject.addProperty("group", element.getGroupName()); return jsonObject; } |