Beispiel #1
0
 @Override
 protected Label initLabel() {
   Label label = new SelectableLabel("", Mediator.getMediator().getSkin());
   label.setColor(Color.BLACK);
   label.getColor().g = .7f;
   return label;
 }
Beispiel #2
0
  @Override
  public void show() {
    super.show();

    backgroundStage.addActor(new Image(atlas.findRegion("background")));

    Image alien = new Image(atlas.findRegion("alien"));
    alien.setPosition(mainStage.getWidth() + mainStage.getPadLeft(), -365f);
    mainStage.addActor(alien);

    Image energy = new Image(atlas.findRegion("energy")); // 195, 313
    energy.setPosition(83f, 201f);
    energy.setScale(0f);
    energy.setOrigin(energy.getPrefWidth() / 2, energy.getPrefHeight() / 2);
    mainStage.addActor(energy);

    final Table certificateTable = new Table();
    certificateTable.padTop(314f).padBottom(101f).defaults().padBottom(100f);
    certificateTable.setBackground(new TextureRegionDrawable(atlas.findRegion("certificate")));
    certificateTable.setSize(mainStage.getWidth(), mainStage.getHeight());
    certificateTable.setOrigin(195f, 313f);
    certificateTable.setTransform(true);
    certificateTable.setTouchable(Touchable.disabled);
    certificateTable.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Assets.fanfareFX.stop();
            game.loadNextScreen(EndingScreen.this, KonnectingGame.ScreenType.MAIN_MENU);
          }
        });
    certificateTable.setScale(0f);
    mainStage.addActor(certificateTable);

    StatsData tempData = SavedData.getStats();
    int score =
        tempData.kronosScore1
            + tempData.kronosScore2
            + tempData.kronosScore3
            + tempData.kronosScore4
            + tempData.kronosScore5
            + tempData.kronosScore6
            + tempData.kronosScore7
            + tempData.zappingScore1
            + tempData.zappingScore2
            + tempData.zappingScore3
            + tempData.zappingScore4
            + tempData.zappingScore5;

    final Label userLabel =
        new Label(
            SavedData.getUsername() + "\n\n" + score + "pt",
            new Label.LabelStyle(uiSkin.getFont("default-font"), Color.WHITE));
    userLabel.setWrap(true);
    userLabel.setAlignment(Align.center);
    userLabel.getColor().a = 0f;
    certificateTable.add(userLabel).width(407f).row();

    String correctComment = comments[0];
    for (int i = scoreLimits.length - 1; i >= 0; i--) {
      if (score > scoreLimits[i]) {
        correctComment = comments[i];
        break;
      }
    }
    final Label commentLabel =
        new Label(correctComment, new Label.LabelStyle(uiSkin.getFont("arial"), Color.WHITE));
    commentLabel.setWrap(true);
    commentLabel.setFontScale(0.9f);
    commentLabel.setAlignment(Align.center);
    commentLabel.getColor().a = 0f;
    certificateTable.add(commentLabel).width(407f);

    Timeline.createSequence()
        .push(Tween.to(alien, ActorAccessor.MOVE_X, 1f).target(20f))
        .pushPause(0.25f)
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 1f).target(1f))
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(0.8f))
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(1f))
        .push(Tween.to(certificateTable, ActorAccessor.SCALEXY, 0.5f).target(1f))
        .beginParallel()
        .push(Tween.to(userLabel, ActorAccessor.ALPHA, 0.5f).target(1f))
        .push(Tween.to(commentLabel, ActorAccessor.ALPHA, 0.5f).target(1f))
        .end()
        .setCallback(
            new TweenCallback() {
              @Override
              public void onEvent(int type, BaseTween<?> source) {
                Assets.fanfareFX.setOnCompletionListener(
                    new Music.OnCompletionListener() {
                      @Override
                      public void onCompletion(Music music) {
                        Assets.fanfareFX.setOnCompletionListener(null);
                        certificateTable.setTouchable(Touchable.enabled);
                      }
                    });
                Assets.fanfareFX.play();
              }
            })
        .start(tweenManager);
  }
Beispiel #3
0
  @Override
  public void start() {
    super.start();
    if (this.type == FinalStage.TYPE_GAME_OVER) {
      StageScreen.getInstance().getTracker().trackScreen("gameOverScreen");
    } else {
      StageScreen.getInstance().getTracker().trackScreen("gameWinScreen");
    }
    this.music = Manager.getInstance().get(musicFile, Music.class);
    this.music.setVolume(Settings.getInstance().getMusicVolume());
    this.music.play();

    TextureAtlas atlas = Manager.getInstance().get("img/menu.pack", TextureAtlas.class);
    LabelStyle headerStyle = new LabelStyle();
    headerStyle.font = Config.getInstance().headerFont;
    headerStyle.fontColor = Config.getInstance().textColor;

    String labelText = (type == FinalStage.TYPE_GAME_OVER) ? "game.over" : "game.win";
    Label text = new Label(Translator.getInstance().translate(labelText), headerStyle);
    text.setBounds(
        50, 150, Config.getInstance().gameWidth - 100, Config.getInstance().gameHeight - 150);
    text.setAlignment(Align.center);
    text.setWrap(true);
    text.getColor().a = 0;
    text.addAction(fadeIn(2f));
    this.addActor(text);

    AtlasRegion btnBg = atlas.findRegion("btn-bg");
    AtlasRegion btnBgTouched = atlas.findRegion("btn-bg-touched");
    Color btnColor = new Color(1, 1, 1, 1);
    Color btnColorTouched = new Color(0.5f, 0.5f, 0.5f, 1);

    TextButton newGame =
        new TextButton(
            btnBg,
            btnBgTouched,
            Translator.getInstance().translate("btn.new.game"),
            Config.getInstance().bigFont,
            btnColor,
            btnColorTouched);
    newGame.setHeight(btnHeight);
    newGame.setPosition(50, 50);
    newGame.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            StageScreen.getInstance().setStage(new SlideStage(SlideStage.TYPE_INTRO));
          }
        });
    this.addActor(newGame);

    TextButton exit =
        new TextButton(
            btnBg,
            btnBgTouched,
            Translator.getInstance().translate("btn.exit"),
            Config.getInstance().bigFont,
            btnColor,
            btnColorTouched);
    exit.setHeight(btnHeight);
    exit.setPosition(Config.getInstance().gameWidth - exit.getWidth() - 50, 50);
    exit.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            StageScreen.getInstance().setStage(new MenuStage());
          }
        });
    this.addActor(exit);
  }