aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-10 22:46:37 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-10 22:46:37 +0900
commit75aa91678c2dfdf844ecfcbb68bcf9389028ca4e (patch)
tree45757cabbc6e4c9b050f23102114ce89b10ea78d /src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
parentcbd22473c62d076b25543611894da001685f5e21 (diff)
downloadSkyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.tar.gz
Skyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.tar.bz2
Skyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.zip
secretz
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
new file mode 100644
index 00000000..9c733fd6
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
@@ -0,0 +1,64 @@
+package kr.syeyoung.dungeonsguide.roomedit.elements;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.gui.Gui;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+public class MValue<T> extends MPanel {
+ @Getter
+ private T data;
+ private ValueEditOffsetPointSet valueEditOffsetPointSet;
+ private MLabel dataLab;
+
+ @Getter @Setter
+ private Color hover = Color.gray;
+
+ private List<MPanel> addons;
+
+ public MValue(final T parameter, List<MPanel> addons) {
+ this.addons = addons;
+ this.add(this.dataLab = new MLabel() {
+ @Override
+ public String getText() {
+ return data != null ?data.toString() :"-empty-";
+ }
+ });
+ this.dataLab.setAlignment(MLabel.Alignment.RIGHT);
+
+ this.data = parameter;
+ }
+
+ @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),bounds.getSize()).contains(relMousex0, relMousey0)) {
+ Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB());
+ }
+ }
+
+ @Override
+ public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
+ if (this.bounds.x > -20 && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMouseX, relMouseY)) {
+ EditingContext.getEditingContext().openGui(new GuiDungeonValueEdit(data, addons));
+ }
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setSize(new Dimension(parentWidth, bounds.height));
+ dataLab.setBounds(new Rectangle(0,0,parentWidth, bounds.height));
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ dataLab.setBounds(new Rectangle(0,0,bounds.width, bounds.height));
+ }
+}