Premium Gui Cursor Support

This commit is contained in:
kirillsaint 2023-08-30 17:21:42 +06:00
parent cee7749279
commit 198bf6789a
3 changed files with 36 additions and 8 deletions

View File

@ -62,7 +62,7 @@ public class Watermark {
y = 3; y = 3;
break; break;
} }
Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().getFullVersion(), x, y + (21 / 2) - 5 + 3, 10, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().getFullVersion(), x, y + (21 / 2) - 5 + 3, 10, SilentFontRenderer.FontType.TITLE);
} }

View File

@ -216,7 +216,10 @@ public class ClickGUI extends SilentScreen {
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15); RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
if(selectedCategory == ModCategory.PLUS) { if(selectedCategory == ModCategory.PLUS) {
PremiumGui.drawScreen(x, y, width, height, mouseX, mouseY, partialTicks, nametagMessageInput); MouseCursorHandler.CursorType premiumCursor = PremiumGui.drawScreen(x, y, width, height, mouseX, mouseY, partialTicks, nametagMessageInput);
if(premiumCursor != null) {
cursorType = premiumCursor;
}
} }
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);

View File

@ -32,35 +32,60 @@ import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
public class PremiumGui { public class PremiumGui {
public static void drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { public static MouseCursorHandler.CursorType drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) {
MouseCursorHandler.CursorType cursorType = null;
if(!Client.getInstance().getAccount().isPlus()) { if(!Client.getInstance().getAccount().isPlus()) {
RenderUtil.drawImage(new ResourceLocation("silentclient/premium/promo.png"), x + 95, y + 40, width - 100, (int) ((width - 100) / 1.777777777777778)); RenderUtil.drawImage(new ResourceLocation("silentclient/premium/promo.png"), x + 95, y + 40, width - 100, (int) ((width - 100) / 1.777777777777778));
StaticButton.render(x + 132, y + 148, 65, 12, "BUY PREMIUM"); StaticButton.render(x + 132, y + 148, 65, 12, "BUY PREMIUM");
StaticButton.render(x + 272, y + 148, 65, 12, "BUY PREMIUM+"); StaticButton.render(x + 272, y + 148, 65, 12, "BUY PREMIUM+");
return; if(StaticButton.isHovered(mouseX, mouseY, x + 132, y + 148, 65, 12) || StaticButton.isHovered(mouseX, mouseY, x + 272, y + 148, 65, 12)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
return cursorType;
} }
int settingY = y + 25; int settingY = y + 25;
int days = Client.getInstance().getAccount().getPlusExpiration(); int days = Client.getInstance().getAccount().getPlusExpiration();
Client.getInstance().getSilentFontRenderer().drawString(days != -1 ? days + " days left" : "Unknown Time Remaining", x + width - (Client.getInstance().getSilentFontRenderer().getStringWidth(days != -1 ? days + " days left" : "Unknown Time Remaining", 10, SilentFontRenderer.FontType.TITLE)) - 8, y + 8, 10, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString(days != -1 ? days + " days left" : "Unknown Time Remaining", x + width - (Client.getInstance().getSilentFontRenderer().getStringWidth(days != -1 ? days + " days left" : "Unknown Time Remaining", 10, SilentFontRenderer.FontType.TITLE)) - 8, y + 8, 10, SilentFontRenderer.FontType.TITLE);
ColorPicker.render(x, settingY, width, "Chroma Bandana Color", Client.getInstance().getAccount().getBandanaColor() == 50 ? ColorUtils.getChromaColor(0, 0, 1).getRGB() : Client.getInstance().getAccount().getBandanaColor()); ColorPicker.render(x, settingY, width, "Chroma Bandana Color", Client.getInstance().getAccount().getBandanaColor() == 50 ? ColorUtils.getChromaColor(0, 0, 1).getRGB() : Client.getInstance().getAccount().getBandanaColor());
if(ColorPicker.isHovered(mouseX, mouseY, x, settingY, width)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
settingY += 15; settingY += 15;
Client.getInstance().getSilentFontRenderer().drawString("Custom Capes", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString("Custom Capes", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
StaticButton.render(x + 310, settingY, 65, 12, Client.getInstance().getAccount().isPremiumPlus() ? "OPEN MENU" : "BUY PREMIUM+"); StaticButton.render(x + 310, settingY, 65, 12, Client.getInstance().getAccount().isPremiumPlus() ? "OPEN MENU" : "BUY PREMIUM+");
settingY += 15; if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
settingY += 15;
if(Client.getInstance().getAccount().isPremiumPlus()) { if(Client.getInstance().getAccount().isPremiumPlus()) {
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
settingY += 15; settingY += 15;
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Show Nametag Message", Client.getInstance().getAccount().showNametagMessage()); Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Show Nametag Message", Client.getInstance().getAccount().showNametagMessage());
settingY += 15; if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
settingY += 15;
Client.getInstance().getSilentFontRenderer().drawString("Nametag Message:", x + 100, settingY + (1), 12, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString("Nametag Message:", x + 100, settingY + (1), 12, SilentFontRenderer.FontType.TITLE);
input.render(mouseX, mouseY, x + 100 + ((190 * 2) - 108) / 2, settingY, ((190 * 2) - 108) / 2, true); input.render(mouseX, mouseY, x + 100 + ((190 * 2) - 108) / 2, settingY, ((190 * 2) - 108) / 2, true);
settingY += 20; if(input.isHovered()) {
cursorType = MouseCursorHandler.CursorType.EDIT_TEXT;
}
settingY += 20;
StaticButton.render(x + 322, settingY, 50, 12, "Save"); StaticButton.render(x + 322, settingY, 50, 12, "Save");
if(StaticButton.isHovered(mouseX, mouseY, x + 322, settingY, 50, 12)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
} else { } else {
Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString("Nametag Message Settings:", x + 100, settingY + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
StaticButton.render(x + 310, settingY, 65, 12, "BUY PREMIUM+"); StaticButton.render(x + 310, settingY, 65, 12, "BUY PREMIUM+");
} if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
}
return cursorType;
} }
public static void mouseClicked(int x, int y, int width, int height, int mouseX, int mouseY, int mouseButton, GuiScreen instance, Input input) { public static void mouseClicked(int x, int y, int width, int height, int mouseX, int mouseY, int mouseButton, GuiScreen instance, Input input) {