aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide
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
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')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java1
-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
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java21
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java22
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java10
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java73
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java9
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java18
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java63
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java33
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java7
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java67
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java33
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java12
45 files changed, 631 insertions, 804 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
index 28bc50bc..437c1689 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
@@ -22,7 +22,6 @@ import com.google.gson.JsonObject;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.GuiConfigV2;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.dungeon.MapProcessor;
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;
- }
-
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
index 7b2d5ba0..c71639cd 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
@@ -21,9 +21,7 @@ package kr.syeyoung.dungeonsguide.features;
import com.google.common.base.Supplier;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.*;
import kr.syeyoung.dungeonsguide.config.types.TypeConverter;
import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
@@ -84,11 +82,15 @@ public abstract class AbstractFeature {
return object;
}
- public String getEditRoute(final GuiConfig config) {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
ConfigPanelCreator.map.put("base." + key , new Supplier<MPanel>() {
@Override
public MPanel get() {
- return new PanelDefaultParameterConfig(config, AbstractFeature.this, Collections.emptyList(), Collections.emptySet());
+ MFeatureEdit featureEdit = new MFeatureEdit(AbstractFeature.this, rootConfigPanel);
+ for (FeatureParameter parameter: getParameters()) {
+ featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(AbstractFeature.this, parameter, rootConfigPanel));
+ }
+ return featureEdit;
}
});
return "base." + key ;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index b1db6d2d..bf0d8961 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -51,6 +51,8 @@ public class FeatureRegistry {
private static final Map<String, AbstractFeature> featureByKey = new HashMap<String, AbstractFeature>();
@Getter
private static final Map<String, List<AbstractFeature>> featuresByCategory = new HashMap<String, List<AbstractFeature>>();
+ @Getter
+ private static final Map<String, String> categoryDescription = new HashMap<>();
public static AbstractFeature getFeatureByKey(String key) {
return featureByKey.get(key);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
index 4c60c090..396d244d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
@@ -19,7 +19,7 @@
package kr.syeyoung.dungeonsguide.features;
import com.google.gson.JsonObject;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.GuiConfigV2;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.config.types.GUIRectangle;
import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry;
@@ -135,11 +135,11 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender
setOnActionPerformed(() -> {
GuiScreen guiScreen = guiGuiLocationConfig.getBefore();
if (guiScreen == null) {
- guiScreen = new GuiConfig();
+ guiScreen = new GuiConfigV2();
}
Minecraft.getMinecraft().displayGuiScreen(guiScreen);
- if (guiScreen instanceof GuiConfig) {
- ((GuiConfig) guiScreen).getTabbedPane().setCurrentPage(getEditRoute((GuiConfig) guiScreen));
+ if (guiScreen instanceof GuiConfigV2) {
+ ((GuiConfigV2) guiScreen).getRootConfigPanel().setCurrentPageAndPushHistory(getEditRoute(((GuiConfigV2) guiScreen).getRootConfigPanel()));
}
});
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java
index 1711f955..8e585a0b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java
@@ -21,11 +21,13 @@ package kr.syeyoung.dungeonsguide.features.impl.boss;
import com.google.common.base.Supplier;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MFeatureEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MParameterEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel;
import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
@@ -177,14 +179,17 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP
@Override
- public String getEditRoute(final GuiConfig config) {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() {
@Override
public MPanel get() {
- return new PanelDefaultParameterConfig(config, FeatureWarningOnPortal.this,
- Arrays.asList(new MPanel[] {
- new PanelTextParameterConfig(config, FeatureWarningOnPortal.this)
- }), Collections.singleton("textStyles"));
+ MFeatureEdit featureEdit = new MFeatureEdit(FeatureWarningOnPortal.this, rootConfigPanel);
+ featureEdit.addParameterEdit("textStyles", new PanelTextParameterConfig(FeatureWarningOnPortal.this));
+ for (FeatureParameter parameter: getParameters()) {
+ if (parameter.getKey().equals("textStyles")) continue;
+ featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureWarningOnPortal.this, parameter, rootConfigPanel));
+ }
+ return featureEdit;
}
});
return "base." + getKey() ;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java
index c81539a0..7a46de61 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java
@@ -18,8 +18,8 @@
package kr.syeyoung.dungeonsguide.features.impl.cosmetics;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
@@ -30,8 +30,8 @@ public class FeatureNicknameColor extends SimpleFeature {
}
@Override
- public String getEditRoute(final GuiConfig config) {
- ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI(config, "color", new String[] {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
+ ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI("color", new String[] {
"§9Party §8> §r§a[RANK§6+§a] %prefix%%name%§f: TEST",
"§2Guild > §r§a[RANK§6+§a] %prefix%%name% §3[Vet]§f: TEST",
"§dTo §r§r§a[RANK§r§6+§r§a] %prefix%%name%§r§7: §r§7TEST§r",
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java
index 4796eaa1..983e086b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java
@@ -18,8 +18,8 @@
package kr.syeyoung.dungeonsguide.features.impl.cosmetics;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
@@ -30,8 +30,8 @@ public class FeatureNicknamePrefix extends SimpleFeature {
}
@Override
- public String getEditRoute(final GuiConfig config) {
- ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI(config, "prefix", new String[] {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
+ ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI("prefix", new String[] {
"§9Party §8> §r%prefix% §a[RANK§6+§a] %name%§f: TEST",
"§2Guild > §r%prefix% §a[RANK§6+§a] %name% §3[Vet]§f: TEST",
"§dTo §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r",
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java
index e888edcf..4750831e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java
@@ -19,7 +19,6 @@
package kr.syeyoung.dungeonsguide.features.impl.cosmetics;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic;
import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData;
import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager;
@@ -37,12 +36,10 @@ import java.util.List;
import java.util.function.Function;
public class PrefixSelectorGUI extends MPanel {
- private GuiConfig config;
private String cosmeticType;
private Function<String, String> optionTransformer;
- public PrefixSelectorGUI(GuiConfig config, String cosmeticType, String[] previews, Function<String, String> optionTransformer) {
- this.config = config;
+ public PrefixSelectorGUI(String cosmeticType, String[] previews, Function<String, String> optionTransformer) {
this.cosmeticType = cosmeticType;
this.previews = previews;
this.optionTransformer = optionTransformer;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java
index 54631fcb..56ae9be8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java
@@ -84,7 +84,7 @@ public class FeatureDungeonRoomName extends TextHUDFeature {
Point roomPt = skyblockStatus.getContext().getMapProcessor().worldPointToRoomPoint(player.getPosition());
DungeonRoom dungeonRoom = skyblockStatus.getContext().getRoomMapper().get(roomPt);
List<StyledText> actualBit = new ArrayList<StyledText>();
- dummyText.add(new StyledText("You're in ","in"));
+ actualBit.add(new StyledText("You're in ","in"));
if (dungeonRoom == null) {
actualBit.add(new StyledText("Unknown","roomname"));
} else {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java
index 09e89928..e2ff6a17 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -35,10 +34,8 @@ import java.util.Set;
public class DataRendererEditor extends MPanel {
private final FeatureViewPlayerOnJoin feature;
- private final GuiConfig config;
- public DataRendererEditor(GuiConfig config, FeatureViewPlayerOnJoin featureViewPlayerOnJoin) {
- this.config = config;
+ public DataRendererEditor(FeatureViewPlayerOnJoin featureViewPlayerOnJoin) {
this.feature = featureViewPlayerOnJoin;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
index c1730ed7..62405303 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
@@ -24,11 +24,13 @@ import io.github.moulberry.hychat.HyChat;
import io.github.moulberry.hychat.chat.ChatManager;
import io.github.moulberry.hychat.gui.GuiChatBox;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MFeatureEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MParameterEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel;
import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic;
import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData;
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
@@ -585,14 +587,18 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen
@Override
- public String getEditRoute(final GuiConfig config) {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() {
@Override
public MPanel get() {
- return new PanelDefaultParameterConfig(config, FeatureViewPlayerOnJoin.this,
- Arrays.asList(new MPanel[] {
- new DataRendererEditor(config, FeatureViewPlayerOnJoin.this)
- }), Collections.singleton("datarenderers"));
+
+ MFeatureEdit featureEdit = new MFeatureEdit(FeatureViewPlayerOnJoin.this, rootConfigPanel);
+ featureEdit.addParameterEdit("datarenderers", new DataRendererEditor(FeatureViewPlayerOnJoin.this));
+ for (FeatureParameter parameter: getParameters()) {
+ if (parameter.getKey().equals("datarenderers")) continue;
+ featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureViewPlayerOnJoin.this, parameter, rootConfigPanel));
+ }
+ return featureEdit;
}
});
return "base." + getKey() ;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
index 224ace06..d9c97ff6 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -21,7 +21,6 @@ package kr.syeyoung.dungeonsguide.features.impl.secret;
import com.google.common.collect.Lists;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
@@ -78,7 +77,6 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
@Override
public void drawHUD(float partialTicks) {
if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig
- || Minecraft.getMinecraft().currentScreen instanceof GuiConfig
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
index 70c0b2be..904aaaee 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.features.text;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor;
@@ -47,15 +46,12 @@ public class PanelTextParameterConfig extends MPanel {
@Override
public void onBoundsUpdate() {
}
-
@Override
- public void resize(int parentWidth, int parentHeight) {
- this.setBounds(new Rectangle(5,5,parentWidth-10, 120));
+ public Dimension getPreferredSize() {
+ return new Dimension(400, 120);
}
- private final GuiConfig config;
- public PanelTextParameterConfig(final GuiConfig config, final StyledTextProvider feature) {
- this.config = config;
+ public PanelTextParameterConfig(final StyledTextProvider feature) {
this.feature = feature;
setBackgroundColor(new Color(38, 38, 38, 255));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
index b3488bdd..0aecc0e6 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
@@ -19,16 +19,20 @@
package kr.syeyoung.dungeonsguide.features.text;
import com.google.common.base.Supplier;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig;
+import com.google.gson.JsonObject;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.ConfigPanelCreator;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MFeatureEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.MParameterEdit;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.RootConfigPanel;
import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.old.PanelDefaultParameterConfig;
import kr.syeyoung.dungeonsguide.config.types.AColor;
+import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton;
import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement;
+import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton;
import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
@@ -40,10 +44,8 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
protected TextHUDFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) {
super(category, name, description, key, keepRatio, width, height);
this.parameters.put("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), "list_textStyle"));
- this.parameters.put("alignRight", new FeatureParameter<Boolean>("alignRight", "Align Right", "Align text to right", false, "boolean"));
- this.parameters.put("alignCenter", new FeatureParameter<Boolean>("alignCenter", "Align Center", "Align text to center (overrides alignright)", false, "boolean"));
+ this.parameters.put("alignment", new FeatureParameter<String>("alignment", "Alignment", "Alignment", "LEFT", "string"));
this.parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float"));
-
}
@Override
@@ -59,7 +61,8 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
scale = this.<Float>getParameter("scale").getValue();
}
GlStateManager.scale(scale, scale, 0);
- StyledTextRenderer.drawTextWithStylesAssociated(getText(), 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),this.<Boolean>getParameter("alignCenter").getValue() ? StyledTextRenderer.Alignment.CENTER : this.<Boolean>getParameter("alignRight").getValue() ? StyledTextRenderer.Alignment.RIGHT : StyledTextRenderer.Alignment.LEFT);
+ StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),
+ StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue()));
}
}
@@ -78,7 +81,9 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
scale = this.<Float>getParameter("scale").getValue();
}
GlStateManager.scale(scale, scale, 0);
- StyledTextRenderer.drawTextWithStylesAssociated(getDummyText(), 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),this.<Boolean>getParameter("alignCenter").getValue() ? StyledTextRenderer.Alignment.CENTER : this.<Boolean>getParameter("alignRight").getValue() ? StyledTextRenderer.Alignment.RIGHT : StyledTextRenderer.Alignment.LEFT);
+
+ StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),
+ StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue()));
}
public int countLines(List<StyledText> texts) {
@@ -124,14 +129,27 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
@Override
- public String getEditRoute(final GuiConfig config) {
+ public String getEditRoute(RootConfigPanel rootConfigPanel) {
ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() {
@Override
public MPanel get() {
- return new PanelDefaultParameterConfig(config, TextHUDFeature.this,
- Arrays.asList(new MPanel[] {
- new PanelTextParameterConfig(config, TextHUDFeature.this)
- }), Collections.singleton("textStylesNEW"));
+
+ MFeatureEdit featureEdit = new MFeatureEdit(TextHUDFeature.this, rootConfigPanel);
+ featureEdit.addParameterEdit("textStyleNEW", new PanelTextParameterConfig(TextHUDFeature.this));
+
+ StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue());
+ MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name());
+ mStringSelectionButton.setOnUpdate(() -> {
+ TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected());
+ });
+ featureEdit.addParameterEdit("alignment", new MParameterEdit(TextHUDFeature.this, TextHUDFeature.this.<String>getParameter("alignment"), rootConfigPanel, mStringSelectionButton));
+
+ for (FeatureParameter parameter: getParameters()) {
+ if (parameter.getKey().equals("textStylesNEW")) continue;
+ if (parameter.getKey().equals("alignment")) continue;
+ featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(TextHUDFeature.this, parameter, rootConfigPanel));
+ }
+ return featureEdit;
}
});
return "base." + getKey() ;
@@ -140,18 +158,13 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
@Override
public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) {
List<MPanel> mPanels = super.getTooltipForEditor(guiGuiLocationConfig);
- mPanels.add(new MPassiveLabelAndElement("Align Right", new MToggleButton() {{
- setEnabled(TextHUDFeature.this.<Boolean>getParameter("alignRight").getValue());
- setOnToggle(() ->{
- TextHUDFeature.this.<Boolean>getParameter("alignRight").setValue(isEnabled());
- }); }
- }));
- mPanels.add(new MPassiveLabelAndElement("Align Center", new MToggleButton() {{
- setEnabled(TextHUDFeature.this.<Boolean>getParameter("alignCenter").getValue());
- setOnToggle(() ->{
- TextHUDFeature.this.<Boolean>getParameter("alignCenter").setValue(isEnabled());
- }); }
- }));
+ StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(this.<String>getParameter("alignment").getValue());
+ MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name());
+ mStringSelectionButton.setOnUpdate(() -> {
+ TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected());
+ });
+
+ mPanels.add(new MPassiveLabelAndElement("Alignment", mStringSelectionButton));
if (!doesScaleWithHeight()) {
mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Float>getParameter("scale").getValue()) {{
setOnUpdate(() ->{
@@ -162,4 +175,14 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
return mPanels;
}
+
+ @Override
+ public void loadConfig(JsonObject jsonObject) {
+ super.loadConfig(jsonObject);
+ StyledTextRenderer.Alignment alignment;
+ try {
+ alignment = StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue());
+ } catch (Exception e) {alignment = StyledTextRenderer.Alignment.LEFT;}
+ TextHUDFeature.this.<String>getParameter("alignment").setValue(alignment.name());
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java
index d523c923..f086c997 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java
@@ -111,6 +111,7 @@ public class MGui extends GuiScreen {
try {
Mouse.setNativeCursor(null);
+ mainPanel.setCursor(EnumCursor.DEFAULT);
} catch (LWJGLException e) {
e.printStackTrace();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
index 126d69b6..99010090 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
@@ -153,9 +153,9 @@ public class MPanel {
GlStateManager.popAttrib();
GlStateManager.popMatrix();
if (debug && lastAbsClip.contains(absMousex, absMousey)) {
- Gui.drawRect(0, 0, getBounds().width, getBounds().height, 0x2200FF00);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
-// Gui.drawRect(0, 0, getPreferredSize().width, getPreferredSize().height, 0x220000FF);
+ Gui.drawRect(0, 0, getBounds().width, getBounds().height, 0x2200FF00);
+ Gui.drawRect(0, 0, getPreferredSize().width, getPreferredSize().height, 0x220000FF);
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
@@ -175,7 +175,7 @@ public class MPanel {
public void clip(int x, int y, int width, int height) {
if (width < 0 || height < 0) return;
- GL11.glScissor((int) (x * scale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * scale), (int)(width* scale), (int) (height * scale));
+ GL11.glScissor((int) (x * scale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * scale), (int)(width* scale + scale) - 1, (int) (height * scale + scale) - 1);
}
protected Rectangle determineClip(Rectangle rect1, Rectangle rect2) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
index 1a1f30d4..ff8061e7 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
@@ -41,6 +41,7 @@ public class MButton extends MPanel {
private int background = RenderUtils.blendAlpha(0xFF141414, 0.08f);
private int hover = RenderUtils.blendAlpha(0xFF141414, 0.14f);
private int clicked = RenderUtils.blendAlpha(0xFF141414, 0.16f);
+ private int border = 0x0;
private int disabled =0xFF141414;
private boolean enabled = true;
@@ -59,8 +60,12 @@ public class MButton extends MPanel {
} else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) {
bg = hover;
}
- Gui.drawRect(0,0,getBounds().width, getBounds().height, bg);
-
+ if (((border >> 24) & 0xFF) == 0)
+ Gui.drawRect(0,0,getBounds().width, getBounds().height, bg);
+ else {
+ Gui.drawRect(0, 0, getBounds().width, getBounds().height, border);
+ Gui.drawRect(1, 1, getBounds().width-1, getBounds().height-1, bg);
+ }
FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
int width = renderer.getStringWidth(getText());
int x = (getBounds().width - width) / 2;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
index 20fa2c93..85b86f40 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
@@ -84,7 +84,7 @@ public class MCollapsable extends MPanel {
super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks);
clip(lastAbsClip.x, lastAbsClip.y, lastAbsClip.width, lastAbsClip.height);
-// GL11.glEnable(GL11.GL_SCISSOR_TEST);
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlStateManager.pushMatrix();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
index f47f1fd0..888d1e03 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
@@ -25,6 +25,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;
@@ -80,7 +81,7 @@ public class MEditableAColor extends MPanel {
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
if (!enableEdit) return;
- if (lastAbsClip.contains(absMouseX, absMouseY) && portable == null) {
+ if (lastAbsClip.contains(absMouseX, absMouseY) && getTooltipsOpen() == 0) {
portable = new MPortableColorEdit() {
@Override
public void update2() {
@@ -91,11 +92,16 @@ public class MEditableAColor extends MPanel {
}
};
portable.setColor(color);
- portable.setBounds(new Rectangle(relMouseX, relMouseY, 100, 90));
- add(portable);
- } else if (portable != null && !portable.getBounds().contains(relMouseX, relMouseY)) {
- remove(portable);
- portable = null;
+ Rectangle startWith = new Rectangle((int)(absMouseX * getScale()), (int) (absMouseY* getScale()), (int) (100 * getScale()), (int) (90 * getScale()));
+ if (startWith.x < 10) startWith.x = 10;
+ if (startWith.y < 10) startWith.y = 10;
+ if (startWith.x + startWith.width > Minecraft.getMinecraft().displayWidth - 10) startWith.x = Minecraft.getMinecraft().displayWidth - 10 - startWith.width;
+ if (startWith.y + startWith.height > Minecraft.getMinecraft().displayHeight - 10) startWith.y = Minecraft.getMinecraft().displayHeight - 10 - startWith.height;
+ portable.setBounds(startWith);
+
+
+ portable.setScale(2.0f);
+ portable.open(this);
}
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
index 9719f63f..8823087e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
@@ -43,8 +43,9 @@ public class MList extends MPanel {
int y = 0;
for (MPanel childComponent : getChildComponents()) {
Dimension preferedSize = childComponent.getPreferredSize();
- childComponent.setBounds(new Rectangle(0, y, bounds.width, Math.max(10, preferedSize.height)));
- y += preferedSize.height;
+ int height = Math.max(10, preferedSize.height);
+ childComponent.setBounds(new Rectangle(0, y, bounds.width, height));
+ y += height;
if (gap > 0)
y += gap;
}
@@ -57,8 +58,9 @@ public class MList extends MPanel {
int h = 0;
for (MPanel childComponent : getChildComponents()) {
Dimension preferedSize = childComponent.getPreferredSize();
+ int height = Math.max(10, preferedSize.height);
if (preferedSize.width > maxW) maxW = preferedSize.width;
- h += preferedSize.height;
+ h += height;
if (gap > 0) h += gap;
}
return new Dimension(maxW, Math.max(0, h-gap));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
index 4a1d30ee..169e99b5 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
@@ -30,15 +30,16 @@ import java.awt.*;
public class MPanelScaledGUI extends MPanel {
@Getter
- private double scale = 1.0;
+ protected double scale = 1.0;
- private double relativeScale;
+ protected double relativeScale;
public void setScale(double scale) {
this.scale = scale;
for (MPanel childComponent : childComponents) {
childComponent.resize0((int) (getBounds().width/scale), (int) (getBounds().height/scale));
}
+ onBoundsUpdate();
}
@Override
@@ -84,6 +85,7 @@ public class MPanelScaledGUI extends MPanel {
GlStateManager.scale(this.scale, this.scale, 1);
clip = new Rectangle((int) (clip.x / scale), (int) (clip.y / scale), (int) (clip.width / scale), (int) (clip.height / scale));
+ lastAbsClip = clip;
this.relativeScale = parentScale * this.scale;
@@ -119,7 +121,7 @@ public class MPanelScaledGUI extends MPanel {
for (MPanel mPanel : getChildComponents()){
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
- mPanel.render0(scale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks);
+ mPanel.render0(relativeScale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks);
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
index 9bd3b130..6b2f162e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
@@ -36,7 +36,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
-public class MPortableColorEdit extends MPanel {
+public class MPortableColorEdit extends MTooltip {
private final float[] hsv = new float[3];
private float alpha = 0;
@@ -71,7 +71,7 @@ public class MPortableColorEdit extends MPanel {
public void onBoundsUpdate() {
super.onBoundsUpdate();
- textField.setBounds(new Rectangle(5, getBounds().height - 25, getBounds().width - 10, 20));
+ textField.setBounds(new Rectangle(5, getEffectiveDimension().height - 25, getEffectiveDimension().width - 10, 20));
}
public void setColor(AColor color) {
@@ -88,11 +88,12 @@ public class MPortableColorEdit extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ Dimension size = getEffectiveDimension();
- Gui.drawRect(0,0,getSize().width,getSize().height, 0xff333333);
- Gui.drawRect(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1);
+ Gui.drawRect(0,0,size.width,size.height, 0xff333333);
+ Gui.drawRect(1,1,size.width-1,size.height-1, 0xffa1a1a1);
- int width = getBounds().height- 35;
+ int width = size.height- 35;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL);
@@ -200,60 +201,20 @@ public class MPortableColorEdit extends MPanel {
GlStateManager.color(1,1,1,1);
}
- @Override
- public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
- int relMousex = relMousex0 - getBounds().x;
- int relMousey = relMousey0 - getBounds().y;
-
- GlStateManager.translate(getBounds().x, getBounds().y, 0);
- GlStateManager.color(1,1,1,0);
-
-
- Rectangle absBound = getBounds().getBounds();
- absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y);
- Rectangle clip = determineClip(parentClip, absBound);
- lastAbsClip = clip;
-this.scale =scale;
- clip(clip.x, clip.y, clip.width, clip.height);
- GlStateManager.pushAttrib();
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
-
- GlStateManager.pushAttrib();
- GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB());
- GlStateManager.popAttrib();
-
- GlStateManager.pushMatrix();
- GlStateManager.pushAttrib();
- render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip);
- GlStateManager.popAttrib();
- GlStateManager.popMatrix();
-
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- GlStateManager.popAttrib();
-
-
- Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y);
-
- for (MPanel mPanel : getChildComponents()){
- GlStateManager.pushMatrix();
- GlStateManager.pushAttrib();
- mPanel.render0(scale, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks);
- GlStateManager.popAttrib();
- GlStateManager.popMatrix();
- }
- }
-
private int selected = 0;
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
- int width = getBounds().height- 35;
+ int width = getEffectiveDimension().height- 35;
float radius = width / 2f;
float circleX = 5 + radius;
float circleY = 5 + radius;
selected = 0;
- if (!getBounds().contains(relMouseX, relMouseY)) return;
+ if (!lastAbsClip.contains(absMouseX, absMouseY)) {
+ close();
+ return;
+ }
{
// check circle
@@ -292,7 +253,7 @@ this.scale =scale;
@Override
public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
- int width = getBounds().height- 35;
+ int width = getEffectiveDimension().height- 35;
float radius = width / 2f;
float circleX = 5 + radius;
float circleY = 5 + radius;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
index 1797297a..82e91dab 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
@@ -42,6 +42,30 @@ public class MScrollBar extends MPanel {
@Setter
private int width = 10;
+ public void setMax(int max) {
+ this.max = max;
+
+ current = MathHelper.clamp_int(current, min, max - thumbSize);
+ if (max - min < thumbSize) current = min;
+ if (onUpdate != null) onUpdate.run();
+ }
+
+ public void setMin(int min) {
+ this.min = min;
+
+ current = MathHelper.clamp_int(current, min, max - thumbSize);
+ if (max - min < thumbSize) current = min;
+ if (onUpdate != null) onUpdate.run();
+ }
+
+ public void setThumbSize(int thumbSize) {
+ this.thumbSize = thumbSize;
+
+ current = MathHelper.clamp_int(current, min, max - thumbSize);
+ if (max - min < thumbSize) current = min;
+ if (onUpdate != null) onUpdate.run();
+ }
+
public void addToCurrent(int dv) {
int current2 = current + dv;
@@ -72,6 +96,12 @@ public class MScrollBar extends MPanel {
this.onUpdate = onUpdate;
}
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ lastThumbRect.width = 0; lastThumbRect.height = 0;
+ }
+
private Rectangle lastThumbRect = new Rectangle();
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
@@ -156,7 +186,8 @@ public class MScrollBar extends MPanel {
public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
if (grabbed)
setCursor(EnumCursor.CLOSED_HAND);
- else if (lastThumbRect.contains(relMouseX0, relMouseY0))
+ else if (lastThumbRect.contains(relMouseX0, relMouseY0)) {
setCursor(EnumCursor.OPEN_HAND);
+ }
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
index 42a3cb91..d09b7c5a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
@@ -102,9 +102,9 @@ public class MScrollablePanel extends MPanel {
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor);
- boolean hideX = false, hideY = false;
- if (bounds.width > contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true;
- if (bounds.height > contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true;
+ boolean hideX = (axis & 2) == 0, hideY = (axis & 1) == 0;
+ if (bounds.width >= contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true;
+ if (bounds.height >= contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true;
if (axis == 3 && !(hideX && hideY)) {
Gui.drawRect(scrollBarX.getBounds().width, scrollBarY.getBounds().height, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.03f));
}
@@ -161,6 +161,7 @@ public class MScrollablePanel extends MPanel {
scrollBarX.setThumbSize(viewPort.getBounds().width);
scrollBarY.setThumbSize(viewPort.getBounds().height);
+ evalulateContentArea();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java
index 95882085..7666865a 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java
@@ -48,6 +48,8 @@ public class MStringSelectionButton extends MPanel {
dec = new MButton(); dec.setText("<"); add(dec);
inc = new MButton(); inc.setText(">"); add(inc);
selected = new MLabel(); updateSelected(); add(selected);
+ selected.setBackgroundColor(Color.black);
+ selected.setAlignment(MLabel.Alignment.CENTER);
dec.setOnActionPerformed(new Runnable() {
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
index 6054a68f..b61837a4 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
@@ -22,11 +22,13 @@ 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;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.MathHelper;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
@@ -39,8 +41,11 @@ import java.io.IOException;
@Getter
public class MTextField extends MPanel {
private final Color foreground = Color.white;
+ private final Color placeHolderColor = Color.lightGray;
private String text = "";
+ @Setter
+ private String placeHolder = "";
private int cursorBlickTicker = 0;
private int selectionStart = 0;
@@ -62,9 +67,22 @@ public class MTextField extends MPanel {
edit(text);
}
+ private void setCursor0(int cursor) {
+ if (cursor > text.length()) cursor = text.length();
+ if (cursor < 0) cursor = 0;
+ this.cursor = cursor;
+
+
+ int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text.substring(0, cursor));
+ int cursorX = width + 3- xOffset;
+ cursorX = MathHelper.clamp_int(cursorX,10, getBounds().width - 10);
+ xOffset = width+ 3 - cursorX;
+ xOffset = MathHelper.clamp_int(xOffset, 0,Math.max(0, Minecraft.getMinecraft().fontRendererObj.getStringWidth(text) - getBounds().width+10));
+ }
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) {
+ clip(clip.x - 1, clip.y - 1, clip.width +2, clip.height + 2);
Gui.drawRect(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB());
Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB());
@@ -76,6 +94,8 @@ public class MTextField extends MPanel {
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
fr.drawString(text, 3 - xOffset, y, foreground.getRGB());
+ if (text.isEmpty())
+ fr.drawString(placeHolder, 3, y, placeHolderColor.getRGB());
// draw selection
if (isFocused) {
if (selectionStart != -1) {
@@ -90,7 +110,7 @@ public class MTextField extends MPanel {
// draw cursor
if (cursor != -1) {
- if (cursor > text.length()) cursor = text.length();
+ if (cursor > text.length()) setCursor0(text.length());
int x = fr.getStringWidth(text.substring(0, cursor)) - xOffset;
cursorBlickTicker++;
if (cursorBlickTicker < 10)
@@ -120,11 +140,11 @@ public class MTextField extends MPanel {
for (int i = 0; i < text.length(); i++) {
int totalWidth = fr.getStringWidth(text.substring(0, i));
if (offseted < totalWidth) {
- cursor = i;
+ setCursor0(i);
return;
}
}
- cursor = text.length();
+ setCursor0(text.length());
}
@Override
@@ -184,31 +204,35 @@ public class MTextField extends MPanel {
if (selectionStart == -1) {
if (keycode == 199) { // home
- cursor = 0;
+ setCursor0(0);
+ xOffset = 0;
return;
}
if (keycode == 207) { // end
- cursor = text.length();
+ setCursor0(text.length());
+
+ int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text);
+ xOffset = Integer.max(0, width - getBounds().width+10);
return;
}
if (keycode == 203) { // left
- cursor--;
- if (cursor < 0) cursor = 0;
+ setCursor0(this.cursor-1);;
+ if (cursor < 0) setCursor0(0);
return;
}
if (keycode == 205) { // right
- cursor ++;
- if (cursor > text.length()) cursor = text.length();
+ setCursor0(this.cursor+1);
+ if (cursor > text.length()) setCursor0(text.length());
return;
}
// backspace
if (keycode == 14 && cursor > 0) {
- setText0(this.text.substring(0, cursor - 1) + this.text.substring(cursor));
- cursor--;
+ setText0(this.text.substring(0, cursor-1) + this.text.substring(cursor));
+ setCursor0(this.cursor-1);
return;
}
@@ -257,30 +281,33 @@ public class MTextField extends MPanel {
this.text.substring(0, this.cursor)
+ typedChar
+ this.text.substring(this.cursor));
- this.cursor++;
+ this.setCursor0(this.cursor+1);;
return;
}
} else {
if (keycode == 199) { // home
- cursor = 0;
+ setCursor0(0);
selectionStart = -1;
+ xOffset =0;
return;
}
if (keycode == 207) { // end
selectionStart = -1;
- cursor = text.length();
+ setCursor0(text.length());
+ int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text);
+ xOffset = Integer.max(0, width - getBounds().width+10);
return;
}
if (keycode == 203) { // left
- cursor = selectionStart;
+ setCursor0(selectionStart);
selectionStart = -1;
return;
}
if (keycode == 205) { // right
- cursor = selectionEnd;
+ setCursor0(selectionEnd);
selectionStart = -1;
return;
}
@@ -288,7 +315,7 @@ public class MTextField extends MPanel {
// backspace
if (keycode == 14 && cursor > 0) {
setText0(this.text.substring(0, selectionStart) + this.text.substring(selectionEnd));
- cursor = selectionStart;
+ setCursor0(selectionStart);
selectionStart = -1;
return;
}
@@ -296,7 +323,7 @@ public class MTextField extends MPanel {
//del
if (keycode == 211 && cursor < text.length()) {
setText0(this.text.substring(0, selectionStart) + this.text.substring(selectionEnd));
- cursor = selectionStart;
+ setCursor0(selectionStart);
selectionStart = -1;
return;
}
@@ -323,7 +350,7 @@ public class MTextField extends MPanel {
this.text.substring(0, this.selectionStart)
+ theText
+ this.text.substring(this.selectionEnd));
- cursor = this.selectionStart + theText.toString().length();
+ setCursor0(this.selectionStart + theText.toString().length());
} catch (UnsupportedFlavorException e) {
e.printStackTrace();
} catch (IOException e) {
@@ -358,7 +385,7 @@ public class MTextField extends MPanel {
this.text.substring(0, this.selectionStart)
+ typedChar
+ this.text.substring(this.selectionEnd));
- this.cursor = this.selectionStart + 1;
+ this.setCursor0(this.selectionStart + 1);
selectionStart = -1;
return;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
index d3a3fe06..5709906f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
@@ -38,14 +38,16 @@ public class MToggleButton extends MPanel {
private boolean enabled = true;
private Runnable onToggle;
+ private int border = 0xFF333333, background = 0xFF171717;
+
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) {
Dimension bounds = getSize();
int gap = 1;
- Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF333333);
- Gui.drawRect(gap, gap, bounds.width-gap, bounds.height-gap, 0xFF171717);
+ Gui.drawRect(0, 0, bounds.width, bounds.height, border);
+ Gui.drawRect(gap, gap, bounds.width-gap, bounds.height-gap, background);
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
index 7492f17d..89967f5b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
@@ -28,7 +28,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
-public class MTooltip extends MPanel {
+public class MTooltip extends MPanelScaledGUI {
@Getter @Setter
private MRootPanel root;
@@ -50,22 +50,37 @@ public class MTooltip extends MPanel {
return super.getTooltipsOpen() - 1;
}
- public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a
- int relMousex = relMousex0 - getBounds().x;
- int relMousey = relMousey0 - getBounds().y;
+ @Override
+ public void render0(double parentScale, Point parentPoint, Rectangle parentClip, int absMousex0, int absMousey0, int relMousex0, int relMousey0, float partialTicks) {
+ lastParentPoint = parentPoint;
GlStateManager.translate(getBounds().x, getBounds().y, 300);
GlStateManager.color(1,1,1,0);
+ Rectangle absBound = getBounds().getBounds();
+ absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y);
+
+ Rectangle clip = absBound;
+ lastAbsClip = clip;
+
+ if (clip.getSize().height * clip.getSize().width == 0) return;
+
+ int absMousex = (int) (absMousex0 / scale), absMousey = (int) (absMousey0 / scale);
+ int relMousex = (int) ((relMousex0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMousey0 - getBounds().y) /scale);
+
+ // FROM HERE, IT IS SCALED
- Rectangle clip = getBounds().getBounds();
+ GlStateManager.scale(this.scale, this.scale, 1);
+ clip = new Rectangle((int) (clip.x / scale), (int) (clip.y / scale), (int) (clip.width / scale), (int) (clip.height / scale));
+ lastAbsClip = clip;
GlStateManager.pushAttrib();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
- this.scale = scale;
+ this.relativeScale = parentScale * this.scale;
clip(clip.x, clip.y, clip.width, clip.height);
GlStateManager.pushAttrib();
- GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB());
+ GuiScreen.drawRect(0,0, (int) (getBounds().width / scale), (int) (getBounds().height / scale), backgroundColor.getRGB());
GlStateManager.enableBlend();
GlStateManager.popAttrib();
@@ -79,12 +94,12 @@ public class MTooltip extends MPanel {
GlStateManager.popAttrib();
- Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y);
+ Point newPt = new Point((int) ((parentPoint.x + getBounds().x) / scale), (int) ((parentPoint.y + getBounds().y) / scale));
for (MPanel mPanel : getChildComponents()){
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
- mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks);
+ mPanel.render0(relativeScale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks);
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
index 1cb3d548..eb4d8987 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
@@ -22,9 +22,19 @@ import lombok.AllArgsConstructor;
import lombok.Data;
@Data
-@AllArgsConstructor
public class Parameter {
private String name;
private Object previousData;
private Object newData;
+
+ public Parameter(String name, Object previousData, Object newData) {
+ this.name = name; this.previousData = previousData; this.newData = newData;
+ }
+
+ private Runnable onSetNewData;
+
+ public void setNewData(Object newData) {
+ this.newData = newData;
+ if (onSetNewData != null) onSetNewData.run();
+ }
}