public void keyDown(int key) { if (loginStage == 0) { if (welcomeMenu != null) welcomeMenu.keyDown(key); } else if (loginStage == 1) { if (newUserMenu != null) newUserMenu.keyDown(key); } else if (loginStage == 2) { if (loginMenu != null) loginMenu.keyDown(key); } }
public void render(JagGraphics graphics) { mc.loginScreenShown = false; graphics.interlace = false; graphics.clearScreen(); if (loginStage <= 2 && loginStage >= 0) { int timer = (mc.tick * 2) % 3072; if (timer < 1024) { graphics.drawPicture(0, 10, mudclient.SPRITE_TEXTURE_START); if (timer > 768) { graphics.drawTransparentPicture(0, 10, mudclient.SPRITE_TEXTURE_START + 1, timer - 768); } } else { if (timer < 2048) { graphics.drawPicture(0, 10, mudclient.SPRITE_TEXTURE_START + 1); if (timer > 1792) { graphics.drawTransparentPicture(0, 10, mudclient.SPRITE_MEDIA_START + 10, timer - 1792); } } else { graphics.drawPicture(0, 10, mudclient.SPRITE_MEDIA_START + 10); if (timer > 2816) { graphics.drawTransparentPicture(0, 10, mudclient.SPRITE_TEXTURE_START, timer - 2816); } } } } if (loginStage == 0) { welcomeMenu.drawMenu(); } else if (loginStage == 1) { newUserMenu.drawMenu(); } else if (loginStage == 2) { loginMenu.drawMenu(); } graphics.drawPicture(0, mc.windowHeight, mudclient.SPRITE_MEDIA_START + 22); graphics.drawImage(mc.aGraphics936, 0, 0); }
public void updateLoginStatus(String top, String bottom) { if (loginStage == 2 && loginMenu != null) { loginMenu.setText(loginStatusLabel, top + " " + bottom); } }
public void initialize() { welcomeMenu = new Menu(mc.gameGraphics, 50); int y = 40; if (!Config.MEMBERS_FEATURES) { welcomeMenu.createLabel(256, 200 + y, "Click on an option", 5, true); welcomeMenu.addButton(156, 240 + y, 120, 35); welcomeMenu.addButton(356, 240 + y, 120, 35); welcomeMenu.createLabel(156, 240 + y, "New User", 5, false); welcomeMenu.createLabel(356, 240 + y, "Existing User", 5, false); newUserButton = welcomeMenu.createButton(156, 240 + y, 120, 35); existingUserButton = welcomeMenu.createButton(356, 240 + y, 120, 35); } else { welcomeMenu.createLabel(256, 200 + y, "Welcome to RuneScape", 4, true); welcomeMenu.createLabel( 256, 215 + y, "You need a member account to use this server", 4, true); welcomeMenu.addButton(256, 250 + y, 200, 35); welcomeMenu.createLabel(256, 250 + y, "Click here to login", 5, false); existingUserButton = welcomeMenu.createButton(256, 250 + y, 200, 35); } newUserMenu = new Menu(mc.gameGraphics, 50); y = 230; newUserMenu.createLabel(256, y + 8, "To create an account please go back to the", 4, true); y += 20; newUserMenu.createLabel( 256, y + 8, "www.projectrsc.com front page, and choose 'register'", 4, true); y += 30; newUserMenu.addButton(256, y + 17, 150, 34); newUserMenu.createLabel(256, y + 17, "Ok", 5, false); newUserOkButton = newUserMenu.createButton(256, y + 17, 150, 34); loginMenu = new Menu(mc.gameGraphics, 50); y = 230; loginStatusLabel = loginMenu.createLabel(256, y - 10, "Please enter your username and password", 4, true); y += 28; loginMenu.addButton(140, y, 200, 40); loginMenu.createLabel(140, y - 10, "Username:"******"Password:"******"Ok", 4, false); loginOk = loginMenu.createButton(410, y, 120, 25); y += 30; loginMenu.addButton(410, y, 120, 25); loginMenu.createLabel(410, y, "Cancel", 4, false); loginCancel = loginMenu.createButton(410, y, 120, 25); y += 30; loginMenu.setFocus(usernameInput); }
public void tick() { if (mc.socketTimeout > 0) { mc.socketTimeout--; } switch (loginStage) { case 0: welcomeMenu.mouseClick(mc.mouseX, mc.mouseY, mc.lastMouseButton, mc.mouseButton); if (welcomeMenu.hasClicked(newUserButton)) { loginStage = 1; } else if (welcomeMenu.hasClicked(existingUserButton)) { loginStage = 2; loginMenu.setText(loginStatusLabel, "Please enter your username and password"); loginMenu.setText(usernameInput, ""); loginMenu.setText(passwordInput, ""); loginMenu.setFocus(usernameInput); } break; case 1: newUserMenu.mouseClick(mc.mouseX, mc.mouseY, mc.lastMouseButton, mc.mouseButton); if (newUserMenu.hasClicked(newUserOkButton)) { loginStage = 0; } break; case 2: loginMenu.mouseClick(mc.mouseX, mc.mouseY, mc.lastMouseButton, mc.mouseButton); if (loginMenu.hasClicked(loginCancel)) { loginStage = 0; } if (loginMenu.hasClicked(usernameInput)) { loginMenu.setFocus(passwordInput); } if (loginMenu.hasClicked(passwordInput) || loginMenu.hasClicked(loginOk)) { mc.currentUser = loginMenu.getText(usernameInput); mc.currentPass = loginMenu.getText(passwordInput); mc.login(mc.currentUser, mc.currentPass, false); } break; } }