From f99f17203deb1d1402475e5379acfa93558b1adb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 25 Sep 2024 12:14:36 +0200 Subject: [PATCH] Update AltManager UI to make type of alts more obvious --- .../altmanager/screens/AddAltScreen.java | 2 +- .../altmanager/screens/AltEditorScreen.java | 48 ++++++++++--------- .../altmanager/screens/DirectLoginScreen.java | 3 +- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/main/java/net/wurstclient/altmanager/screens/AddAltScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AddAltScreen.java index b438483263..d095cd1706 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AddAltScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AddAltScreen.java @@ -26,7 +26,7 @@ public AddAltScreen(Screen prevScreen, AltManager altManager) @Override protected String getDoneButtonText() { - return "Add"; + return getPassword().isEmpty() ? "Add Cracked Alt" : "Add Premium Alt"; } @Override diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index 4c54f11147..d1cd2f2e5d 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -73,6 +73,25 @@ public AltEditorScreen(Screen prevScreen, Text title) @Override public final void init() { + nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60, + 200, 20, Text.literal("")); + nameOrEmailBox.setMaxLength(48); + nameOrEmailBox.setFocused(true); + nameOrEmailBox.setText(getDefaultNameOrEmail()); + addSelectableChild(nameOrEmailBox); + + passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100, + 200, 20, Text.literal("")); + passwordBox.setText(getDefaultPassword()); + passwordBox.setRenderTextProvider((text, int_1) -> { + String stars = ""; + for(int i = 0; i < text.length(); i++) + stars += "*"; + return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY); + }); + passwordBox.setMaxLength(256); + addSelectableChild(passwordBox); + addDrawableChild(doneButton = ButtonWidget .builder(Text.literal(getDoneButtonText()), b -> pressDoneButton()) .dimensions(width / 2 - 100, height / 4 + 72 + 12, 200, 20) @@ -101,25 +120,6 @@ public final void init() .dimensions((width / 2 - 100) / 2 - 64, height - 32, 128, 20) .build()); - nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60, - 200, 20, Text.literal("")); - nameOrEmailBox.setMaxLength(48); - nameOrEmailBox.setFocused(true); - nameOrEmailBox.setText(getDefaultNameOrEmail()); - addSelectableChild(nameOrEmailBox); - - passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100, - 200, 20, Text.literal("")); - passwordBox.setText(getDefaultPassword()); - passwordBox.setRenderTextProvider((text, int_1) -> { - String stars = ""; - for(int i = 0; i < text.length(); i++) - stars += "*"; - return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY); - }); - passwordBox.setMaxLength(256); - addSelectableChild(passwordBox); - setFocused(nameOrEmailBox); } @@ -150,6 +150,7 @@ public final void tick() doneButton.active = !nameOrEmail.isEmpty() && !(alex && passwordBox.getText().isEmpty()); + doneButton.setMessage(Text.literal(getDoneButtonText())); stealSkinButton.active = !alex; } @@ -358,14 +359,17 @@ public void render(DrawContext context, int mouseX, int mouseY, AltRenderer.drawAltBody(context, nameOrEmailBox.getText(), width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); + String accountType = getPassword().isEmpty() ? "cracked" : "premium"; + // text context.drawTextWithShadow(textRenderer, "Name (for cracked alts), or", width / 2 - 100, 37, 10526880); context.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)", width / 2 - 100, 47, 10526880); - context.drawTextWithShadow(textRenderer, - "Password (leave blank for cracked alts)", width / 2 - 100, 87, - 10526880); + context.drawTextWithShadow(textRenderer, "Password (for premium alts)", + width / 2 - 100, 87, 10526880); + context.drawTextWithShadow(textRenderer, "Account type: " + accountType, + width / 2 - 100, 127, 10526880); String[] lines = message.split("\n"); for(int i = 0; i < lines.length; i++) diff --git a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java index d399d19790..7f090cfd10 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java @@ -24,7 +24,8 @@ public DirectLoginScreen(Screen prevScreen) @Override protected String getDoneButtonText() { - return "Login"; + return getPassword().isEmpty() ? "Change Cracked Name" + : "Login with Password"; } @Override