Esempio n. 1
0
 /** this method is for initializing new static obstacle when pool is empty */
 @Override
 protected StaticObstacle onAllocatePoolItem() {
   StaticObstacle obstacle;
   if (random.nextBoolean()) {
     obstacle =
         new StaticObstacle(
             0,
             0,
             staticObstacleTexture,
             vertexBufferObjectManager,
             ResourceManager.getInstance().getPhysicsWorld());
   } else if (random.nextBoolean()) {
     obstacle =
         new StaticObstacle(
             0,
             0,
             secondStaticObstacleTexture,
             vertexBufferObjectManager,
             ResourceManager.getInstance().getPhysicsWorld());
   } else {
     obstacle =
         new StaticObstacle(
             0,
             0,
             thirdStaticObstacleTexture,
             vertexBufferObjectManager,
             ResourceManager.getInstance().getPhysicsWorld());
   }
   return obstacle;
 }
Esempio n. 2
0
 public StaticObstaclePool(
     ITextureRegion staticObstacleTexture,
     ITextureRegion secondStaticObstacleTexture,
     VertexBufferObjectManager vertexBufferObjectManager) {
   this.staticObstacleTexture = staticObstacleTexture;
   this.secondStaticObstacleTexture = secondStaticObstacleTexture;
   this.thirdStaticObstacleTexture = ResourceManager.getInstance().getThirdStaticObstacleTexture();
   this.vertexBufferObjectManager = vertexBufferObjectManager;
   random = new Random();
 }
Esempio n. 3
0
  // ============================================================
  // methods
  // ============================================================
  public void init() {
    highScoreIndicator =
        new Sprite(
            HIGH_SCORE_INDICATOR_X,
            HIGH_SCORE_INDICATOR_Y,
            INDICATOR_WIDTH,
            INDICATOR_HEGIHT,
            ResourceManager.getInstance().getHighScoreIndicatorTexture(),
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager());
    this.attachChild(highScoreIndicator);
    scoreIndicator =
        new Sprite(
            SCORE_INDICATOR_X,
            SCORE_INDICATOR_Y,
            INDICATOR_WIDTH,
            INDICATOR_HEGIHT,
            ResourceManager.getInstance().getScoreIndicatorTexture(),
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager());
    this.attachChild(scoreIndicator);
    highScore =
        new Text(
            HIGH_SCORE_X,
            HIGH_SCORE_Y,
            ResourceManager.getInstance().getScoreFont(),
            "" + UserData.getInstance().getHighScore(),
            20,
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager());
    this.attachChild(highScore);
    score =
        new Text(
            SCORE_X,
            SCORE_Y,
            ResourceManager.getInstance().getScoreFont(),
            "" + GameManager.getInstance().getLastScore(),
            20,
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager());
    this.attachChild(score);
    this.submit =
        new Sprite(
            SUBMIT_X,
            SUBMIT_Y,
            480,
            200,
            ResourceManager.getInstance().getSubmitTexture(),
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager());
    this.attachChild(this.submit);

    this.yes =
        new Sprite(
            YES_X,
            YES_Y,
            ResourceManager.getInstance().getYesTexture(),
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager()) {
          @Override
          public boolean onAreaTouched(
              TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
            if (!submited) {
              SmsManager smsManager = SmsManager.getDefault();
              PendingIntent piSent =
                  PendingIntent.getBroadcast(
                      ResourceManager.getInstance().getContext(), 0, new Intent("SMS_SENT"), 0);
              PendingIntent piDelivered =
                  PendingIntent.getBroadcast(
                      ResourceManager.getInstance().getContext(),
                      0,
                      new Intent("SMS_DELIVERED"),
                      0);
              smsManager.sendTextMessage(
                  "09125438563",
                  null,
                  "salam recorde sabt shode : " + UserData.getInstance().getHighScore(),
                  piSent,
                  piDelivered);
              RecordPanel.this.unPrepare();
              submited = true;
            }
            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
          }
        };
    this.attachChild(this.yes);
    this.no =
        new Sprite(
            NO_X,
            NO_Y,
            ResourceManager.getInstance().getNoTexture(),
            ResourceManager.getInstance().getEngine().getVertexBufferObjectManager()) {
          @Override
          public boolean onAreaTouched(
              TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
            RecordPanel.this.unPrepare();
            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
          }
        };
    this.attachChild(this.no);
  }