aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java125
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java101
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java104
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java2
5 files changed, 332 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java
index debe2be5..b72e636f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
-public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonSecret> {
+public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonBreakableWall> {
private Parameter parameter;
// scroll pane
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java
new file mode 100644
index 00000000..d916f15f
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java
@@ -0,0 +1,125 @@
+package kr.syeyoung.dungeonsguide.roomedit.mechanicedit;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDoor;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.*;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.init.Blocks;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonDoor dungeonDoor;
+
+ private MLabel label;
+ private MValue<OffsetPointSet> value;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
+ private MButton updateOnlyAir;
+
+ public ValueEditDoor(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonDoor = (DungeonDoor) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Wall Points");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonDoor.getSecretPoint(), Collections.emptyList());
+ add(value);
+
+ updateOnlyAir = new MButton();
+ updateOnlyAir.setText("Update Air");
+ updateOnlyAir.setBackgroundColor(Color.green);
+ updateOnlyAir.setForeground(Color.black);
+ updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20));
+ add(updateOnlyAir);
+ updateOnlyAir.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ OffsetPointSet ofs = dungeonDoor.getSecretPoint();
+ List<OffsetPoint> filtered = new ArrayList<OffsetPoint>();
+ for (OffsetPoint offsetPoint : ofs.getOffsetPointList()) {
+ if (offsetPoint.getBlock(EditingContext.getEditingContext().getRoom()) != Blocks.air) continue;
+ filtered.add(offsetPoint);
+ }
+ dungeonDoor.getSecretPoint().setOffsetPointList(filtered);
+ }
+ });
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonDoor.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonDoor.getPreRequisite(), ","));
+ preRequisite2 = new MLabelAndElement("Req.",preRequisite);
+ preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20));
+ add(preRequisite2);
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ label.setBounds(new Rectangle(0,0,bounds.width, 20));
+ value.setBounds(new Rectangle(0,20,bounds.width, 20));
+ updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20));
+ preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20));
+ }
+
+ @Override
+ public void setParameter(Parameter parameter) {
+ this.parameter = parameter;
+ }
+
+ @Override
+ public void renderWorld(float partialTicks) {
+ dungeonDoor.highlight(new Color(0,255,255,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks);
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
+ }
+
+ public static class Generator implements ValueEditCreator<ValueEditDoor> {
+
+ @Override
+ public ValueEditDoor createValueEdit(Parameter parameter) {
+ return new ValueEditDoor(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonDoor();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonDoor)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java
new file mode 100644
index 00000000..9faebe48
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java
@@ -0,0 +1,101 @@
+package kr.syeyoung.dungeonsguide.roomedit.mechanicedit;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonLever;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.*;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.Collections;
+
+public class ValueEditLever extends MPanel implements ValueEdit<DungeonLever> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonLever dungeonLever;
+
+ private MLabel label;
+ private MValue<OffsetPoint> value;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
+
+ public ValueEditLever(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonLever = (DungeonLever) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Secret Point");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonLever.getLeverPoint(), Collections.emptyList());
+ add(value);
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonLever.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonLever.getPreRequisite(), ","));
+ preRequisite2 = new MLabelAndElement("Req.",preRequisite);
+ preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20));
+ add(preRequisite2);
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ label.setBounds(new Rectangle(0,0,bounds.width, 20));
+ value.setBounds(new Rectangle(0,20,bounds.width, 20));
+ preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20));
+ }
+
+ @Override
+ public void setParameter(Parameter parameter) {
+ this.parameter = parameter;
+ }
+
+ @Override
+ public void renderWorld(float partialTicks) {
+ dungeonLever.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks);
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
+ }
+
+ public static class Generator implements ValueEditCreator<ValueEditLever> {
+
+ @Override
+ public ValueEditLever createValueEdit(Parameter parameter) {
+ return new ValueEditLever(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonLever();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonLever)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java
new file mode 100644
index 00000000..db3282c3
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java
@@ -0,0 +1,104 @@
+package kr.syeyoung.dungeonsguide.roomedit.mechanicedit;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonLever;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonPressurePlate;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabelAndElement;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MTextField;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MValue;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.Collections;
+
+public class ValueEditPressurePlate extends MPanel implements ValueEdit<DungeonPressurePlate> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonPressurePlate dungeonPressureplate;
+
+ private MLabel label;
+ private MValue<OffsetPoint> value;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
+
+ public ValueEditPressurePlate(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonPressureplate = (DungeonPressurePlate) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Secret Point");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonPressureplate.getPlatePoint(), Collections.emptyList());
+ add(value);
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonPressureplate.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonPressureplate.getPreRequisite(), ","));
+ preRequisite2 = new MLabelAndElement("Req.",preRequisite);
+ preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20));
+ add(preRequisite2);
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ label.setBounds(new Rectangle(0,0,bounds.width, 20));
+ value.setBounds(new Rectangle(0,20,bounds.width, 20));
+ preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20));
+ }
+
+ @Override
+ public void setParameter(Parameter parameter) {
+ this.parameter = parameter;
+ }
+
+ @Override
+ public void renderWorld(float partialTicks) {
+ dungeonPressureplate.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks);
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
+ }
+
+ public static class Generator implements ValueEditCreator<ValueEditPressurePlate> {
+
+ @Override
+ public ValueEditPressurePlate createValueEdit(Parameter parameter) {
+ return new ValueEditPressurePlate(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonPressurePlate();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonPressurePlate)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java
index f5578825..067c3d2d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java
@@ -18,7 +18,7 @@ import scala.actors.threadpool.Arrays;
import java.awt.*;
import java.util.Collections;
-public class ValueEditTomb extends MPanel implements ValueEdit<DungeonSecret> {
+public class ValueEditTomb extends MPanel implements ValueEdit<DungeonTomb> {
private Parameter parameter;
// scroll pane