Skip to content

Commit

Permalink
Update AltManager UI to make type of alts more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Sep 25, 2024
1 parent defb67d commit f99f172
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -150,6 +150,7 @@ public final void tick()

doneButton.active = !nameOrEmail.isEmpty()
&& !(alex && passwordBox.getText().isEmpty());
doneButton.setMessage(Text.literal(getDoneButtonText()));

stealSkinButton.active = !alex;
}
Expand Down Expand Up @@ -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++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public DirectLoginScreen(Screen prevScreen)
@Override
protected String getDoneButtonText()
{
return "Login";
return getPassword().isEmpty() ? "Change Cracked Name"
: "Login with Password";
}

@Override
Expand Down

0 comments on commit f99f172

Please sign in to comment.