Exemplo n.º 1
0
  public FinalDialogueScreen(final ButtonGame game) {
    this.game = game;
    stage = new Stage(new ScreenViewport());

    dialogueLabel = new Label("", Resources.Skin());
    dialogueLabel.setWrap(true);
    dialogueLabel.setColor(Color.CYAN);

    leftPerson = new Image(new Texture(Gdx.files.internal("graphics/CaptainCalamari.png")));
    leftPerson.setVisible(false);
    rightPerson = new Image(new Texture(Gdx.files.internal("graphics/JimmyTwoButton.png")));
    leftPerson.setScaling(Scaling.none);
    rightPerson.setScaling(Scaling.none);
    stage.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(
              InputEvent event, float screenX, float screenY, int pointer, int button) {

            if (count < maxCount) {
              count = advanceDialogue(count);
            } else {
              game.startLevel(Level.get(game, 10));
            }
            return true;
          }
        });

    Table table = new Table();
    table.setFillParent(true);
    table.align(Align.top);
    table.add().height(50).colspan(3).center();
    table.row();
    table.add(leftPerson);
    table.add(); // .width(20);
    table.add(rightPerson);
    table.row();
    table.add().colspan(3).height(50);
    table.row();
    table.add(dialogueLabel).width(600).colspan(3).center();
    if (Resources.DEBUG) {
      table.setDebug(true);
    }

    stage.addActor(table);
  }
Exemplo n.º 2
0
  @Override
  public void show() {

    skin = new Skin(Gdx.files.internal("uiskin.json"));
    stage = new Stage(new ScreenViewport());
    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    // Adding the game title to the screen
    Sprite spriteTitle = new Sprite(Assets.zombieShooterTitle);
    Assets.spriteDefaultColorSolid(spriteTitle);
    SpriteDrawable spriteDrawableTitle = new SpriteDrawable(spriteTitle);
    imageTitle = new Image(spriteDrawableTitle);

    // Creating all the containers for the positioning and arranging of our stuff
    container = new Table();
    container.setWidth(stage.getWidth());
    container.align(Align.center | Align.top);
    container.setPosition(0, Constant.HEIGHT_SCREEN);

    containerFirstRow = new Table();
    containerFirstRow.setWidth(stage.getWidth());
    containerFirstRow.align(Align.center | Align.top);
    containerFirstRow.setPosition(0, Constant.HEIGHT_SCREEN);

    containerSecondRow = new Table();
    containerSecondRow.setWidth(stage.getWidth());
    containerSecondRow.align(Align.center | Align.top);
    containerSecondRow.setPosition(0, Constant.HEIGHT_SCREEN);

    creatingRegisterButton();

    creatingTheTextFields();

    // Setting the text field text to be on the center
    settingTextFieldsTextToCenter();

    // Remove any text in hte text fields on click so that user can write his information
    cleaningTextFieldsToBlank();

    // Adding all the object into the stage. First of all we add to the container
    // for the row then to the main container , finally into the main stage
    arrangingTheScreen();

    // Creating the background
    backGroundSprite = new Sprite(Assets.backgroundMenu);
    backGroundSprite.setSize(Constant.WIDTH_SCREEN, Constant.HEIGHT_SCREEN);

    // Setting the back key on android to true, so it can accept interaction
    Gdx.input.setCatchBackKey(true);

    inizializiraneWarningMessage();

    // When clicking on the register button we start the validation process.
    // It calls all the methods which are checking the user input
    registerButton.addListener(
        new ClickListener() {
          public void clicked(InputEvent e, float x, float y) {
            Assets.clickButton.play();
            if ((checkUserField(userField.getText().toString()))
                && (checkPasswordField(passwordField.getText().toString()))
                && (checkPasswordAndRePassword(
                    passwordField.getText().toString(), passwordCheckField.getText().toString()))
                && (checkEmailField(emailField.getText().toString()))) {
              registerJson();
            }
          }
        });
  }