Exemplo n.º 1
0
  /** Pause the actual game. */
  private void pauseGame() {

    Log.d(Game.class.getName(), "Pause Game");

    paused = true;

    timer.stop();
    updateTimerTime();
    showPauseDialog();
  }
Exemplo n.º 2
0
  @Override
  public void onTick(long elapsedTime) {

    if (timer.getElapsedTime() > MAX_TIME) {
      timer.stop();
      timer.setElapsedTime(MAX_TIME);
      finishGame(false);
    }
    updateTimerTime();
  }
Exemplo n.º 3
0
  /**
   * Restore elapsed time
   *
   * @param load Bundle where the elapsed time can be found
   */
  private void restoreElapsedTime(Bundle load) {

    if (timer == null) {
      return;
    }

    timer.stop();
    timer.resetTime();
    timer.setElapsedTime(load.getLong(BUNDLE_ELAPSED_TIME, 0));
    updateTimerTime();
  }
Exemplo n.º 4
0
  /** Create a new game depending on the current difficulty. */
  private void createGame() {

    Log.d(Game.class.getName(), "Create Game");

    creating = true;

    clickCount = 0;
    timer.stop();
    timer.resetTime();
    updateTimerTime();

    fieldCreationFragment.createNewZahlenschlange(difficulty);
  }
Exemplo n.º 5
0
  /**
   * Finish the actual game.
   *
   * @param successful True if the user successfully found a solution. False otherwise.
   */
  private void finishGame(boolean successful) {

    Log.d(Game.class.getName(), "Finish Game " + successful);

    finished = (successful) ? GAME_FINISHED_SUCCESSFUL : GAME_FINISHED_FAILED;

    timer.stop();
    updateTimerTime();

    timerPauseButton.setVisibility(ImageButton.INVISIBLE);
    finishButton.setVisibility(Button.VISIBLE);

    updateFinishButtonText();
  }
Exemplo n.º 6
0
  @Override
  protected void onPause() {

    Log.d(
        Game.class.getName(),
        "Pause [creating, paused, finished, timerTime] "
            + creating
            + " "
            + paused
            + " "
            + finished
            + " "
            + timer.getElapsedTime());

    super.onPause();

    timer.stop();
  }