Example #1
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);
  }
Example #2
0
 public void update() {
   highScore.setText(UserData.getInstance().getHighScore() + "");
   score.setText(GameManager.getInstance().getLastScore() + "");
 }