Tutorial Cursor Support

This commit is contained in:
kirillsaint 2023-08-28 19:47:57 +06:00
parent fa082ed179
commit 00f17cacf7
2 changed files with 35 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept; import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.FileUtils; import net.silentclient.client.utils.FileUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
@ -25,6 +26,7 @@ public class UserTutorial extends SilentScreen {
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
defaultCursor = false;
this.configs.clear(); this.configs.clear();
this.buttonList.clear(); this.buttonList.clear();
Client.backgroundPanorama.updateWidthHeight(this.width, this.height); Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
@ -42,6 +44,7 @@ public class UserTutorial extends SilentScreen {
@Override @Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks); Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
@ -54,6 +57,9 @@ public class UserTutorial extends SilentScreen {
} }
RenderUtils.drawRect(blockX, blockY, 350, 180, new Color(20, 20, 20).getRGB()); RenderUtils.drawRect(blockX, blockY, 350, 180, new Color(20, 20, 20).getRGB());
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
if(MouseUtils.isInside(mouseX, mouseY, blockX + (350 / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth("Skip Tutorial", 10, SilentFontRenderer.FontType.TITLE) / 2), blockY + 180 - 12, Client.getInstance().getSilentFontRenderer().getStringWidth("Skip Tutorial", 10, SilentFontRenderer.FontType.TITLE), 10)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
Client.getInstance().getSilentFontRenderer().drawCenteredString("Skip Tutorial", blockX + (350 / 2), blockY + 180 - 12, 10, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawCenteredString("Skip Tutorial", blockX + (350 / 2), blockY + 180 - 12, 10, SilentFontRenderer.FontType.TITLE);
switch (step) { switch (step) {
case 1: case 1:
@ -69,7 +75,9 @@ public class UserTutorial extends SilentScreen {
this.buttonList.get(0).displayString = "Next"; this.buttonList.get(0).displayString = "Next";
Client.getInstance().getSilentFontRenderer().drawCenteredString("Choose a version of Silent Client", blockX + (350 / 2), blockY + 3, 16, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawCenteredString("Choose a version of Silent Client", blockX + (350 / 2), blockY + 3, 16, SilentFontRenderer.FontType.TITLE);
if(MouseUtils.isInside(mouseX, mouseY, blockX + 9, blockY + 29, 161, 102) || MouseUtils.isInside(mouseX, mouseY, blockX + 180, blockY + 29, 161, 102)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
if(!Client.getInstance().getGlobalSettings().isLite()) { if(!Client.getInstance().getGlobalSettings().isLite()) {
RenderUtils.drawRect(blockX + 9, blockY + 29, 161, 102, -1); RenderUtils.drawRect(blockX + 9, blockY + 29, 161, 102, -1);
} }
@ -85,7 +93,9 @@ public class UserTutorial extends SilentScreen {
this.buttonList.get(0).displayString = "Next"; this.buttonList.get(0).displayString = "Next";
Client.getInstance().getSilentFontRenderer().drawCenteredString("Choose a config preset", blockX + (350 / 2), blockY + 3, 16, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawCenteredString("Choose a config preset", blockX + (350 / 2), blockY + 3, 16, SilentFontRenderer.FontType.TITLE);
if(MouseUtils.isInside(mouseX, mouseY, blockX + 60, blockY + 35 + 50 - 10, 20, 20) || MouseUtils.isInside(mouseX, mouseY, blockX + 95 + 159 + 15, blockY + 35 + 50 - 10, 20, 20)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/back.png"), blockX + 60, blockY + 35 + 50 - 10, 20, 20); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/back.png"), blockX + 60, blockY + 35 + 50 - 10, 20, 20);
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/next.png"), blockX + 95 + 159 + 15, blockY + 35 + 50 - 10, 20, 20); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/next.png"), blockX + 95 + 159 + 15, blockY + 35 + 50 - 10, 20, 20);
@ -94,6 +104,8 @@ public class UserTutorial extends SilentScreen {
break; break;
} }
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
} }
@Override @Override

View File

@ -0,0 +1,21 @@
package net.silentclient.client.gui.resourcepacks;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.ResourcePackListEntry;
import net.silentclient.client.gui.SilentScreen;
import java.util.List;
public class SilentResourcePacksGui extends SilentScreen {
private final GuiScreen parentScreen;
private List<ResourcePackListEntry> availableResourcePacks;
private List<ResourcePackListEntry> selectedResourcePacks;
private boolean changed = false;
public SilentResourcePacksGui(GuiScreen parentScreenIn)
{
this.parentScreen = parentScreenIn;
}
}