aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-08-01 23:43:10 +0900
committersyeyoung <cyong06@naver.com>2021-08-01 23:43:10 +0900
commitd1c36c2412b98350f8336e38361e49b3655982d5 (patch)
tree34f2d6396f69840f623254b5c6e50c3563f5cfda /src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
parent16a4367663f5ed2a909804de6d319c97c9854ecc (diff)
downloadSkyblock-Dungeons-Guide-d1c36c2412b98350f8336e38361e49b3655982d5.tar.gz
Skyblock-Dungeons-Guide-d1c36c2412b98350f8336e38361e49b3655982d5.tar.bz2
Skyblock-Dungeons-Guide-d1c36c2412b98350f8336e38361e49b3655982d5.zip
Too many changes to describe
Config gui overhaul.
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDelegate.java)2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java)2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java19
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java17
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java7
-rw-r--r--[-rwxr-xr-x]src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MFeature.java)35
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeatureEdit.java86
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java156
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java81
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java108
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java92
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java117
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java142
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java105
16 files changed, 359 insertions, 622 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java
index 645ba3a9..9f33536e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.config.guiconfig.location;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDelegate;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java
index 3ae0b2a8..4e776eef 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
+package kr.syeyoung.dungeonsguide.config.guiconfig.location;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.Marker;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java
index 57db9864..76515e69 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/ConfigPanelCreator.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
+package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
index 94dec77b..267d9a5a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
@@ -18,20 +18,15 @@
package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
import kr.syeyoung.dungeonsguide.gui.MGui;
-import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
-import kr.syeyoung.dungeonsguide.utils.cursor.GLCursors;
+import lombok.Getter;
import net.minecraft.client.Minecraft;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.input.Cursor;
-import org.lwjgl.input.Mouse;
import java.awt.*;
-import java.io.IOException;
public class GuiConfigV2 extends MGui {
+ @Getter
private RootConfigPanel rootConfigPanel;
public GuiConfigV2() {
@@ -46,7 +41,13 @@ public class GuiConfigV2 extends MGui {
super.initGui();
int dw = Minecraft.getMinecraft().displayWidth;
int dh = Minecraft.getMinecraft().displayHeight;
- rootConfigPanel.setBounds(new Rectangle((dw-1000)/2, (dh-800)/2, 1000,800));
- rootConfigPanel.setScale(2.0f);
+ rootConfigPanel.setBounds(new Rectangle((dw-1500)/2, (dh-800)/2, 1500,800));
+ rootConfigPanel.setScale(2.0);
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ super.drawDefaultBackground();
+ super.drawScreen(mouseX, mouseY, partialTicks);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
index be7dcfa6..cf57619f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
@@ -18,8 +18,9 @@
package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.MFeature;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
import lombok.Getter;
import lombok.Setter;
@@ -46,7 +47,9 @@ public class MCategory extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Gui.drawRect(0,0,getBounds().width, getBounds().height,0xFF444444);
+ Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f));
+ Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f));
+ Gui.drawRect(0,17,getBounds().width, 18,RenderUtils.blendAlpha(0x141414, 0.12f));
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
@@ -60,18 +63,22 @@ public class MCategory extends MPanel {
fr.drawString((lastAbsClip.contains(absMousex, absMousey) ? "§n" : "") + nestedCategory.categoryName(), 0,0, 0xFFFFFFFF);
GlStateManager.popMatrix();
- fr.drawSplitString("NO DESC", 5, 23, getBounds().width -10, 0xFFBFBFBF);
+ fr.drawSplitString(FeatureRegistry.getCategoryDescription().getOrDefault(nestedCategory.categoryFull(), ""), 5, 23, getBounds().width -10, 0xFFBFBFBF);
}
@Override
public Dimension getPreferredSize() {
- return new Dimension(100, 17);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ int descriptionHeight = fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().getOrDefault(nestedCategory.categoryFull(), ""), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT;
+
+ return new Dimension(100, descriptionHeight + 28);
}
+
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
if (lastAbsClip.contains(absMouseX, absMouseY))
- rootConfigPanel.setCurrentPage(nestedCategory.categoryFull());
+ rootConfigPanel.setCurrentPageAndPushHistory(nestedCategory.categoryFull());
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java
index 3e7bba67..67087dd8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java
@@ -46,14 +46,13 @@ public class MCategoryElement extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
if (rootConfigPanel.getCurrentPage().equals(category)) {
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height);
Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.13f));
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
} else if (lastAbsClip.contains(absMousex, absMousey)) {
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height);
Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.09f));
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
}
+ clip(scissor.x, scissor.y, scissor.width, scissor.height);
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java
index 922f992e..15b36216 100755..100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
+package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
@@ -24,6 +24,7 @@ import kr.syeyoung.dungeonsguide.features.GuiFeature;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.gui.elements.MButton;
import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -34,8 +35,8 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import java.awt.*;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
public class MFeature extends MPanel {
@@ -47,10 +48,10 @@ public class MFeature extends MPanel {
@Getter @Setter
private Color hover;
- private final GuiConfig config;
+ private final RootConfigPanel panel;
- public MFeature(final AbstractFeature abstractFeature, final GuiConfig config) {
- this.config = config;
+ public MFeature(final AbstractFeature abstractFeature, final RootConfigPanel panel) {
+ this.panel = panel;
this.feature = abstractFeature;
if (abstractFeature.isDisyllable()) {
@@ -62,9 +63,10 @@ public class MFeature extends MPanel {
feature.setEnabled(selected);
}
});
+ mStringSelectionButton.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f));
addons.add(mStringSelectionButton);
mStringSelectionButton.setEnabled(feature.isEnabled());
- mStringSelectionButton.setSize(new Dimension(30, 15));
+ mStringSelectionButton.setSize(new Dimension(40, 15));
add(mStringSelectionButton);
}
if (abstractFeature.getParameters().size() != 0) {
@@ -73,33 +75,40 @@ public class MFeature extends MPanel {
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- config.getTabbedPane().setCurrentPage(abstractFeature.getEditRoute(config));
+ panel.setCurrentPageAndPushHistory(abstractFeature.getEditRoute(panel));
}
});
+ button.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f));
+ button.setClicked(RenderUtils.blendAlpha(0x141414, 0.17f));
+ button.setHover(RenderUtils.blendAlpha(0x141414, 0.17f));
addons.add(button);
button.setSize(new Dimension(50, 15));
add(button);
}
if (abstractFeature instanceof GuiFeature) {
MButton button = new MButton();
- button.setText("GUI");
+ button.setText("Relocate");
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(config, abstractFeature));
+ Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(Minecraft.getMinecraft().currentScreen, abstractFeature));
+ button.setIsclicked(false);
}
});
+ button.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f));
+ button.setClicked(RenderUtils.blendAlpha(0x141414, 0.17f));
+ button.setHover(RenderUtils.blendAlpha(0x141414, 0.17f));
addons.add(button);
- button.setSize(new Dimension(50, 15));
+ button.setSize(new Dimension(75, 15));
add(button);
}
}
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Gui.drawRect(0,0,getBounds().width, getBounds().height,0xFF444444);
- Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, 0xFF545454);
- Gui.drawRect(0,17,getBounds().width, 18,0xFF444444);
+ Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f));
+ Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f));
+ Gui.drawRect(0,17,getBounds().width, 18,RenderUtils.blendAlpha(0x141414, 0.12f));
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeatureEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeatureEdit.java
new file mode 100644
index 00000000..3256c408
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeatureEdit.java
@@ -0,0 +1,86 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
+
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.gui.elements.MButton;
+import kr.syeyoung.dungeonsguide.gui.elements.MList;
+
+import java.awt.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MFeatureEdit extends MPanel {
+ private MList list;
+ private MButton goBack;
+ private RootConfigPanel rootConfigPanel;
+ private AbstractFeature abstractFeature;
+
+ private Map<String, MPanel> parameterEdits = new HashMap<>();
+
+ public MFeatureEdit(AbstractFeature abstractFeature, RootConfigPanel rootConfigPanel) {
+ this.abstractFeature = abstractFeature;
+ this.rootConfigPanel = rootConfigPanel;
+ list = new MList();
+ list.setGap(5);
+ list.setDrawLine(false);
+ add(list);
+
+ goBack = new MButton();
+ goBack.setText("< Go Back");
+ goBack.setOnActionPerformed(rootConfigPanel::goBack);
+ add(goBack);
+ }
+
+ public void addParameterEdit(String name, MPanel paramEdit) {
+ parameterEdits.put(name, paramEdit);
+ list.add(paramEdit);
+ }
+ public MPanel removeParameterEdit(String name) {
+ MPanel panel = parameterEdits.remove(name);
+ list.remove(panel);
+ return panel;
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ super.resize(parentWidth, parentHeight);
+ setBounds(new Rectangle(0,0,parentWidth,parentHeight));
+ Dimension prefSize = getPreferredSize();
+ int hei = prefSize.height;
+ setBounds(new Rectangle(0,0,parentWidth,hei));
+ }
+
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ goBack.setBounds(new Rectangle(5,5,75,15));
+
+ list.setBounds(new Rectangle(5,25,bounds.width - 10, bounds.height - 10));
+ list.realignChildren();
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ Dimension listPref = list.getPreferredSize();
+ return new Dimension(listPref.width + 10, listPref.height + 30);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java
index 5b6d9bbd..5df29c3b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.MFeature;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
@@ -49,7 +48,7 @@ public class MPanelCategory extends MPanel {
String actualCategory = nestedCategory.categoryFull().substring(5);
if (FeatureRegistry.getFeaturesByCategory().containsKey(actualCategory))
for (AbstractFeature abstractFeature : FeatureRegistry.getFeaturesByCategory().get(actualCategory)) {
- MFeature mFeature = new MFeature(abstractFeature, null);
+ MFeature mFeature = new MFeature(abstractFeature, rootConfigPanel);
list.add(mFeature);
mFeature.setHover(new Color(94, 94, 94, 255));
}
@@ -60,10 +59,10 @@ public class MPanelCategory extends MPanel {
@Override
public void resize(int parentWidth, int parentHeight) {
super.resize(parentWidth, parentHeight);
- Dimension prefSize = list.getPreferredSize();
- int wid = Math.max(prefSize.width + 10, parentWidth);
- int hei = prefSize.height + 10;
- setBounds(new Rectangle(0,0,wid,hei));
+ setBounds(new Rectangle(0,0,parentWidth,parentHeight));
+ Dimension prefSize = getPreferredSize();
+ int hei = prefSize.height;
+ setBounds(new Rectangle(0,0,parentWidth,hei));
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java
new file mode 100644
index 00000000..341705ee
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java
@@ -0,0 +1,156 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
+
+import kr.syeyoung.dungeonsguide.config.types.AColor;
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.gui.elements.*;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+import java.awt.*;
+
+public class MParameterEdit extends MPanel {
+ private AbstractFeature abstractFeature;
+ private FeatureParameter featureParameter;
+ private RootConfigPanel rootConfigPanel;
+ private MPanel valueEditHolder;
+ private MPanel valueEdit;
+
+ public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel) {
+ this.abstractFeature = abstractFeature;
+ this.featureParameter = parameter;
+ this.rootConfigPanel = rootConfigPanel;
+
+ if (parameter.getValue_type().equals("string")) {
+ valueEdit = new MTextField() {
+ @Override
+ public void edit(String str) {
+ parameter.setValue(str);
+ }
+ };
+ ((MTextField)valueEdit).setText((String) parameter.getValue());
+ } else if (parameter.getValue_type().equals("integer")) {
+ valueEdit = new MIntegerSelectionButton((Integer) parameter.getValue());
+ ((MIntegerSelectionButton)valueEdit).setOnUpdate(() -> {
+ parameter.setValue(((MIntegerSelectionButton) valueEdit).getData());
+ });
+ } else if (parameter.getValue_type().equals("float")) {
+ valueEdit = new MFloatSelectionButton((Float) parameter.getValue());
+ ((MFloatSelectionButton)valueEdit).setOnUpdate(() -> {
+ parameter.setValue(((MFloatSelectionButton) valueEdit).getData());
+ });
+ } else if (parameter.getValue_type().equals("acolor")) {
+ valueEdit = new MEditableAColor();
+ ((MEditableAColor)valueEdit).setColor((AColor) parameter.getValue());
+ ((MEditableAColor)valueEdit).setEnableEdit(true);
+ ((MEditableAColor)valueEdit).setOnUpdate(() -> {
+ parameter.setValue(((MEditableAColor) valueEdit).getColor());
+ });
+ } else if (parameter.getValue_type().equals("color")) {
+ valueEdit = new MEditableAColor();
+ ((MEditableAColor)valueEdit).setColor(new AColor(((Color) parameter.getValue()).getRGB(), true));
+ ((MEditableAColor)valueEdit).setEnableEdit(true);
+ ((MEditableAColor)valueEdit).setOnUpdate(() -> {
+ parameter.setValue(((MEditableAColor) valueEdit).getColor());
+ });
+ } else if (parameter.getValue_type().equals("boolean")) {
+ valueEdit = new MToggleButton();
+ ((MToggleButton)valueEdit).setEnabled((Boolean) parameter.getValue());
+ ((MToggleButton)valueEdit).setOnToggle(() -> {
+ parameter.setValue(((MToggleButton) valueEdit).isEnabled());
+ });
+ } else {
+ valueEdit = new MLabel();
+ ((MLabel)valueEdit).setText("????");
+ }
+
+
+ valueEditHolder = new MPanel() {
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ Dimension dimension = valueEdit.getPreferredSize();
+ if (dimension.width <= 0) dimension.width = bounds.width/2;
+ if (dimension.height <= 0) dimension.height = bounds.height/2;
+ valueEdit.setBounds(new Rectangle((bounds.width - dimension.width)/2,(bounds.height - dimension.height)/2,dimension.width, dimension.height));
+ }
+ };
+ add(valueEditHolder);
+ valueEditHolder.add(valueEdit);
+ }
+ public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel, MPanel valueEdit) {
+ this.abstractFeature = abstractFeature;
+ this.featureParameter = parameter;
+ this.rootConfigPanel = rootConfigPanel;
+
+
+ valueEditHolder = new MPanel() {
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ Dimension dimension = valueEdit.getPreferredSize();
+ if (dimension.width <= 0) dimension.width = bounds.width/2;
+ if (dimension.height <= 0) dimension.height = bounds.height/2;
+ valueEdit.setBounds(new Rectangle((bounds.width - dimension.width)/2,(bounds.height - dimension.height)/2,dimension.width, dimension.height));
+ }
+ };
+ add(valueEditHolder);
+ valueEditHolder.add(valueEdit);
+ }
+
+ @Override
+ public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f));
+ Gui.drawRect(2*bounds.width / 3,1,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f));
+ Gui.drawRect(4, 15,2*bounds.width / 3-5, 16, RenderUtils.blendAlpha(0x141414, 0.3f));
+
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString(featureParameter.getName(), 5,5, 0xFFFFFFFF);
+ fr.drawSplitString(featureParameter.getDescription(), 5,18, 2*bounds.width /3-10, 0xFFAAAAAA);
+
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ int descriptionHeight = fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().getOrDefault(featureParameter.getDescription(), ""), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT;
+
+ return new Dimension(100, Math.max(Math.max(30, descriptionHeight + 23), valueEditHolder.getPreferredSize().height));
+ }
+
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ valueEditHolder.setBounds(new Rectangle(2*bounds.width / 3, 0, bounds.width / 3, bounds.height));
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java
index e156e849..e2b97b7f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java
@@ -20,8 +20,6 @@ package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
import com.google.common.base.Function;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
@@ -30,15 +28,15 @@ import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import java.awt.*;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import java.util.Stack;
public class RootConfigPanel extends MPanelScaledGUI {
-
private MScrollablePanel navigationScroll;
private MList navigation = new MList();
@@ -55,14 +53,38 @@ public class RootConfigPanel extends MPanelScaledGUI {
private GuiConfigV2 gui;
+ private long lastPageSet = System.currentTimeMillis();
+
+ private MTextField search;
+ private MButton guiRelocate;
+
+ private final Stack<String> history = new Stack<String>();
+
public RootConfigPanel(GuiConfigV2 guiConfigV2) {
this.gui = guiConfigV2;
+ search = new MTextField() {
+ @Override
+ public void edit(String str) {
+ }
+ };
+ search.setPlaceHolder("Search...");
+ add(search);
+ guiRelocate = new MButton();
+ guiRelocate.setText("Edit Gui Locations");
+ guiRelocate.setOnActionPerformed(() -> {
+ Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(gui, null));
+ guiRelocate.setIsclicked(false);
+ });
+ guiRelocate.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67));
+ add(guiRelocate);
+
navigationScroll = new MScrollablePanel(1);
navigationScroll.setHideScrollBarWhenNotNecessary(false);
+
+
add(navigationScroll);
navigationScroll.add(navigation);
- navigationScroll.add(new MSpacer(0,0,1,1));
contentScroll = new MScrollablePanel(3);
contentScroll.setHideScrollBarWhenNotNecessary(true);
@@ -72,6 +94,7 @@ public class RootConfigPanel extends MPanelScaledGUI {
navigation.setGap(0);
navigation.setDrawLine(false);
+
rePlaceElements();
}
@@ -91,23 +114,18 @@ public class RootConfigPanel extends MPanelScaledGUI {
for (NestedCategory value : root.children().values()) {
setupNavigationRecursive(value, navigation, 0, 17);
}
-
- MCategoryElement current = new MCategoryElement("GUI Relocate",() -> {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(gui, null));
- }, 17,17, this);
- navigation.add(current);
}
private void setupNavigationRecursive(NestedCategory nestedCategory, MPanel parent, int depth, int offset) {
ConfigPanelCreator.map.put(nestedCategory.categoryFull(), () -> new MPanelCategory(nestedCategory, this));
if (nestedCategory.children().size() == 0) {
MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull(),() -> {
- setCurrentPage(nestedCategory.categoryFull());
+ setCurrentPageAndPushHistory(nestedCategory.categoryFull());
}, 13 * depth + 17, offset, this);
parent.add(current);
} else {
MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull(),() -> {
- setCurrentPage(nestedCategory.categoryFull());
+ setCurrentPageAndPushHistory(nestedCategory.categoryFull());
}, 3,offset, this);
MCollapsable mCollapsable = new MCollapsable(current, this::rePlaceElements);
mCollapsable.setLeftPad(offset-13);
@@ -123,9 +141,19 @@ public class RootConfigPanel extends MPanelScaledGUI {
}
- public void setCurrentPage(String currentPage) {
+ public void setCurrentPageAndPushHistory(String currentPage) {
+ if (!this.currentPage.equals(currentPage))
+ history.push(this.currentPage);
this.currentPage = currentPage;
+ setupPage();
+ }
+ public void goBack() {
+ if (history.size() == 0) return;
+ this.currentPage = history.pop();
+ setupPage();
+ }
+ private void setupPage() {
contentScroll.getContentArea().getChildComponents().forEach(contentScroll.getContentArea()::remove);
if (!pages.containsKey(currentPage)) {
MPanel page = pageGenerator.apply(currentPage);
@@ -139,9 +167,21 @@ public class RootConfigPanel extends MPanelScaledGUI {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
Dimension effectiveDim = getEffectiveDimension();
- Gui.drawRect(0,0, (int) (effectiveDim.width), (int) (effectiveDim.height), RenderUtils.blendAlpha(0, 0.0f));
- Gui.drawRect(1,1, (int) (effectiveDim.width)-1, (int) (effectiveDim.height) - 1, RenderUtils.blendAlpha(0x141414, 0.00f));
- Gui.drawRect(1,1, (int) (effectiveDim.width)-1, 25, RenderUtils.blendAlpha(0x0, 0.20f));
+ Gui.drawRect(0,0, (int) (effectiveDim.width), (int) (effectiveDim.height), RenderUtils.blendAlpha(0x141414, 0.00f));
+ Gui.drawRect(0,0, (int) (effectiveDim.width), 25, RenderUtils.blendAlpha(0x0, 0.20f));
+// Gui.drawRect(navigationScroll.getBounds().x + navigationScroll.getBounds().width - 10, 25, navigationScroll.getBounds().x + navigationScroll.getBounds().width , 50, RenderUtils.blendAlpha(0xFF141414, 0.04f));
+ Gui.drawRect(0, 25,navigationScroll.getBounds().x + navigationScroll.getBounds().width , 50, RenderUtils.blendAlpha(0xFF141414, 0.08f));
+
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("DungeonsGuide by syeyoung", (effectiveDim.width - fr.getStringWidth("DungeonsGuide By syeyoung"))/2, (25 - fr.FONT_HEIGHT)/2, 0xFF02EE67);
+ }
+
+ @Override
+ public void render0(double parentScale, Point parentPoint, Rectangle parentClip, int absMousex0, int absMousey0, int relMousex0, int relMousey0, float partialTicks) {
+ super.render0(parentScale, parentPoint, parentClip, absMousex0, absMousey0, relMousex0, relMousey0, partialTicks);
+ Dimension effectiveDim = getEffectiveDimension();
+ Gui.drawRect(0,24, (int) (Double.min(1, (System.currentTimeMillis() - lastPageSet)/1000.0) * effectiveDim.width), 25, 0xFF02EE67);
}
@Override
@@ -152,12 +192,17 @@ public class RootConfigPanel extends MPanelScaledGUI {
private void rePlaceElements() {
Dimension effectiveDim = getEffectiveDimension();
+
navigation.setBounds(new Rectangle(new Point(0,1), new Dimension(Math.max(100, Math.max(navigation.getPreferredSize().width, navigationScroll.getBounds().width-10)), navigation.getPreferredSize().height)));
navigation.realignChildren();
+
navigationScroll.evalulateContentArea();
Rectangle navBound;
- navigationScroll.setBounds(navBound = new Rectangle(1,25, navigation.getBounds().width+10, effectiveDim.height-24));
+ navigationScroll.setBounds(navBound = new Rectangle(0,50, navigation.getBounds().width+10, effectiveDim.height-50));
+ contentScroll.setBounds(new Rectangle(navBound.x + navBound.width, 25, effectiveDim.width - navBound.x - navBound.width, effectiveDim.height-25));
+
+ search.setBounds(new Rectangle(5,30,navBound.x + navBound.width - 10,15));
- contentScroll.setBounds(new Rectangle(navBound.x + navBound.width + 1, 25, effectiveDim.width - navBound.x - navBound.width - 2, effectiveDim.height -26));
+ guiRelocate.setBounds(new Rectangle(5,5,100,15));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java
deleted file mode 100755
index 2109c1a7..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/FeatureEditPane.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
-
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.*;
-import net.minecraft.client.gui.ScaledResolution;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-
-public class FeatureEditPane extends MPanel {
- private final List<AbstractFeature> features;
-
- private final List<MFeature> le = new ArrayList<MFeature>();
-
- private final GuiConfig config;
-
- private MTextField textField;
- private String search = "";
-
- public FeatureEditPane(List<AbstractFeature> features, GuiConfig config) {
- this.features = features;
- this.config = config;
- buildElements();
-
- }
-
-
- public void buildElements() {
- for (AbstractFeature feature : features) {
- MFeature mFeature = new MFeature(feature, config);
- mFeature.setHover(new Color(94, 94, 94, 255));
- le.add(mFeature);
- add(mFeature);
- }
-
- textField = new MTextField() {
- @Override
- public void edit(String str) {
- offsetY = 0;
- search = str;
- }
- };
- textField.setText("");
- textField.setBounds(new Rectangle(getBounds().width - 200, 0, 200, 20));
- add(textField);
- }
- @Override
- public void onBoundsUpdate() {
- for (MPanel panel :getChildComponents()){
- panel.setSize(new Dimension(getBounds().width, panel.getPreferredSize().height));
- }
- textField.setBounds(new Rectangle(getBounds().width - 200, 0, 200, 20));
- }
- @Override
- public void resize(int parentWidth, int parentHeight) {
- this.setBounds(new Rectangle(5,1,parentWidth-10,parentHeight-2));
- }
-
- @Override
- public List<MPanel> getChildComponents() {
- List<MPanel> comp = new ArrayList<MPanel>();
- comp.add(textField);
- for (MFeature feature:le) {
- if (feature.getFeature().getName().toLowerCase().contains(search.toLowerCase()))
- comp.add(feature);
- }
- return comp;
- }
-
- private int offsetY = 0;
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- int heights = 0;
- for (MPanel panel:getChildComponents()) {
- panel.setPosition(new Point(panel.getBounds().x, -offsetY + heights));
- heights += panel.getBounds().height + 5;
- }
- }
-
-
-
- @Override
- public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
- if (scrollAmount > 0) offsetY -= 20;
- else if (scrollAmount < 0) offsetY += 20;
- if (offsetY < 0) offsetY = 0;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java
deleted file mode 100755
index 822c5e2f..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiConfig.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
-
-import com.google.common.base.Supplier;
-import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.gui.MGui;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MNavigatingPane;
-import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-
-import java.awt.*;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.stream.Collectors;
-
-public class GuiConfig extends MGui {
-
-
- @Getter
- private final MNavigatingPane tabbedPane;
-
- private final Stack<String> history = new Stack();
-
- private MPanelScaledGUI panelScaledGUI;
- public GuiConfig() {
-
- panelScaledGUI = new MPanelScaledGUI();
- getMainPanel().add(panelScaledGUI);
- MNavigatingPane tabbedPane = new MNavigatingPane();
- panelScaledGUI.add(tabbedPane);
- tabbedPane.setBackground2(new Color(38, 38, 38, 255));
-
- tabbedPane.setPageGenerator(ConfigPanelCreator.INSTANCE);
-
- tabbedPane.addBookmarkRunnable("GUI Relocate", new Runnable() {
- @Override
- public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(GuiConfig.this, null));
- }
- });
-
- for (final Map.Entry<String, List<AbstractFeature>> cate: FeatureRegistry.getFeaturesByCategory().entrySet())
- if (!cate.getKey().equals("hidden")) {
- tabbedPane.addBookmark(cate.getKey(), "base." + cate.getKey());
-
- ConfigPanelCreator.map.put("base." + cate.getKey(), new Supplier<MPanel>() {
- @Override
- public MPanel get() {
- return new FeatureEditPane(cate.getValue(), GuiConfig.this);
- }
- });
- }
- tabbedPane.addBookmark("All", "base.all");
-
- ConfigPanelCreator.map.put("base.all", new Supplier<MPanel>() {
- @Override
- public MPanel get() {
- return new FeatureEditPane(FeatureRegistry.getFeatureList().stream().filter( a-> !a.getCategory().equals("hidden")).collect(Collectors.toList()), GuiConfig.this);
- }
- });
- this.tabbedPane = tabbedPane;
- }
-
- @Override
- public void initGui() {
- super.initGui();
- panelScaledGUI.setBounds(new Rectangle(Math.min((Minecraft.getMinecraft().displayWidth - 1000) / 2, Minecraft.getMinecraft().displayWidth), Math.min((Minecraft.getMinecraft().displayHeight - 700) / 2, Minecraft.getMinecraft().displayHeight),1000,700));
- panelScaledGUI.setScale(1.0);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java
deleted file mode 100755
index b759ead9..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/GuiParameterValueEdit.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
-
-import kr.syeyoung.dungeonsguide.gui.MGui;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.roomedit.Parameter;
-import kr.syeyoung.dungeonsguide.gui.elements.MButton;
-import kr.syeyoung.dungeonsguide.gui.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 java.awt.*;
-
-public class GuiParameterValueEdit extends MGui {
-
-
- 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 GuiConfig prev) {
- try {
- this.editingObj = object;
- getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179));
- {
- currentValueEdit = new MPanel() {
- @Override
- public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(5, 5, parentWidth-10, parentHeight - 25));
- }
- };
- getMainPanel().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);
- }
- });
- getMainPanel().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
- getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300));
- save.setBounds(new Rectangle(0 ,getMainPanel().getBounds().height - 20, getMainPanel().getBounds().width, 20));
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java
deleted file mode 100755
index 49db94a8..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/MParameter.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
-
-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;
-import lombok.Getter;
-import lombok.Setter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MParameter extends MPanel {
- private final MLabel label;
-
- @Getter
- private final AbstractFeature feature;
- @Getter
- private final FeatureParameter parameter;
-
- private final List<MPanel> addons = new ArrayList<MPanel>();
-
- @Getter @Setter
- private Color hover;
-
- private PanelDefaultParameterConfig config;
-
- private final MLabel label2;
- public MParameter(AbstractFeature abstractFeature, final FeatureParameter parameter, final GuiConfig config2) {
- this.config = config;
- this.parameter = parameter;
- this.feature = abstractFeature;
-
- this.add(this.label = new MLabel());
- this.label.setText(parameter.getName());
-
- {
- 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();
- button.setText(parameter.getValue().toString());
- addons.add(button);
- add(button);
- label2 = button;
- }
- setSize(new Dimension(100,20));
- }
-
- @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));
- }
- label2.setBounds(new Rectangle(x/2,0,x/2,getBounds().height));
- label.setBounds(new Rectangle(0,0,x/2, getBounds().height));
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java
deleted file mode 100755
index 9f8dafc4..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/old/PanelDefaultParameterConfig.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.old;
-
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.MParameter;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureParameter;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
-import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText;
-
-import java.util.List;
-import java.awt.*;
-import java.util.Arrays;
-import java.util.Set;
-
-public class PanelDefaultParameterConfig extends MPanel {
-
- private AbstractFeature feature;
-
- @Override
- public void onBoundsUpdate() {
- for (MPanel childComponent : getChildComponents()) {
- childComponent.setSize(new Dimension(getBounds().width - 10, childComponent.getSize().height));
- }
- }
-
- @Override
- public void resize(int parentWidth, int parentHeight) {
- this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
- }
-
- private final GuiConfig config;
- public PanelDefaultParameterConfig(final GuiConfig config, AbstractFeature feature, List<MPanel> pre, Set<String> ignore) {
- this.config = config;
- for (MPanel mPanel : pre) {
- add(mPanel);
- }
- for (FeatureParameter parameter: feature.getParameters()) {
- if (ignore.contains(parameter.getKey())) continue;
- add(new MParameter(feature, parameter, config));
- }
- setBackgroundColor(new Color(38, 38, 38, 255));
- }
-
-
- MPanel within;
- MTooltip mTooltip;
- MParameter lastWithin;
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- int heights = 0;
- within = null;
- for (MPanel panel:getChildComponents()) {
- panel.setPosition(new Point(5, -offsetY + heights + 5));
- heights += panel.getBounds().height;
-
- if (panel.getBounds().contains(relMousex0,relMousey0)) within = panel;
- }
- if (within instanceof MParameter) {
- FeatureParameter feature = ((MParameter) within).getParameter();
- if (lastWithin != within) {
- if (mTooltip != null) mTooltip.close();
- mTooltip = new MTooltipText(Arrays.asList(feature.getDescription().split("\n")));
- mTooltip.open(this);
- }
- } else {
- if (mTooltip != null) {
- mTooltip.close();
- mTooltip = null;
- }
- }
- }
-
-
- public int offsetY = 0;
-
- @Override
- public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
- for (MPanel childComponent : getChildComponents()) {
- if (!(childComponent instanceof MParameter) && childComponent.getBounds().contains(relMouseX0, relMouseY0)) return;
- }
- if (scrollAmount > 0) offsetY -= 20;
- else if (scrollAmount < 0) offsetY += 20;
- if (offsetY < 0) offsetY = 0;
- }
-
-}