diff options
author | syeyoung <cyong06@naver.com> | 2021-08-05 13:58:10 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-08-05 13:58:10 +0900 |
commit | 57ac87ea35f3fcb3c23d35d69fdf8ecadde04940 (patch) | |
tree | ca6bf3539f92b84df66c2a557f7c4045552d160a /src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu | |
parent | 4bb44d9d85ad0edbc7df875029560e9c5e7ca459 (diff) | |
download | Skyblock-Dungeons-Guide-57ac87ea35f3fcb3c23d35d69fdf8ecadde04940.tar.gz Skyblock-Dungeons-Guide-57ac87ea35f3fcb3c23d35d69fdf8ecadde04940.tar.bz2 Skyblock-Dungeons-Guide-57ac87ea35f3fcb3c23d35d69fdf8ecadde04940.zip |
- Moving Packages
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu')
11 files changed, 0 insertions, 1188 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java deleted file mode 100644 index 76515e69..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/ConfigPanelCreator.java +++ /dev/null @@ -1,40 +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.nyu; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -public class ConfigPanelCreator implements Function<String, MPanel> { - public static final ConfigPanelCreator INSTANCE = new ConfigPanelCreator(); - - public static final Map<String, Supplier<MPanel>> map = new HashMap<String, Supplier<MPanel>>(); - - @Nullable - @Override - public MPanel apply(@Nullable String input) { - if (!map.containsKey(input)) return null; - return map.get(input).get(); - } -} 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 deleted file mode 100644 index 5ab53b67..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java +++ /dev/null @@ -1,59 +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.nyu; - -import kr.syeyoung.dungeonsguide.gui.MGui; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.util.MathHelper; - -import java.awt.*; - -public class GuiConfigV2 extends MGui { - - @Getter - private RootConfigPanel rootConfigPanel; - - public GuiConfigV2() { - rootConfigPanel = new RootConfigPanel(this); - getMainPanel().add(rootConfigPanel); - } - - - @Override - public void initGui() { - super.initGui(); - int dw = Minecraft.getMinecraft().displayWidth; - int dh = Minecraft.getMinecraft().displayHeight; - int width = MathHelper.clamp_int(dw - 200, 1250, 1500), height = MathHelper.clamp_int(dh - 200, 600, 800); - double scale = 2.0; - if (dw <= width || dh <= height) { - width = width/2; height = height/2; - scale = 1.0; - } - rootConfigPanel.setBounds(new Rectangle((dw-width)/2, (dh-height)/2, width,height)); - rootConfigPanel.setScale(scale); - } - - @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 deleted file mode 100644 index aefc29a2..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java +++ /dev/null @@ -1,99 +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.nyu; - -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; -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 MCategory extends MPanel { - - private NestedCategory nestedCategory; - private RootConfigPanel rootConfigPanel; - @Getter - @Setter - private Color hover = new Color(94, 94, 94, 255); - public MCategory(NestedCategory nestedCategory, RootConfigPanel rootConfigPanel) { - this.nestedCategory = nestedCategory; - this.rootConfigPanel = rootConfigPanel; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int border = RenderUtils.blendAlpha(0x141414, 0.12f); - if (!rootConfigPanel.getSearchWord().isEmpty() && (nestedCategory.categoryName().toLowerCase().contains(rootConfigPanel.getSearchWord()))) { - border = 0xFF02EE67; - } - - Gui.drawRect(0,0,getBounds().width, getBounds().height,border); - if (getBounds().height >= 28) - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(1,1,getBounds().width-1, 18, RenderUtils.blendAlpha(0x141414, 0.12f)); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(5,5,0); - GlStateManager.scale(1.0,1.0,0); - GlStateManager.enableBlend(); - 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((lastAbsClip.contains(absMousex, absMousey) ? "§n" : "") + nestedCategory.categoryName(), 0,0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - - fr.drawSplitString(FeatureRegistry.getCategoryDescription().getOrDefault(nestedCategory.categoryFull(), ""), 5, 23, getBounds().width -10, 0xFFBFBFBF); - } - - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - int descriptionHeight = - FeatureRegistry.getCategoryDescription().containsKey(nestedCategory.categoryFull()) ? - fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().get(nestedCategory.categoryFull()), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT - : -9; - - 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.setCurrentPageAndPushHistory(nestedCategory.categoryFull()); - } - - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY)) - setCursor(EnumCursor.POINTING_HAND); - } -} 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 deleted file mode 100644 index 7df00626..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategoryElement.java +++ /dev/null @@ -1,84 +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.nyu; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.function.Consumer; - -public class MCategoryElement extends MPanel { - private String category; - private Runnable onClick; - private int leftPad = 0; - private int offsetX; - private RootConfigPanel rootConfigPanel; - public MCategoryElement(String category, Runnable onClick, int leftPad, int offsetX, RootConfigPanel rooot) { - this.category = category; - this.onClick = onClick; - this.leftPad = leftPad; - this.offsetX = offsetX; - this.rootConfigPanel = rooot; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (rootConfigPanel.getCurrentPage().equals(category)) { - clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height); - Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.13f)); - } else if (lastAbsClip.contains(absMousex, absMousey) && getTooltipsOpen() == 0) { - clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height); - Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.09f)); - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - String name = category.substring(category.lastIndexOf(".")+1); - fr.drawString(name, leftPad,2,-1); - - } - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - return new Dimension(fr.getStringWidth(category.substring(category.lastIndexOf(".")+1)) + leftPad+10, fr.FONT_HEIGHT+4); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (!lastAbsClip.contains(absMouseX, absMouseY) || getTooltipsOpen() > 0) { return; } - if (onClick != null) onClick.run(); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); - - } - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY)) - setCursor(EnumCursor.POINTING_HAND); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java deleted file mode 100644 index 94ce0ad4..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeature.java +++ /dev/null @@ -1,154 +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.nyu; - -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -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; -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.*; -import java.util.ArrayList; -import java.util.List; - -public class MFeature extends MPanel { - - @Getter - private final AbstractFeature feature; - - private final List<MPanel> addons = new ArrayList<MPanel>(); - - @Getter @Setter - private Color hover; - - private final RootConfigPanel panel; - - public MFeature(final AbstractFeature abstractFeature, final RootConfigPanel panel) { - this.panel = panel; - this.feature = abstractFeature; - - if (abstractFeature.isDisyllable()) { - final MToggleButton mStringSelectionButton = new MToggleButton(); - mStringSelectionButton.setOnToggle(new Runnable() { - @Override - public void run() { - boolean selected = mStringSelectionButton.isEnabled(); - feature.setEnabled(selected); - } - }); - mStringSelectionButton.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f)); - addons.add(mStringSelectionButton); - mStringSelectionButton.setEnabled(feature.isEnabled()); - mStringSelectionButton.setSize(new Dimension(40, 15)); - add(mStringSelectionButton); - } - if (abstractFeature.getParameters().size() != 0) { - MButton button = new MButton(); - button.setText("Edit"); - button.setOnActionPerformed(new Runnable() { - @Override - public void run() { - 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("Relocate"); - button.setOnActionPerformed(new Runnable() { - @Override - public void run() { - 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(75, 15)); - add(button); - } - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - - int border = RenderUtils.blendAlpha(0x141414, 0.12f); - if (!panel.getSearchWord().isEmpty() && (feature.getName().toLowerCase().contains(panel.getSearchWord()) || feature.getDescription().toLowerCase().contains(panel.getSearchWord()))) { - border = 0xFF02EE67; - } - - Gui.drawRect(0,0,getBounds().width, getBounds().height,border); - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(1,1,getBounds().width-1, 18, RenderUtils.blendAlpha(0x141414, 0.12f)); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(5,5,0); - GlStateManager.scale(1.0,1.0,0); - GlStateManager.enableBlend(); - 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(feature.getName(), 0,0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - - fr.drawSplitString(feature.getDescription(), 5, 23, getBounds().width -10, 0xFFBFBFBF); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, getBounds().height)); - } - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int descriptionHeight = fr.listFormattedStringToWidth(feature.getDescription(), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT; - - return new Dimension(100, descriptionHeight + 28); - } - - @Override - public void onBoundsUpdate() { - int x = getBounds().width - 5; - for (MPanel panel : addons) { - panel.setBounds(new Rectangle(x - panel.getPreferredSize().width, 3, panel.getPreferredSize().width, 12)); - x -= panel.getPreferredSize().width + 5; - } - } -} 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 deleted file mode 100644 index fbc1924f..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MFeatureEdit.java +++ /dev/null @@ -1,114 +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.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 kr.syeyoung.dungeonsguide.gui.elements.MModal; -import kr.syeyoung.dungeonsguide.gui.elements.MModalConfirmation; - -import java.awt.*; -import java.util.HashMap; -import java.util.Map; - -public class MFeatureEdit extends MPanel { - private MList list; - private MButton goBack, resetToDefault; - 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); - resetToDefault = new MButton(); - resetToDefault.setText("Reset To Default"); - resetToDefault.setForeground(Color.red); - resetToDefault.setOnActionPerformed(() -> { - openResetConfirmation(); - }); - add(resetToDefault); - } - - public void openResetConfirmation() { - MModalConfirmation mModal = new MModalConfirmation("Are you sure?", - "Resetting to default will reset your configuration for the selected feature to default", - () -> { - for (FeatureParameter parameter : abstractFeature.getParameters()) { - parameter.setToDefault(); - } - abstractFeature.onParameterReset(); - rootConfigPanel.invalidatePage(abstractFeature.getEditRoute(rootConfigPanel)); - }, () -> {}); - mModal.setScale(getScale()); - mModal.getYes().setBorder(0xFFFF0000); - mModal.getYes().setText("Yes, Reset it"); - mModal.getNo().setText("Cancel"); - mModal.open(MFeatureEdit.this); - } - - 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)); - resetToDefault.setBounds(new Rectangle(bounds.width - 105, 5, 100, 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/MNotFound.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MNotFound.java deleted file mode 100644 index 0d58be44..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MNotFound.java +++ /dev/null @@ -1,40 +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.nyu; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class MNotFound extends MPanel { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,0,parentWidth,parentHeight)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("404 Not Found", (getBounds().width - fr.getStringWidth("404 Not Found")) / 2, (getBounds().height - fr.FONT_HEIGHT) / 2, -1); - } -} 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 deleted file mode 100644 index c2033f7a..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java +++ /dev/null @@ -1,84 +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.nyu; - -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MList; - -import java.awt.*; - -public class MPanelCategory extends MPanel { - - private NestedCategory key; - private RootConfigPanel rootConfigPanel; - - private MList list; - - public MPanelCategory(NestedCategory nestedCategory, RootConfigPanel rootConfigPanel) { - this.key = nestedCategory; - this.rootConfigPanel = rootConfigPanel; - - list = new MList(); - list.setDrawLine(false); - list.setGap(5); - add(list); - - for (NestedCategory value : nestedCategory.children().values()) { - list.add(new MCategory(value, rootConfigPanel)); - } - if (nestedCategory.parent() != null) { - String actualCategory = nestedCategory.categoryFull().substring(5); - if (FeatureRegistry.getFeaturesByCategory().containsKey(actualCategory)) - for (AbstractFeature abstractFeature : FeatureRegistry.getFeaturesByCategory().get(actualCategory)) { - MFeature mFeature = new MFeature(abstractFeature, rootConfigPanel); - list.add(mFeature); - mFeature.setHover(new Color(94, 94, 94, 255)); - } - } - list.realignChildren(); - - } - - @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); - list.setBounds(new Rectangle(5,5,bounds.width- 10, bounds.height - 10)); - list.realignChildren(); - } - - @Override - public Dimension getPreferredSize() { - Dimension prefSize = list.getPreferredSize(); - int wid = prefSize.width + 10; - int hei = prefSize.height + 10; - return new Dimension(wid, hei); - } -} 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 deleted file mode 100644 index b0fd43f0..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java +++ /dev/null @@ -1,155 +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.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(featureParameter.getDescription(), Math.max(50, 2*bounds.width/3-10)).size() * fr.FONT_HEIGHT; - return new Dimension(100, Math.max(30, descriptionHeight + 23)); - } - - @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/NestedCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/NestedCategory.java deleted file mode 100644 index 25e262b3..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/NestedCategory.java +++ /dev/null @@ -1,54 +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.nyu; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import lombok.experimental.Accessors; - -import java.util.HashMap; -import java.util.Map; - -@Data -@Accessors(chain = true, fluent = true) -public -class NestedCategory { - private final String categoryFull; - @EqualsAndHashCode.Exclude - private String categoryName; - @EqualsAndHashCode.Exclude - @ToString.Exclude - private NestedCategory parent; - - public NestedCategory(String categoryFull) { - this.categoryFull = categoryFull; - this.categoryName = categoryFull.substring(categoryFull.lastIndexOf(".") + 1); - } - - @EqualsAndHashCode.Exclude - @ToString.Exclude - private Map<String, NestedCategory> children = new HashMap<>(); - - public NestedCategory child(NestedCategory child) { - this.children.put(child.categoryName, child); - child.parent = this; - return this; - } -} 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 deleted file mode 100644 index 608976fe..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java +++ /dev/null @@ -1,305 +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.nyu; - -import com.google.common.base.Function; -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.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -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.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.*; - -public class RootConfigPanel extends MPanelScaledGUI { - private MScrollablePanel navigationScroll; - - private MList navigation = new MList(); - - private MScrollablePanel contentScroll; - - - private final Map<String, MPanel> pages = new HashMap<String, MPanel>(); - @Getter - @Setter - private Function<String, MPanel> pageGenerator = ConfigPanelCreator.INSTANCE; - @Getter - private String currentPage = ""; - - private GuiConfigV2 gui; - - private long lastPageSet = System.currentTimeMillis(); - - private MTextField search; - private MButton guiRelocate; - - private MButton github, discord; - - private final Stack<String> history = new Stack<String>(); - - public String getSearchWord() { - return search.getText().trim().toLowerCase(); - } - - public RootConfigPanel(GuiConfigV2 guiConfigV2) { - this.gui = guiConfigV2; - - search = new MTextField() { - @Override - public void edit(String str) { - setupNavigation(); - - setCurrentPageAndPushHistory(""); - if (!categoryMap.containsKey(lastOpenCategory)) { - for (Map.Entry<NestedCategory, MPanel> nestedCategoryMPanelEntry : categoryMap.entrySet()) { - if (nestedCategoryMPanelEntry.getValue() instanceof MCategoryElement) { - setCurrentPageAndPushHistory(nestedCategoryMPanelEntry.getKey().categoryFull()); - lastOpenCategory = nestedCategoryMPanelEntry.getKey(); - break; - } - } - } - for (Map.Entry<NestedCategory, MPanel> nestedCategoryMPanelEntry : categoryMap.entrySet()) { - if (nestedCategoryMPanelEntry.getValue() instanceof MCollapsable) { - ((MCollapsable) nestedCategoryMPanelEntry.getValue()).setCollapsed(false); - } - } - rePlaceElements(); - } - }; - 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); - - discord = new MButton(); github = new MButton(); - discord.setText("Discord"); github.setText("Github"); - discord.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67)); - github.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67)); - github.setOnActionPerformed(() -> { - try { - Desktop.getDesktop().browse(new URI("https://github.com/Dungeons-Guide/Skyblock-Dungeons-Guide/")); - } catch (IOException | URISyntaxException e) { - e.printStackTrace(); - } - }); - discord.setOnActionPerformed(() -> { - try { - Desktop.getDesktop().browse(new URI("https://discord.gg/VuxayCWGE8")); - } catch (IOException | URISyntaxException e) { - e.printStackTrace(); - } - }); - add(discord); add(github); - - navigationScroll = new MScrollablePanel(1); - navigationScroll.setHideScrollBarWhenNotNecessary(false); - - - add(navigationScroll); - navigationScroll.add(navigation); - - contentScroll = new MScrollablePanel(3); - contentScroll.setHideScrollBarWhenNotNecessary(true); - add(contentScroll); - - setupNavigation(); - navigation.setGap(0); - navigation.setDrawLine(false); - - setCurrentPageAndPushHistory("ROOT"); - rePlaceElements(); - - search.setFocused(true); - } - - - private Map<NestedCategory, MPanel> categoryMap = new HashMap<>(); - private NestedCategory lastOpenCategory; - private void setupNavigation() { - categoryMap.clear(); - for (MPanel childComponent : navigation.getChildComponents()) { - navigation.remove(childComponent); - } - NestedCategory root = new NestedCategory("ROOT"); - Set<String> categoryAllowed = new HashSet<>(); - String search = this.search.getText().trim().toLowerCase(); - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (search.isEmpty()) { - categoryAllowed.add("ROOT."+abstractFeature.getCategory()+"."); - } else if (abstractFeature.getName().toLowerCase().contains(search)) { - categoryAllowed.add("ROOT."+abstractFeature.getCategory()+"."); - } else if (abstractFeature.getDescription().toLowerCase().contains(search)) { - categoryAllowed.add("ROOT."+abstractFeature.getCategory()+"."); - } - } - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - String category = abstractFeature.getCategory(); - boolean test =false; - for (String s : categoryAllowed) { - if (s.startsWith("ROOT."+category+".")) { - test = true; - break; - } - } - if (!test) continue; - - NestedCategory currentRoot = root; - for (String s : category.split("\\.")) { - NestedCategory finalCurrentRoot = currentRoot; - if (currentRoot.children().containsKey(s)) - currentRoot = currentRoot.children().get(s); - else { - currentRoot.child(currentRoot = new NestedCategory(finalCurrentRoot.categoryFull()+"."+s)); - } - } - - } - - for (NestedCategory value : root.children().values()) { - setupNavigationRecursive(value, navigation, 0, 17); - } - ConfigPanelCreator.map.put("ROOT", () -> new MPanelCategory(root, this)); - } - 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(),() -> { - setCurrentPageAndPushHistory(nestedCategory.categoryFull()); - lastOpenCategory = nestedCategory; - }, 13 * depth + 17, offset, this); - parent.add(current); - categoryMap.put(nestedCategory, current); - } else { - MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull(),() -> { - setCurrentPageAndPushHistory(nestedCategory.categoryFull()); - lastOpenCategory = nestedCategory; - }, 3,offset, this); - MCollapsable mCollapsable = new MCollapsable(current, this::rePlaceElements); - mCollapsable.setLeftPad(offset-13); - mCollapsable.getLowerElements().setDrawLine(false); - mCollapsable.getLowerElements().setGap(0); - mCollapsable.setLeftPadElements(0); - parent.add(mCollapsable); - categoryMap.put(nestedCategory, mCollapsable); - - for (NestedCategory value : nestedCategory.children().values()) { - setupNavigationRecursive(value, mCollapsable, depth+1, offset+13); - } - } - } - - - public void setCurrentPageAndPushHistory(String currentPage) { - if (!this.currentPage.equals(currentPage)) - history.push(this.currentPage); - lastOpenCategory = null; - 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); - if (page == null) page = new MNotFound(); - pages.put(currentPage, page); - } - contentScroll.getContentArea().add(pages.get(currentPage)); - rePlaceElements(); - } - - public void invalidatePage(String page) { - pages.remove(page); - if (page.equals(currentPage)) - setupPage(); - } - - @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(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 - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - rePlaceElements(); - } - - @Override - public void setScale(double scale) { - super.setScale(scale); - rePlaceElements(); - } - - 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(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)); - - guiRelocate.setBounds(new Rectangle(5,5,100,15)); - github.setBounds(new Rectangle(effectiveDim.width - 80,5,75,15)); - discord.setBounds(new Rectangle(effectiveDim.width - 160,5,75,15)); - } -} |