Esempio n. 1
0
  /**
   * Update everything. Called by render()
   *
   * @param delta
   */
  private void update(float delta) {
    // Update normal camera.
    orthographicCamera.update();

    // Update tween engine.
    tweenManager.update(delta);

    // Update stage action.
    tappy.setStage(splashNormalStage);
    tappy.getStage().act();
  }
Esempio n. 2
0
  /** Draw everything. Called by render() */
  private void draw() {
    // Clear screen.
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    // Apply normal camera.
    tappy.getSpriteBatch().setProjectionMatrix(orthographicCamera.combined);
    tappy.getSpriteBatch().begin();
    // Draw background.
    splashHeadphone.draw(tappy.getSpriteBatch());
    splashBackground.draw(tappy.getSpriteBatch());
    tappy.getSpriteBatch().end();
  }
Esempio n. 3
0
  /**
   * Splash Screen Constructor.
   *
   * @param tappy
   */
  public SplashScreen(Tappy tappy) {
    // Core Variable.
    this.tappy = tappy;

    // Get sprites.
    splashHeadphone = Assets.getSprite("splashHeadphone");
    splashBackground = Assets.getSprite("splashBackground");

    // Set normal camera.
    orthographicCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    orthographicCamera.position.set(
        orthographicCamera.viewportWidth / 2f, orthographicCamera.viewportHeight / 2f, 0);
    orthographicCamera.update();

    // Initialize TweenManager.
    tweenManager = new TweenManager();
    Tween.registerAccessor(Sprite.class, new SpriteAccessor());

    // Initialize splashScreen variable.
    splashNormalStage = new Stage();

    // Trace player!
    HashMap<String, String> parameters = new HashMap<String, String>();
    try {
      parameters.put(
          "signature",
          Helper.md5(
              (int) (Math.floor(((int) (System.currentTimeMillis() / 1000L) / 1000.0)))
                  + "tHeJ3110pylnWzA-007!-+ei"));
    } catch (Exception e) {
      parameters.put("signature", "Error");
    }
    parameters.put("function", "launch");
    try {
      parameters.put("computerName", InetAddress.getLocalHost().getHostName());
    } catch (Exception e) {
      parameters.put("computerName", "Unknown");
    }
    try {
      parameters.put("javaVersion", System.getProperty("java.version"));
    } catch (Exception e) {
      parameters.put("javaVersion", "Unknown");
    }
    parameters.put("isFirst", tappy.getPreferences().getBoolean("firstTime", true) ? "1" : "0");
    HttpRequest httpPost = new HttpRequest(HttpMethods.POST);
    httpPost.setUrl("http://jellopy.in.th/tappy1eaTrace.php");
    httpPost.setContent(HttpParametersUtils.convertHttpParameters(parameters));
    Gdx.net.sendHttpRequest(
        httpPost,
        new HttpResponseListener() {
          @Override
          public void handleHttpResponse(HttpResponse httpResponse) {}

          @Override
          public void failed(Throwable error) {}

          @Override
          public void cancelled() {}
        });
  }
Esempio n. 4
0
  /** Launch splashScreen. */
  @Override
  public void show() {
    // Switch to normal stage.
    tappy.setStage(splashNormalStage);

    // Register tweenEngine timeline.
    Timeline.createSequence()
        // Set default values.
        .push(Tween.set(splashHeadphone, SpriteAccessor.ALPHA).target(0))
        .push(Tween.set(splashBackground, SpriteAccessor.ALPHA).target(0))
        .push(
            Tween.set(splashBackground, SpriteAccessor.POSITION)
                .target(0, -(splashBackground.getHeight() - Gdx.graphics.getHeight())))
        // FadeIn & Slide down.
        .push(Tween.to(splashHeadphone, SpriteAccessor.ALPHA, 1.2f).target(1))
        .pushPause(1.4f)
        .push(Tween.to(splashHeadphone, SpriteAccessor.ALPHA, 1.2f).target(0))
        .beginParallel()
        .push(Tween.to(splashBackground, SpriteAccessor.ALPHA, 5.2f).target(1))
        .push(Tween.to(splashBackground, SpriteAccessor.POSITION, 9.8f).target(0, 0).ease(Quad.OUT))
        .end()
        // Waiting.
        .pushPause(1.2f)
        // FadeOut.
        .push(Tween.to(splashBackground, SpriteAccessor.ALPHA, 0.7f).target(0))
        // Register callback.
        .setCallback(
            new TweenCallback() {
              @Override
              public void onEvent(int type, BaseTween<?> source) {
                if (tappy.getPreferences().getBoolean("firstTime", true)) {
                  tappy.setScreen(new TutorialScreen(tappy));
                } else {
                  tappy.setScreen(new HomeScreen(tappy));
                }
              }
            })
        // Launch!
        .start(tweenManager);
  }