aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java)45
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java)4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java13
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java115
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java190
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java)16
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java102
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java24
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java1
10 files changed, 480 insertions, 36 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java
index 2296f8a6..7684c5f2 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java
@@ -1,5 +1,6 @@
-package kr.syeyoung.dungeonsguide.config;
+package kr.syeyoung.dungeonsguide.config.guiconfig;
+import kr.syeyoung.dungeonsguide.config.Config;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.elements.*;
@@ -23,8 +24,10 @@ public class FeatureEditPane extends MPanel {
private MButton save;
private List<MFeature> le = new ArrayList<MFeature>();
- public FeatureEditPane(List<AbstractFeature> features) {
+ private GuiConfig config;
+ public FeatureEditPane(List<AbstractFeature> features, GuiConfig config) {
this.features = features;
+ this.config = config;
buildElements();
}
@@ -47,7 +50,7 @@ public class FeatureEditPane extends MPanel {
});
}
for (AbstractFeature feature : features) {
- MFeature mFeature = new MFeature(feature);
+ MFeature mFeature = new MFeature(feature, config);
mFeature.setHover(new Color(100,100,100,200));
le.add(mFeature);
add(mFeature);
@@ -97,8 +100,8 @@ public class FeatureEditPane extends MPanel {
}
}
- private float zLevel = 0;
- protected void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font)
+ private static float zLevel = 0;
+ public static void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font)
{
if (!textLines.isEmpty())
{
@@ -127,19 +130,19 @@ public class FeatureEditPane extends MPanel {
k += 2 + (textLines.size() - 1) * 10;
}
- this.zLevel = 300.0F;
+ zLevel = 300.0F;
int l = -267386864;
- this.drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l);
- this.drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l);
- this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l);
- this.drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l);
- this.drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l);
+ drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l);
+ drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l);
+ drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l);
+ drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l);
+ drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l);
int i1 = 1347420415;
int j1 = (i1 & 16711422) >> 1 | i1 & -16777216;
- this.drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1);
- this.drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1);
- this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1);
- this.drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1);
+ drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1);
+ drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1);
+ drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1);
+ drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1);
for (int k1 = 0; k1 < textLines.size(); ++k1)
{
@@ -154,14 +157,14 @@ public class FeatureEditPane extends MPanel {
i2 += 10;
}
- this.zLevel = 0.0F;
+ zLevel = 0.0F;
GlStateManager.enableLighting();
GlStateManager.enableDepth();
RenderHelper.enableStandardItemLighting();
GlStateManager.enableRescaleNormal();
}
}
- protected void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
+ protected static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
{
float f = (float)(startColor >> 24 & 255) / 255.0F;
float f1 = (float)(startColor >> 16 & 255) / 255.0F;
@@ -179,10 +182,10 @@ public class FeatureEditPane extends MPanel {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
- worldrenderer.pos((double)right, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
- worldrenderer.pos((double)left, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
- worldrenderer.pos((double)left, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
- worldrenderer.pos((double)right, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
+ worldrenderer.pos((double)right, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex();
+ worldrenderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex();
+ worldrenderer.pos((double)left, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex();
+ worldrenderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
GlStateManager.disableBlend();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java
index 5b408181..32921db5 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/GuiConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java
@@ -1,4 +1,4 @@
-package kr.syeyoung.dungeonsguide.config;
+package kr.syeyoung.dungeonsguide.config.guiconfig;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
@@ -31,7 +31,7 @@ public class GuiConfig extends GuiScreen {
for (Map.Entry<String, List<AbstractFeature>> cate: FeatureRegistry.getFeaturesByCategory().entrySet())
if (!cate.getKey().equals("hidden"))
- tabbedPane.addTab(cate.getKey(), new FeatureEditPane(cate.getValue()));
+ tabbedPane.addTab(cate.getKey(), new FeatureEditPane(cate.getValue(), this));
this.tabbedPane = tabbedPane;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
index f7660788..2080c9dc 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
@@ -1,6 +1,5 @@
package kr.syeyoung.dungeonsguide.config.guiconfig;
-import kr.syeyoung.dungeonsguide.config.GuiConfig;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
@@ -19,8 +18,10 @@ import java.io.IOException;
public class GuiGuiLocationConfig extends GuiScreen {
private MPanel mainPanel = new MPanel();
+ private GuiScreen before;
- public GuiGuiLocationConfig() {
+ public GuiGuiLocationConfig(final GuiScreen before) {
+ this.before = before;
for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
if (feature instanceof GuiFeature && feature.isEnabled()) {
mainPanel.add(new PanelDelegate((GuiFeature) feature));
@@ -39,7 +40,7 @@ public class GuiGuiLocationConfig extends GuiScreen {
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiConfig());
+ Minecraft.getMinecraft().displayGuiScreen(before);
}
});
mainPanel.add(button);
@@ -56,12 +57,10 @@ public class GuiGuiLocationConfig extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-
GL11.glPushMatrix();
- GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
- GlStateManager.color(0,0,0,0);
+ GlStateManager.color(1,1,1,1);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks);
- GL11.glPopAttrib();
GL11.glPopMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java
new file mode 100755
index 00000000..a234249b
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java
@@ -0,0 +1,115 @@
+package kr.syeyoung.dungeonsguide.config.guiconfig;
+
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class GuiParameterConfig extends GuiScreen {
+
+ private MPanel mainPanel = new MPanel();
+ private GuiScreen before;
+ private AbstractFeature feature;
+
+ public GuiParameterConfig(final GuiScreen before, AbstractFeature feature) {
+ this.before = before;
+ for (FeatureParameter parameter: feature.getParameters()) {
+ mainPanel.add(new MParameter(feature, parameter, this));
+ }
+ MButton save = new MButton();
+ save.setText("Back");
+ save.setBackgroundColor(Color.green);
+ save.setBounds(new Rectangle(0,0,100,20));
+ save.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ Minecraft.getMinecraft().displayGuiScreen(before);
+ }
+ });
+ mainPanel.add(save);
+
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ mainPanel.setBounds(new Rectangle(Math.min((scaledResolution.getScaledWidth() - 500) / 2, scaledResolution.getScaledWidth()), Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),500,300));
+ }
+
+ MPanel within;
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GL11.glPushMatrix();
+ GlStateManager.color(1,1,1,1);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ int heights = 0;
+ within = null;
+ for (MPanel panel:mainPanel.getChildComponents()) {
+ panel.setPosition(new Point(0, -offsetY + heights));
+ heights += panel.getBounds().height;
+
+ if (panel.getBounds().contains(mouseX - mainPanel.getBounds().x, mouseY - mainPanel.getBounds().y)) within = panel;
+ }
+ mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks);
+ if (within instanceof MParameter) {
+ FeatureParameter feature = ((MParameter) within).getParameter();
+ GlStateManager.pushAttrib();
+ drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj);
+ GlStateManager.popAttrib();
+ }
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public void keyTyped(char typedChar, int keyCode) throws IOException {
+ super.keyTyped(typedChar, keyCode);
+ mainPanel.keyTyped0(typedChar, keyCode);
+ }
+
+ @Override
+ public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton);
+ }
+
+ @Override
+ public void mouseReleased(int mouseX, int mouseY, int state) {
+ mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state);
+ }
+
+ @Override
+ public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick);
+ }
+
+ public int offsetY = 0;
+ @Override
+ public void handleMouseInput() throws IOException {
+ super.handleMouseInput();
+
+ int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
+ int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
+
+ int wheel = Mouse.getDWheel();
+ if (wheel != 0) {
+ mainPanel.mouseScrolled0(i, j,i,j, wheel);
+ }
+
+ if (wheel > 0) offsetY -= 20;
+ else if (wheel < 0) offsetY += 20;
+ if (offsetY < 0) offsetY = 0;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java
new file mode 100755
index 00000000..7b993a11
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java
@@ -0,0 +1,190 @@
+package kr.syeyoung.dungeonsguide.config.guiconfig;
+
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraftforge.common.MinecraftForge;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.io.IOException;
+import java.util.List;
+
+public class GuiParameterValueEdit extends GuiScreen {
+
+ private MPanel mainPanel = new MPanel() {
+ @Override
+ public void onBoundsUpdate() {
+ save.setBounds(new Rectangle(0 ,getBounds().height - 20, getBounds().width, 20));
+ }
+ };
+
+ private DungeonRoom dungeonRoom;
+
+
+ private MPanel currentValueEdit;
+
+ private MButton save;
+
+ @Getter
+ private ValueEdit valueEdit;
+
+ private Object editingObj;
+
+ @Getter
+ @Setter
+ private Runnable onUpdate;
+ @Getter
+ private Parameter parameter;
+
+ public GuiParameterValueEdit(final Object object, final GuiParameterConfig prev) {
+ try {
+ this.onUpdate = onUpdate;
+ dungeonRoom = EditingContext.getEditingContext().getRoom();
+ this.editingObj = object;
+ mainPanel.setBackgroundColor(new Color(17, 17, 17, 179));
+ {
+ currentValueEdit = new MPanel() {
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ setBounds(new Rectangle(0, 0, parentWidth, parentHeight - 20));
+ }
+ };
+ mainPanel.add(currentValueEdit);
+ }
+ {
+ save = new MButton() {
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ setBounds(new Rectangle(0, parentHeight - 20, parentWidth, 20));
+ }
+ };
+ save.setText("Go back");
+ save.setBackgroundColor(Color.green);
+ save.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ onUpdate.run();
+ Minecraft.getMinecraft().displayGuiScreen(prev);
+ }
+ });
+ mainPanel.add(save);
+ }
+ updateClassSelection();
+ } catch (Exception e){}
+ }
+
+ public void updateClassSelection() {
+ currentValueEdit.getChildComponents().clear();
+
+ ValueEditCreator valueEditCreator = ValueEditRegistry.getValueEditMap(editingObj == null ?"null":editingObj.getClass().getName());
+
+ MPanel valueEdit = (MPanel) valueEditCreator.createValueEdit(parameter= new Parameter("", editingObj, editingObj));
+ if (valueEdit == null) {
+ MLabel valueEdit2 = new MLabel() {
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ setBounds(new Rectangle(0, 0, parentWidth,20));
+ }
+ };
+ valueEdit2.setText("No Value Edit");
+ valueEdit2.setBounds(new Rectangle(0,0,150,20));
+ valueEdit = valueEdit2;
+ this.valueEdit = null;
+ } else{
+ this.valueEdit = (ValueEdit) valueEdit;
+ }
+ valueEdit.resize0(currentValueEdit.getBounds().width, currentValueEdit.getBounds().height);
+ currentValueEdit.add(valueEdit);
+ }
+ @Override
+ public void initGui() {
+ super.initGui();
+ // update bounds
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ mainPanel.setBounds(new Rectangle(10, Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),200,300));
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ try {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GL11.glPushMatrix();
+ GlStateManager.color(1,1,1,1);
+ mainPanel.render0(scaledResolution, new Point(0, 0), new Rectangle(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks);
+ GL11.glPopMatrix();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void keyTyped(char typedChar, int keyCode) throws IOException {
+
+ try {
+ super.keyTyped(typedChar, keyCode);
+ mainPanel.keyTyped0(typedChar, keyCode);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override
+ public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ try {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override
+ public void mouseReleased(int mouseX, int mouseY, int state) {
+ try {
+ mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override
+ public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ try {
+ mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick);
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override
+ public void handleMouseInput() throws IOException {
+ super.handleMouseInput();
+
+ int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
+ int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
+
+ int wheel = Mouse.getDWheel();
+ if (wheel != 0) {
+ try {
+ mainPanel.mouseScrolled0(i, j,i,j, wheel);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
index 25436572..fcbfdc11 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
@@ -1,5 +1,6 @@
-package kr.syeyoung.dungeonsguide.config;
+package kr.syeyoung.dungeonsguide.config.guiconfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig;
import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
@@ -28,7 +29,10 @@ public class MFeature extends MPanel {
@Getter @Setter
private Color hover;
- public MFeature(AbstractFeature abstractFeature) {
+ private GuiConfig config;
+
+ public MFeature(final AbstractFeature abstractFeature, final GuiConfig config) {
+ this.config = config;
this.feature = abstractFeature;
this.add(this.label = new MLabel());
@@ -49,6 +53,12 @@ public class MFeature extends MPanel {
if (!abstractFeature.getParameters().isEmpty()) {
MButton button = new MButton();
button.setText("Edit");
+ button.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ Minecraft.getMinecraft().displayGuiScreen(new GuiParameterConfig(config, abstractFeature));
+ }
+ });
addons.add(button);
add(button);
}
@@ -58,7 +68,7 @@ public class MFeature extends MPanel {
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig());
+ Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(config));
}
});
addons.add(button);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
new file mode 100755
index 00000000..882de0e4
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
@@ -0,0 +1,102 @@
+package kr.syeyoung.dungeonsguide.config.guiconfig;
+
+import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.GuiParameterConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.GuiParameterValueEdit;
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MStringSelectionButton;
+import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MParameter extends MPanel {
+ private MLabel label;
+
+ @Getter
+ private AbstractFeature feature;
+ @Getter
+ private FeatureParameter parameter;
+
+ private List<MPanel> addons = new ArrayList<MPanel>();
+
+ @Getter @Setter
+ private Color hover;
+
+ private GuiParameterConfig config;
+
+ private MLabel label2;
+ public MParameter(AbstractFeature abstractFeature, final FeatureParameter parameter, final GuiParameterConfig config) {
+ this.config = config;
+ this.parameter = parameter;
+ this.feature = abstractFeature;
+
+ this.add(this.label = new MLabel());
+ 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(), config);
+ 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();
+ button.setText(parameter.getValue().toString());
+ addons.add(button);
+ add(button);
+ label2 = button;
+ }
+ }
+
+ @Override
+ public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) {
+ Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB());
+ }
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setSize(new Dimension(parentWidth, getBounds().height));
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ int x = getBounds().width - 50;
+ for (MPanel panel : addons) {
+ panel.setBounds(new Rectangle(x, 3, 50, getBounds().height - 6));
+ x -= 50;
+ }
+ label.setBounds(new Rectangle(0,0,x, getBounds().height));
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
index 2e6ca8be..8fa6d371 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
@@ -74,11 +74,11 @@ public class PanelDelegate extends MPanel {
int minWidth;
int minHeight;
if (guiFeature.isKeepRatio()) {
- minHeight = (int) Math.max(10, 10 / guiFeature.getDefaultRatio());
+ minHeight = (int) Math.max(8, 8 / guiFeature.getDefaultRatio());
minWidth = (int) (guiFeature.getDefaultRatio() * minHeight);
} else {
- minWidth = 10;
- minHeight = 10;
+ minWidth = 8;
+ minHeight = 8;
}
Rectangle rectangle = guiFeature.getFeatureRect().getBounds();
if (rectangle.width < minWidth || rectangle.height < minHeight) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java
new file mode 100644
index 00000000..31ae8a43
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java
@@ -0,0 +1,24 @@
+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 TCColor implements TypeConverter<Color> {
+ @Override
+ public String getTypeString() {
+ return "color";
+ }
+
+ @Override
+ public Color deserialize(JsonElement element) {
+ return new Color(element.getAsInt());
+ }
+
+ @Override
+ public JsonElement serialize(Color 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 ee6fdfce..5f4947a1 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
@@ -24,5 +24,6 @@ public class TypeConverterRegistry {
register(new TCInteger());
register(new TCRectangle());
register(new TCString());
+ register(new TCColor());
}
}