diff options
Diffstat (limited to 'src/main/java')
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 MIntegerSelect |
