aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/roomedit
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-12 18:33:55 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-12 18:33:55 +0900
commitbbbf49cef6d8ed46b3fc5d69ff880137e62084de (patch)
treee141602a5cee61ace54dda0f68288dc531cb9ef8 /src/main/java/kr/syeyoung/dungeonsguide/roomedit
parent75aa91678c2dfdf844ecfcbb68bcf9389028ca4e (diff)
downloadSkyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.tar.gz
Skyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.tar.bz2
Skyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.zip
secrets!
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java127
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java23
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java104
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java6
5 files changed, 256 insertions, 7 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java
index b7605542..30d80f3d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java
@@ -29,6 +29,7 @@ public class GuiDungeonValueEdit extends GuiScreen {
for (int i = 0; i < addons.size(); i++) {
addons.get(i).setBounds(new Rectangle(0, bounds.height - (i+1) * 20 - 20, bounds.width, 20));
}
+ save.setBounds(new Rectangle(0 ,bounds.height - 20, bounds.width, 20));
}
};
@@ -68,7 +69,7 @@ public class GuiDungeonValueEdit extends GuiScreen {
save = new MButton(){
@Override
public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(parentWidth ,parentHeight - 20, parentWidth, 20));
+ setBounds(new Rectangle(0 ,parentHeight - 20, parentWidth, 20));
}
};
save.setText("Go back");
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java
new file mode 100644
index 00000000..fd7438af
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java
@@ -0,0 +1,127 @@
+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.DungeonBreakableWall;
+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.RenderUtils;
+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.List;
+import java.util.Collections;
+
+public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonSecret> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonBreakableWall dungeonBreakableWall;
+
+ private MLabel label;
+ private MValue<OffsetPointSet> value;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
+ private MButton updateOnlyAir;
+
+ public ValueEditBreakableWall(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonBreakableWall = (DungeonBreakableWall) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Wall Points");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonBreakableWall.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 = dungeonBreakableWall.getSecretPoint();
+ List<OffsetPoint> filtered = new ArrayList<OffsetPoint>();
+ for (OffsetPoint offsetPoint : ofs.getOffsetPointList()) {
+ if (offsetPoint.getBlock(EditingContext.getEditingContext().getRoom()) != Blocks.air) continue;
+ filtered.add(offsetPoint);
+ }
+ dungeonBreakableWall.getSecretPoint().setOffsetPointList(filtered);
+ }
+ });
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonBreakableWall.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonBreakableWall.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) {
+ dungeonBreakableWall.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<ValueEditBreakableWall> {
+
+ @Override
+ public ValueEditBreakableWall createValueEdit(Parameter parameter) {
+ return new ValueEditBreakableWall(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonSecret();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonSecret)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java
index 368bf376..044a4b5c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java
@@ -5,12 +5,11 @@ 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.MLabel;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MStringSelectionButton;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MValue;
+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.RenderUtils;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
import net.minecraft.util.BlockPos;
import scala.actors.threadpool.Arrays;
@@ -28,6 +27,8 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret>
private MLabel label;
private MValue<OffsetPoint> value;
private MStringSelectionButton selectionButton;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
public ValueEditSecret(final Parameter parameter2) {
this.parameter = parameter2;
@@ -50,6 +51,17 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret>
}
});
add(selectionButton);
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonSecret.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ","));
+ preRequisite2 = new MLabelAndElement("Req.",preRequisite);
+ preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20));
+ add(preRequisite2);
}
@Override
@@ -57,6 +69,7 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret>
label.setBounds(new Rectangle(0,0,bounds.width, 20));
value.setBounds(new Rectangle(0,20,bounds.width, 20));
selectionButton.setBounds(new Rectangle(0,40,bounds.width, 20));
+ preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20));
}
@Override
@@ -66,9 +79,7 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret>
@Override
public void renderWorld(float partialTicks) {
- BlockPos pos = dungeonSecret.getSecretPoint().getBlockPos(EditingContext.getEditingContext().getRoom());
- RenderUtils.highlightBlock(pos, new Color(0,255,0,50),partialTicks);
- RenderUtils.drawTextAtWorld(dungeonSecret.getSecretType().name(), pos.getX() +0.5f, pos.getY()+0.5f, pos.getZ()+0.5f, 0xFF000000, 0.5f, false, false, partialTicks);
+ dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks);
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java
new file mode 100644
index 00000000..04150b19
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java
@@ -0,0 +1,104 @@
+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.DungeonSecret;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonTomb;
+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.RenderUtils;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.util.BlockPos;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.Collections;
+
+public class ValueEditTomb extends MPanel implements ValueEdit<DungeonSecret> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonTomb dungeonTomb;
+
+ private MLabel label;
+ private MValue<OffsetPointSet> value;
+ private MTextField preRequisite;
+ private MLabelAndElement preRequisite2;
+
+ public ValueEditTomb(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonTomb = (DungeonTomb) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Tomb Points");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonTomb.getSecretPoint(), Collections.emptyList());
+ add(value);
+
+ preRequisite = new MTextField() {
+ @Override
+ public void edit(String str) {
+ dungeonTomb.setPreRequisite(Arrays.asList(str.split(",")));
+ }
+ };
+ preRequisite.setText(TextUtils.join(dungeonTomb.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) {
+ dungeonTomb.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<ValueEditTomb> {
+
+ @Override
+ public ValueEditTomb createValueEdit(Parameter parameter) {
+ return new ValueEditTomb(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonSecret();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonSecret)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
index ef2a7b0d..c53ec5e7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
@@ -2,8 +2,12 @@ package kr.syeyoung.dungeonsguide.roomedit.valueedit;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonBreakableWall;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonTomb;
+import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.ValueEditBreakableWall;
import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.ValueEditSecret;
+import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.ValueEditTomb;
import java.util.ArrayList;
import java.util.HashMap;
@@ -31,5 +35,7 @@ public class ValueEditRegistry {
valueEditMap.put(DungeonSecret.class.getName(), new ValueEditSecret.Generator());
+ valueEditMap.put(DungeonTomb.class.getName(), new ValueEditTomb.Generator());
+ valueEditMap.put(DungeonBreakableWall.class.getName(), new ValueEditBreakableWall.Generator());
}
}