Begin work on clickgui settings

This commit is contained in:
ThisIsALegitUsername 2023-04-05 09:35:58 -06:00
parent 90e65754e0
commit 080b939548
2 changed files with 45 additions and 13 deletions

View File

@ -112,8 +112,7 @@ public class ClickGuiRewrite extends GuiScreen {
//Draw module button //Draw module button
for (Mod m: Resent.INSTANCE.modManager.modules) { for (Mod m: Resent.INSTANCE.modManager.modules) {
if (!m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) && selectedMod == null) { if (!m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) && selectedMod == null) {
if (y + 115 + offset + scrollOffset > y + 95 && y + 185 + offset + scrollOffset < y + height && part == "Home") {
if (y + 115 + offset + scrollOffset > y + 95 && y + 185 + offset + scrollOffset < y + height) {
//Body //Body
RenderUtils.drawRoundedRect(x + 80, y + 115 + offset + scrollOffset, x + width - 20, y + 185 + offset + scrollOffset, 16, secondaryColor); RenderUtils.drawRoundedRect(x + 80, y + 115 + offset + scrollOffset, x + width - 20, y + 185 + offset + scrollOffset, 16, secondaryColor);
@ -141,14 +140,17 @@ public class ClickGuiRewrite extends GuiScreen {
} }
} }
GlStateManager.popMatrix();
if (selectedMod != null) { if (selectedMod != null) {
fr.drawString("<", x+80, y+115+offset, -1, false);
for (Comp comp: comps) { for (Comp comp: comps) {
comp.drawScreen(mouseX, mouseY); comp.drawScreen(mouseX, mouseY);
} }
} }
GlStateManager.popMatrix();
if (closing) { if (closing) {
comps.clear(); comps.clear();
if (introAnimation == null) { if (introAnimation == null) {
@ -170,9 +172,11 @@ public class ClickGuiRewrite extends GuiScreen {
if (isMouseInside(mouseX, mouseY, x + 20, (int) y + 170, x + 40, (int) y + 190)) { if (isMouseInside(mouseX, mouseY, x + 20, (int) y + 170, x + 40, (int) y + 190)) {
iforgor2 = false; iforgor2 = false;
iforgor = true; iforgor = true;
part = "Setting";
} else if (isMouseInside(mouseX, mouseY, x + 20, (int) y + 120, x + 40, (int) y + 140)) { } else if (isMouseInside(mouseX, mouseY, x + 20, (int) y + 120, x + 40, (int) y + 140)) {
iforgor = false; iforgor = false;
iforgor2 = true; iforgor2 = true;
part = "Home";
} }
if (isMouseInside(mouseX, mouseY, x + width - 300, y + 25, x + width - 50, y + 65)) { if (isMouseInside(mouseX, mouseY, x + width - 300, y + 25, x + width - 50, y + 65)) {
@ -184,20 +188,45 @@ public class ClickGuiRewrite extends GuiScreen {
int offset = 0; int offset = 0;
for (Mod m: Resent.INSTANCE.modManager.modules) { for (Mod m: Resent.INSTANCE.modManager.modules) {
if (!m.isAdmin()) { if (!m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) && selectedMod == null) {
if (y + 115 + offset + scrollOffset > y + 95 && y + 185 + offset + scrollOffset < y + height && part == "Home") {
if(isMouseInside(mouseX, mouseY, x + 80, y + 115 + offset + scrollOffset, x + width - 20, y + 185 + offset + scrollOffset)) {
if(mouseButton == 0) {
m.toggle();
}
if(mouseButton == 1) {
selectedMod = m;
for (Setting s: selectedMod.settings) {
if (s instanceof BooleanSetting) {
comps.add(new CompCheck(4, 4, selectedMod, s));
}
}
}
}
if (isMouseInside(mouseX, mouseY, x + width - 60, y + 140 + offset, x + width - 40, y + 160 + offset) && mouseButton == 0 && m.doesHaveSetting()) { if (isMouseInside(mouseX, mouseY, x + width - 60, y + 140 + offset, x + width - 40, y + 160 + offset) && mouseButton == 0 && m.doesHaveSetting()) {
for (Setting s: m.settings) { selectedMod = m;
for (Setting s: selectedMod.settings) {
if (s instanceof BooleanSetting) { if (s instanceof BooleanSetting) {
comps.add(new CompCheck(4, 4, selectedMod, s)); comps.add(new CompCheck(4, 4, selectedMod, s));
} }
} }
} }
}
offset += 80; offset += 80;
} }
} }
if (selectedMod != null) { if (selectedMod != null) {
if(isMouseInside(mouseX, mouseY, x+77, y+112, x+87, y+125)) {
selectedMod = null;
comps.clear();
}
for (Comp c: comps) { for (Comp c: comps) {
c.mouseClicked(mouseX, mouseY, mouseButton); c.mouseClicked(mouseX, mouseY, mouseButton);
} }
@ -205,6 +234,8 @@ public class ClickGuiRewrite extends GuiScreen {
} }
@Override @Override
public void initGui() { public void initGui() {
sr = new ScaledResolution(mc); sr = new ScaledResolution(mc);

View File

@ -5,6 +5,7 @@ import dev.resent.module.base.setting.BooleanSetting;
import dev.resent.module.base.setting.Setting; import dev.resent.module.base.setting.Setting;
import dev.resent.util.misc.FuncUtils; import dev.resent.util.misc.FuncUtils;
import dev.resent.visual.ui.clickgui.rewrite.comp.Comp; import dev.resent.visual.ui.clickgui.rewrite.comp.Comp;
import net.minecraft.client.gui.Gui;
public class CompCheck extends Comp{ public class CompCheck extends Comp{