public void signIn() {
    menu = Assets.menuSigninRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new ArrayList<TextField>();

    menuComponents.add(0, new MenuComponent(200, 300, 100, 50, Assets.menuUsernameRegion));
    menuComponents.add(1, new MenuComponent(200, 200, 100, 50, Assets.menuPasswordRegion));
    menuComponents.add(2, new MenuComponent(600, 50, 100, 50, Assets.menuSubmitRegion));

    Skin usernameSkin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextField usernameTextField = new TextField("", usernameSkin);
    usernameTextField.setPosition(300, 300);
    usernameTextField.setWidth(400);
    usernameTextField.setFocusTraversal(false);
    Skin passwordSkin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextField passwordTextField = new TextField("", passwordSkin);
    passwordTextField.setPosition(300, 200);
    passwordTextField.setPasswordMode(true);
    passwordTextField.setPasswordCharacter('a');
    passwordTextField.setWidth(400);
    passwordTextField.setFocusTraversal(false);
    menuTextFields.add(0, usernameTextField);
    menuTextFields.add(1, passwordTextField);

    menuNumber = 2;
  }
Ejemplo n.º 2
0
  public void gameOver(
      boolean won, ArrayList<Integer> playerIDs, ArrayList<String> playerUsernames) {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();
    menuNumber = this.MENU_GAMEOVER;
    this.isSplash = false;

    TextField resultsTextField = new TextField(("YOU LOSE"), Assets.tfsTrans100);
    resultsTextField.setPosition(50, 350);
    resultsTextField.setWidth(700);
    resultsTextField.setHeight(150);
    resultsTextField.setAlignment(Align.center);
    resultsTextField.setFocusTraversal(false);
    resultsTextField.setDisabled(true);

    if (won) {
      resultsTextField.setText("YOU WIN!");
    }

    int yOffset = 0;
    for (String s : playerUsernames) // for each player passed in
    {
      TextField playerTextField = new TextField(s, Assets.tfsTrans40);
      playerTextField.setPosition(50, 260 - (yOffset * 70));
      playerTextField.setWidth(300);
      playerTextField.setHeight(50);
      playerTextField.setAlignment(Align.left);
      playerTextField.setFocusTraversal(false);
      playerTextField.setDisabled(true);

      TextField friendTextField =
          new TextField(Integer.toString(playerIDs.get(yOffset)), Assets.tfsTrans40);
      friendTextField.setPosition(400, 260 - (yOffset * 70));
      friendTextField.setWidth(300);
      friendTextField.setHeight(50);
      friendTextField.setAlignment(Align.left);
      friendTextField.setFocusTraversal(false);
      friendTextField.setDisabled(true);

      yOffset++;
      menuTextFields.put(s, playerTextField);
    }

    menuTextFields.put("resultsTF", resultsTextField);
  }
Ejemplo n.º 3
0
  public void pickClass() {
    shouldClear = true;
    shouldAddScrollPane = true;
    charityScrollPane = false;
    characterScrollPane = true;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();

    menuComponents.add(
        0, new MenuComponent(700, 100, 175, 75, Assets.menuButtonSmallRegion)); // continue
    menuComponents.add(
        1, new MenuComponent(100, 100, 175, 75, Assets.menuButtonSmallRegion)); // return

    final TextField characterTextField =
        new TextField(
            "SELECT A CHARACTER",
            Assets.tfsTrans40); // obviously want to replace these with a real charity selection
    characterTextField.setPosition(50, 390);
    characterTextField.setWidth(700);
    characterTextField.setHeight(50);
    characterTextField.setAlignment(Align.center);
    characterTextField.setFocusTraversal(false);
    characterTextField.setDisabled(true);

    TextField continueTextField = new TextField(("CONTINUE"), Assets.tfsTransWhite40);
    continueTextField.setPosition(612, 27);
    continueTextField.setWidth(175); // to be centered well make the width about 325
    continueTextField.setHeight(50);
    continueTextField.setAlignment(Align.center);
    continueTextField.setFocusTraversal(false);
    continueTextField.setDisabled(true);

    TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40);
    returnTextField.setPosition(12, 27);
    returnTextField.setWidth(175); // to be centered well make the width about 325
    returnTextField.setHeight(50);
    returnTextField.setAlignment(Align.center);
    returnTextField.setFocusTraversal(false);
    returnTextField.setDisabled(true);

    menuTextFields.put("characterTF", characterTextField);
    menuTextFields.put("continueTF", continueTextField);
    menuTextFields.put("returnTF", returnTextField);

    menuNumber = this.MENU_PICK_CLASS;
  }
  public void welcome(String username, int wins, int losses, String charityName, int charityIcon) {
    menu = Assets.menuWelcomeRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new ArrayList<TextField>();

    Skin usernameSkin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextField usernameTextField = new TextField(username, usernameSkin);
    usernameTextField.setPosition(300, 400);
    usernameTextField.setWidth(400);
    usernameTextField.setFocusTraversal(false);
    usernameTextField.setDisabled(true);

    TextField winsTextField = new TextField(String.valueOf(wins), usernameSkin);
    winsTextField.setPosition(300, 300);
    winsTextField.setWidth(400);
    winsTextField.setFocusTraversal(false);
    winsTextField.setDisabled(true);

    TextField lossesTextField = new TextField(String.valueOf(losses), usernameSkin);
    lossesTextField.setPosition(300, 200);
    lossesTextField.setWidth(400);
    lossesTextField.setFocusTraversal(false);
    lossesTextField.setDisabled(true);

    TextField charityTextField = new TextField(charityName, usernameSkin);
    charityTextField.setPosition(300, 100);
    charityTextField.setWidth(400);
    charityTextField.setFocusTraversal(false);
    charityTextField.setDisabled(true);

    menuTextFields.add(0, usernameTextField);
    menuTextFields.add(1, winsTextField);
    menuTextFields.add(2, lossesTextField);
    menuTextFields.add(3, charityTextField);

    menuNumber = 3;
  }
Ejemplo n.º 5
0
  public void welcome(String username, int wins, int losses, String charityName, int charityIcon) {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();

    TextField usernameTextField =
        new TextField(("WELCOME " + username.toUpperCase() + "!"), Assets.tfsBigBlue70);
    usernameTextField.setPosition(50, 290);
    usernameTextField.setWidth(700);
    usernameTextField.setHeight(50);
    usernameTextField.setAlignment(Align.center);
    usernameTextField.setFocusTraversal(false);
    usernameTextField.setDisabled(true);

    menuTextFields.put("usernameTF", usernameTextField);

    menuNumber = this.MENU_WELCOME;
  }
Ejemplo n.º 6
0
  public void splash() {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();
    menuNumber = this.MENU_SPLASH;
    blinkTimer = 0;

    TextField charityChampsTextField = new TextField(("CHARITY CHAMPS!"), Assets.tfsTrans100);
    charityChampsTextField.setPosition(50, 190);
    charityChampsTextField.setWidth(700);
    charityChampsTextField.setHeight(150);
    charityChampsTextField.setAlignment(Align.center);
    charityChampsTextField.setFocusTraversal(false);
    charityChampsTextField.setDisabled(true);

    menuTextFields.put("charityChampsTF", charityChampsTextField);

    this.isSplash = true;
  }
Ejemplo n.º 7
0
  public void createWindow() {
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextButton closeButton = new TextButton("", skin, "close-toggle");

    Random random = new Random();

    dialog = new Window("Terminal", skin);
    dialog.setBounds(10 + random.nextInt(50), 100 + random.nextInt(50), 400, 200);
    dialog.setResizable(true);
    dialog.setKeepWithinStage(true);
    dialog
        .getTitleTable()
        .add(closeButton)
        .size(dialog.getPadTop() * 4 / 5, dialog.getPadTop() * 4 / 5)
        .padRight(dialog.getPadRight());
    dialog.left().top();
    dialog.setResizeBorder(5);
    dialog.padRight(0);
    dialog.padBottom(1);

    SimpleDateFormat simpleDateformat = new SimpleDateFormat("E");
    String day = simpleDateformat.format(new Date());
    String month = new SimpleDateFormat("MMM").format(Calendar.getInstance().getTime());
    int date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
    int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
    int min = Calendar.getInstance().get(Calendar.MINUTE);
    int sec = Calendar.getInstance().get(Calendar.SECOND);
    String textTest =
        "Last login: "******" "
            + month
            + " "
            + String.format("%02d", date)
            + " "
            + String.format("%02d", hour)
            + ":"
            + String.format("%02d", min)
            + ":"
            + String.format("%02d", sec);

    cld.textHistory = textTest;
    consoleDialog = new Label(cld.textHistory, skin);
    consoleDialog.setWrap(true);
    consoleDialog.setAlignment(Align.topLeft, Align.topLeft);

    consoleArrow =
        new Label(cld.parser.getInputPrefix(), new LabelStyle(skin.get(LabelStyle.class)));
    consoleField = new TextField("", skin);
    consoleField.setFocusTraversal(false);
    Color colour = Color.ORANGE;
    colour.a = 0.8f;
    consoleField.getStyle().cursor = skin.newDrawable("white", colour);
    consoleField.getStyle().cursor.setMinWidth(10);
    consoleField.setBlinkTime(0.6f);

    Table scrollTable = new Table();
    scrollTable.top();
    scrollTable.add(consoleDialog).colspan(2).growX().fill().left().top();
    scrollTable.row();
    scrollTable.add(consoleArrow).left().top();
    scrollTable.add(consoleField).expand(true, false).fill().left().top();
    scrollTable.padBottom(1);

    consoleScroll = new ScrollPane(scrollTable, skin);
    consoleScroll.setFadeScrollBars(false);
    consoleScroll.setVariableSizeKnobs(true);
    consoleScroll.setFlickScroll(false);
    dialog.add(consoleScroll).fill().expand();
    this.stage.addActor(dialog);

    closeButton.addListener(new CLICloseButtonListener(this, dialog));

    setKeyboardFocus();
  }
Ejemplo n.º 8
0
  public void options() {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menuNumber = this.MENU_OPTIONS;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();
    menuComponents.add(
        0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // return
    menuComponents.add(
        1, new MenuComponent(250, 350, 175, 75, Assets.menuButtonSmallRegion)); // player
    menuComponents.add(
        2, new MenuComponent(250, 250, 175, 75, Assets.menuButtonSmallRegion)); // audio
    menuComponents.add(
        3, new MenuComponent(250, 150, 175, 75, Assets.menuButtonSmallRegion)); // privacy
    menuComponents.add(
        4, new MenuComponent(600, 350, 175, 75, Assets.menuButtonSmallRegion)); // log out

    // right now I am using the metric of setting the width to be 175 and height 50 (for textfields)
    // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units
    // higher than it needs to be, but it looks aight

    TextField playerTextField = new TextField(("PLAYER"), Assets.tfsTransWhite40);
    playerTextField.setPosition(162, 277);
    playerTextField.setWidth(175); // to be centered well make the width about 325
    playerTextField.setHeight(50);
    playerTextField.setAlignment(Align.center);
    playerTextField.setFocusTraversal(false);
    playerTextField.setDisabled(true);

    TextField audioTextField = new TextField(("AUDIO"), Assets.tfsTransWhite40);
    audioTextField.setPosition(162, 177);
    audioTextField.setWidth(175);
    audioTextField.setHeight(50);
    audioTextField.setAlignment(Align.center);
    audioTextField.setFocusTraversal(false);
    audioTextField.setDisabled(true);

    TextField privacyTextField = new TextField(("PRIVACY"), Assets.tfsTransWhite40);
    privacyTextField.setPosition(162, 77);
    privacyTextField.setWidth(175);
    privacyTextField.setHeight(50);
    privacyTextField.setAlignment(Align.center);
    privacyTextField.setFocusTraversal(false);
    privacyTextField.setDisabled(true);

    TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40);
    returnTextField.setPosition(512, 27);
    returnTextField.setWidth(175); // to be centered well make the width about 325
    returnTextField.setHeight(50);
    returnTextField.setAlignment(Align.center);
    returnTextField.setFocusTraversal(false);
    returnTextField.setDisabled(true);

    TextField logoutTextField = new TextField(("LOG OUT"), Assets.tfsTransWhite40);
    logoutTextField.setPosition(512, 277);
    logoutTextField.setWidth(175); // to be centered well make the width about 325
    logoutTextField.setHeight(50);
    logoutTextField.setAlignment(Align.center);
    logoutTextField.setFocusTraversal(false);
    logoutTextField.setDisabled(true);

    TextField charityChampsTextField = new TextField(("OPTIONS"), Assets.tfsTrans100);
    charityChampsTextField.setPosition(50, 390);
    charityChampsTextField.setWidth(700);
    charityChampsTextField.setHeight(50);
    charityChampsTextField.setAlignment(Align.center);
    charityChampsTextField.setFocusTraversal(false);
    charityChampsTextField.setDisabled(true);

    menuTextFields.put("playTF", playerTextField);
    menuTextFields.put("optionsTF", audioTextField);
    menuTextFields.put("privacyTF", privacyTextField);
    menuTextFields.put("returnTF", returnTextField);
    menuTextFields.put("logoutTF", logoutTextField);
    menuTextFields.put("charityChampsTF", charityChampsTextField);
  }
Ejemplo n.º 9
0
  public void mainMenu() {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();
    menuComponents.add(
        0, new MenuComponent(200, 350, 175, 75, Assets.menuButtonSmallRegion)); // play button
    menuComponents.add(
        1, new MenuComponent(200, 250, 175, 75, Assets.menuButtonSmallRegion)); // options button
    menuComponents.add(
        2, new MenuComponent(200, 150, 175, 75, Assets.menuButtonSmallRegion)); // profile button

    // right now I am using the metric of setting the width to be 175 and height 50 (for textfields)
    // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units
    // higher than it needs to be, but it looks aight

    TextField playTextField = new TextField(("PLAY!"), Assets.tfsTransWhite40);
    playTextField.setPosition(112, 277);
    playTextField.setWidth(175); // to be centered well make the width about 325
    playTextField.setHeight(50);
    playTextField.setAlignment(Align.center);
    playTextField.setFocusTraversal(false);
    playTextField.setDisabled(true);

    TextField optionsTextField = new TextField(("OPTIONS"), Assets.tfsTransWhite40);
    optionsTextField.setPosition(112, 177);
    optionsTextField.setWidth(175);
    optionsTextField.setHeight(50);
    optionsTextField.setAlignment(Align.center);
    optionsTextField.setFocusTraversal(false);
    optionsTextField.setDisabled(true);

    TextField profileTextField = new TextField(("PROFILE"), Assets.tfsTransWhite40);
    profileTextField.setPosition(112, 77);
    profileTextField.setWidth(175);
    profileTextField.setHeight(50);
    profileTextField.setAlignment(Align.center);
    profileTextField.setFocusTraversal(false);
    profileTextField.setDisabled(true);

    TextField charityChampsTextField = new TextField(("CHARITY CHAMPS"), Assets.tfsTrans100);
    charityChampsTextField.setPosition(50, 390);
    charityChampsTextField.setWidth(700);
    charityChampsTextField.setHeight(50);
    charityChampsTextField.setAlignment(Align.center);
    charityChampsTextField.setFocusTraversal(false);
    charityChampsTextField.setDisabled(true);

    Leaderboard leaderboard = new Leaderboard(game.getPlayerID(), 5, 0);
    int yOffset = 0;
    TreeMap<Integer, Integer> sortedMap = new TreeMap<Integer, Integer>();

    for (Integer id : leaderboard.board.keySet()) // for each (INT, <String, String>)
    {
      System.out.println(
          "sorting " + Integer.parseInt(leaderboard.board.get(id).get("WINS")) + " " + id);
      sortedMap.put(Integer.parseInt(leaderboard.board.get(id).get("WINS")), id);
    }

    System.out.println(sortedMap.descendingMap());

    for (Integer id :
        sortedMap
            .descendingMap()
            .values()) { // the values, is the id. should do it in the order of wins highest

      TextField playerTextField =
          new TextField(leaderboard.board.get(id).get("USERNAME"), Assets.tfsTrans40);
      playerTextField.setPosition(400, 260 - (yOffset * 70));
      playerTextField.setWidth(300);
      playerTextField.setHeight(50);
      playerTextField.setAlignment(Align.left);
      playerTextField.setFocusTraversal(false);
      playerTextField.setDisabled(true);

      TextField winsTextField =
          new TextField(leaderboard.board.get(id).get("WINS"), Assets.tfsTrans40);
      winsTextField.setPosition(700, 260 - (yOffset * 70));
      winsTextField.setWidth(100);
      winsTextField.setHeight(50);
      winsTextField.setAlignment(Align.left);
      winsTextField.setFocusTraversal(false);
      winsTextField.setDisabled(true);

      yOffset++;
      menuTextFields.put(leaderboard.board.get(id).get("USERNAME"), playerTextField);
      menuTextFields.put(leaderboard.board.get(id).get("WINS"), winsTextField);
    }

    menuTextFields.put("playTF", playTextField);
    menuTextFields.put("optionsTF", optionsTextField);
    menuTextFields.put("profileTF", profileTextField);
    menuTextFields.put("charityChampsTF", charityChampsTextField);

    menuNumber = this.MENU_MAINMENU;
  }
Ejemplo n.º 10
0
  public void signUp() {
    shouldClear = true;
    // shouldAddScrollPane = false;
    shouldAddScrollPane = true;
    charityScrollPane = true;
    characterScrollPane = false;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();

    menuComponents.add(
        0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // submit
    menuComponents.add(
        1, new MenuComponent(400, 100, 175, 75, Assets.menuButtonSmallRegion)); // return

    // right now I am using the metric of setting the width to be 175 and height 50 (for textfields)
    // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units
    // higher than it needs to be, but it looks aight

    TextField signUpTextField = new TextField(("SIGN UP!"), Assets.tfsTrans100);
    signUpTextField.setPosition(50, 330);
    signUpTextField.setWidth(700);
    signUpTextField.setHeight(150);
    signUpTextField.setAlignment(Align.center);
    signUpTextField.setFocusTraversal(false);
    signUpTextField.setDisabled(true);

    TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40);
    returnTextField.setPosition(312, 27);
    returnTextField.setWidth(175); // to be centered well make the width about 325
    returnTextField.setHeight(50);
    returnTextField.setAlignment(Align.center);
    returnTextField.setFocusTraversal(false);
    returnTextField.setDisabled(true);

    TextField submitTextField = new TextField(("SUBMIT"), Assets.tfsTransWhite40);
    submitTextField.setPosition(512, 27);
    submitTextField.setWidth(175);
    submitTextField.setHeight(50);
    submitTextField.setAlignment(Align.center);
    submitTextField.setFocusTraversal(false);
    submitTextField.setDisabled(true);

    final TextField usernameTextField = new TextField("USERNAME", Assets.tfs);
    usernameTextField.setPosition(100, 300);
    usernameTextField.setWidth(300);
    usernameTextField.setHeight(50);
    usernameTextField.setFocusTraversal(false);
    usernameTextField.addListener(
        new ClickListener() {
          public void clicked(InputEvent e, float x, float y) {
            if (usernameTextField.getText().equals("USERNAME")) usernameTextField.setText("");
          }
        });
    usernameTextField.setTextFieldListener(
        new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard
          @Override
          public void keyTyped(TextField textField, char c) {
            if ((c == '\r') || (c == '\n')) {
              Gdx.input.setOnscreenKeyboardVisible(false);
              unfocusAll = true;
            }
          }
        });

    final TextField passwordTextField = new TextField("PASSWORD", Assets.tfs);
    // passwordTextField.setPosition(100, 240);
    passwordTextField.setPosition(450, 300);
    passwordTextField.setPasswordMode(false);
    // passwordTextField.setPasswordCharacter('*');
    passwordTextField.setWidth(300);
    passwordTextField.setHeight(50);
    passwordTextField.setFocusTraversal(false);
    passwordTextField.addListener(
        new ClickListener() {
          public void clicked(InputEvent e, float x, float y) {
            if (passwordTextField.getText().equals("PASSWORD"))
              passwordTextField.setPasswordMode(true);
            passwordTextField.setPasswordCharacter('*');
            passwordTextField.setText("");
          }
        });
    passwordTextField.setTextFieldListener(
        new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard
          @Override
          public void keyTyped(TextField textField, char c) {
            if ((c == '\r') || (c == '\n')) {
              Gdx.input.setOnscreenKeyboardVisible(false);
              unfocusAll = true;
            }
          }
        });

    /*final TextField emailTextField = new TextField("EMAIL", Assets.tfs);
    emailTextField.setPosition(450, 300);
    emailTextField.setWidth(300);
    emailTextField.setHeight(50);
    emailTextField.setFocusTraversal(false);
    emailTextField.addListener(new ClickListener() {
        public void clicked(InputEvent e, float x, float y) {
            if (emailTextField.getText().equals("EMAIL"))
                emailTextField.setText("");

        }
    });
    emailTextField.setTextFieldListener(new TextField.TextFieldListener() {//if enter is pressed, remove the keyboard
        @Override
        public void keyTyped(TextField textField, char c) {
            if ((c == '\r') || (c == '\n')) {
                Gdx.input.setOnscreenKeyboardVisible(false);
                unfocusAll = true;
            }
        }
    });*/

    final TextField charityTextField =
        new TextField(
            "SELECT A CHARITY",
            Assets.tfsTrans40); // obviously want to replace these with a real charity selection
    charityTextField.setPosition(250, 240);
    charityTextField.setDisabled(true);
    charityTextField.setWidth(300);
    charityTextField.setHeight(50);
    charityTextField.setFocusTraversal(false);

    menuTextFields.put("usernameTF", usernameTextField);
    menuTextFields.put("passwordTF", passwordTextField);
    // menuTextFields.put("emailTF", emailTextField);
    menuTextFields.put("charityTF", charityTextField);
    menuTextFields.put("returnTF", returnTextField);
    menuTextFields.put("submitTF", submitTextField);
    menuTextFields.put("signUpTF", signUpTextField);

    menuNumber = this.MENU_SIGNUP;
  }
Ejemplo n.º 11
0
  public void signIn() {
    shouldClear = true;
    shouldAddScrollPane = false;
    charityScrollPane = false;
    characterScrollPane = false;
    scrollPaneContainer = null;
    menu = Assets.menuSplashBlankRegion;
    menuComponents = new ArrayList<MenuComponent>();
    menuTextFields = new HashMap<String, TextField>();

    menuComponents.add(
        0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // lets go
    menuComponents.add(
        1, new MenuComponent(400, 100, 175, 75, Assets.menuButtonSmallRegion)); // sign up

    // right now I am using the metric of setting the width to be 175 and height 50 (for textfields)
    // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units
    // higher than it needs to be, but it looks aight

    menuComponents.add(2, new MenuComponent(45, 45, 178, 267, Assets.menuSpenceRegion));

    TextField logInTextField = new TextField(("LOG IN"), Assets.tfsTrans100);
    logInTextField.setPosition(50, 330);
    logInTextField.setWidth(700);
    logInTextField.setHeight(150);
    logInTextField.setAlignment(Align.center);
    logInTextField.setFocusTraversal(false);
    logInTextField.setDisabled(true);

    TextField letsGoTextField = new TextField(("LETS GO"), Assets.tfsTransWhite40);
    letsGoTextField.setPosition(512, 27);
    letsGoTextField.setWidth(175); // to be centered well make the width about 325
    letsGoTextField.setHeight(50);
    letsGoTextField.setAlignment(Align.center);
    letsGoTextField.setFocusTraversal(false);
    letsGoTextField.setDisabled(true);

    TextField signUpTextField = new TextField(("SIGN UP"), Assets.tfsTransWhite40);
    signUpTextField.setPosition(312, 27);
    signUpTextField.setWidth(175);
    signUpTextField.setHeight(50);
    signUpTextField.setAlignment(Align.center);
    signUpTextField.setFocusTraversal(false);
    signUpTextField.setDisabled(true);

    final TextField usernameTextField = new TextField("USERNAME", Assets.tfs);
    usernameTextField.setPosition(50, 270);
    usernameTextField.setWidth(300);
    usernameTextField.setHeight(50);
    usernameTextField.setFocusTraversal(false);
    usernameTextField.addListener(
        new ClickListener() {
          public void clicked(InputEvent e, float x, float y) {
            if (usernameTextField.getText().equals("USERNAME")) usernameTextField.setText("");
          }
        });
    usernameTextField.setTextFieldListener(
        new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard
          @Override
          public void keyTyped(TextField textField, char c) {
            if ((c == '\r') || (c == '\n')) {
              Gdx.input.setOnscreenKeyboardVisible(false);
              unfocusAll = true;
            }
          }
        });

    final TextField passwordTextField = new TextField("PASSWORD", Assets.tfs);
    passwordTextField.setPosition(450, 270);
    passwordTextField.setPasswordMode(false);
    // passwordTextField.setPasswordCharacter('*');
    passwordTextField.setWidth(300);
    passwordTextField.setHeight(50);
    passwordTextField.setFocusTraversal(false);
    passwordTextField.addListener(
        new ClickListener() {
          public void clicked(InputEvent e, float x, float y) {
            if (passwordTextField.getText().equals("PASSWORD"))
              passwordTextField.setPasswordMode(true);
            passwordTextField.setPasswordCharacter('*');
            passwordTextField.setText("");
          }
        });
    passwordTextField.setTextFieldListener(
        new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard
          @Override
          public void keyTyped(TextField textField, char c) {
            if ((c == '\r') || (c == '\n')) {
              Gdx.input.setOnscreenKeyboardVisible(false);
              unfocusAll = true;
            }
          }
        });

    menuTextFields.put("usernameTF", usernameTextField);
    menuTextFields.put("passwordTF", passwordTextField);
    menuTextFields.put("letsGoTF", letsGoTextField);
    menuTextFields.put("signUpTF", signUpTextField);
    menuTextFields.put("loginTF", logInTextField);

    menuNumber = this.MENU_SIGNIN;
  }