Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package latric.outcode.seqouia.stuff.altmanager;
- import java.io.IOException;
- import java.util.Random;
- import javax.swing.JOptionPane;
- import org.lwjgl.input.Keyboard;
- import latric.outcode.seqouia.Seqouia;
- import latric.outcode.seqouia.ui.components.DarkButton;
- import latric.outcode.seqouia.ui.components.GuiPasswordField;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.gui.GuiTextField;
- public final class AltManager
- extends GuiScreen
- {
- private GuiPasswordField password;
- private final GuiScreen previousScreen;
- private Login thread;
- private GuiTextField username;
- public AltManager(GuiScreen previousScreen)
- {
- this.previousScreen = previousScreen;
- }
- protected void actionPerformed(GuiButton button)
- {
- switch (button.id)
- {
- case 1:
- this.mc.displayGuiScreen(this.previousScreen);
- break;
- case 0:
- this.thread = new Login(this.username.getText(), this.password.getText());
- this.thread.start();
- }
- }
- public void drawScreen(int mouseX, int mouseY, float partialTicks)
- {
- this.drawDefaultBackground();
- this.username.drawTextBox();
- this.password.drawTextBox();
- drawCenteredString(this.mc.fontRendererObj, "Alt Login", this.width / 2, 78,
- -1);
- drawCenteredString(this.mc.fontRendererObj, this.thread == null ? "§6Waiting..." :
- this.thread.getStatus(), this.width / 2, 88, -1);
- if (this.username.getText().isEmpty()) {
- drawString(this.mc.fontRendererObj, "Username / E-Mail", this.width / 2 - 96,
- 106, -7829368);
- }
- if (this.password.getText().isEmpty()) {
- drawString(this.mc.fontRendererObj, "Password", this.width / 2 - 96, 136,
- -7829368);
- }
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
- public void initGui()
- {
- int var3 = this.height / 4 + 24;
- this.buttonList.add(new DarkButton(0, this.width / 2 - 100, var3 + 72 + 12, "Login"));
- this.buttonList.add(new DarkButton(1, this.width / 2 - 100, var3 + 72 + 12 + 24,
- "Back"));
- this.buttonList.add(new DarkButton(888, this.width / 2 - 100, 0, "Random Alt"));
- this.username = new GuiTextField(var3, this.mc.fontRendererObj, this.width / 2 - 100, 100, 200,
- 20);
- this.password = new GuiPasswordField(this.mc.fontRendererObj, this.width / 2 - 100, 130,
- 200, 20);
- this.username.setFocused(true);
- Keyboard.enableRepeatEvents(true);
- }
- protected void keyTyped(char character, int key)
- {
- try
- {
- super.keyTyped(character, key);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- if (character == '\t') {
- if ((!this.username.isFocused()) && (!this.password.isFocused()))
- {
- this.username.setFocused(true);
- }
- else
- {
- this.username.setFocused(this.password.isFocused());
- this.password.setFocused(!this.username.isFocused());
- }
- }
- // if (character == '\r') {
- // actionPerformed((GuiButton)this.buttonList.get(0));
- // }
- this.username.textboxKeyTyped(character, key);
- this.password.textboxKeyTyped(character, key);
- }
- protected void mouseClicked(int x, int y, int button)
- {
- try
- {
- super.mouseClicked(x, y, button);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- this.username.mouseClicked(x, y, button);
- this.password.mouseClicked(x, y, button);
- }
- public void onGuiClosed()
- {
- Keyboard.enableRepeatEvents(false);
- }
- public void updateScreen()
- {
- this.username.updateCursorCounter();
- this.password.updateCursorCounter();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement