diff options
author | syeyoung <cyong06@naver.com> | 2021-07-29 12:25:21 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-07-29 21:41:22 +0900 |
commit | ee96b0e9475fed7e80c4f7037ec5ad44cf07f6c2 (patch) | |
tree | 49d818ff38cb7f3e73113a5f563ce856df736f9e /src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig | |
parent | b95c84eece5cfbb1dd25a7e5d4b022863f643044 (diff) | |
download | Skyblock-Dungeons-Guide-ee96b0e9475fed7e80c4f7037ec5ad44cf07f6c2.tar.gz Skyblock-Dungeons-Guide-ee96b0e9475fed7e80c4f7037ec5ad44cf07f6c2.tar.bz2 Skyblock-Dungeons-Guide-ee96b0e9475fed7e80c4f7037ec5ad44cf07f6c2.zip |
Cursors complete
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig')
3 files changed, 204 insertions, 0 deletions
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 new file mode 100644 index 00000000..1f6977a0 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java @@ -0,0 +1,75 @@ +/* + * 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.old.MFeature; +import kr.syeyoung.dungeonsguide.gui.MPanel; +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) { + Gui.drawRect(0,0,getBounds().width, getBounds().height,0xFF444444); + + + 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("NO DESC", 5, 23, getBounds().width -10, 0xFFBFBFBF); + } + + + @Override + public Dimension getPreferredSize() { + return new Dimension(100, 17); + } + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + if (lastAbsClip.contains(absMouseX, absMouseY)) + rootConfigPanel.setCurrentPage(nestedCategory.categoryFull()); + } +} 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 new file mode 100644 index 00000000..5b6d9bbd --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MPanelCategory.java @@ -0,0 +1,83 @@ +/* + * 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.old.MFeature; +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)); + } + String actualCategory = nestedCategory.categoryFull().substring(5); + if (FeatureRegistry.getFeaturesByCategory().containsKey(actualCategory)) + for (AbstractFeature abstractFeature : FeatureRegistry.getFeaturesByCategory().get(actualCategory)) { + MFeature mFeature = new MFeature(abstractFeature, null); + 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); + Dimension prefSize = list.getPreferredSize(); + int wid = Math.max(prefSize.width + 10, parentWidth); + int hei = prefSize.height + 10; + setBounds(new Rectangle(0,0,wid,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/NestedCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/NestedCategory.java new file mode 100644 index 00000000..ac3b8f49 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/NestedCategory.java @@ -0,0 +1,46 @@ +/* + * 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.experimental.Accessors; + +import java.util.HashMap; +import java.util.Map; + +@Data +@Accessors(chain = true, fluent = true) +class NestedCategory { + private final String categoryFull; + private String categoryName; + private NestedCategory parent; + + public NestedCategory(String categoryFull) { + this.categoryFull = categoryFull; + this.categoryName = categoryFull.substring(categoryFull.lastIndexOf(".") + 1); + } + + private Map<String, NestedCategory> children = new HashMap<>(); + + public NestedCategory child(NestedCategory child) { + this.children.put(child.categoryName, child); + child.parent = this; + return this; + } +} |