示例#1
0
  public void script() {
    gm = new GameScript(pl);

    status.setText(gm.getScene());
    response.setText(gm.getPl_res());
    ch = gm.getChoices();

    b1.setText(ch[0]);
    b2.setText(ch[1]);
    b3.setText(ch[2]);
    b4.setText(ch[3]);
    gm.setRunning(true);
    gm.start();
  }
示例#2
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   Log.d(TAG, "Destroying..");
   gm.setRunning(false);
 }
示例#3
0
  public void update() {
    String scene = gm.getScene();
    status.setText(scene);
    response.setText(gm.getPl_res());
    ch = gm.getChoices();
    if (gm.getBattle()) {
      /*data = gm.getEn();
      if (data == null )
      {
      	Log.d(TAG, "no data");
      }
      else
      { */
      status.setText(scene);
      response.setText(gm.getPl_res());
      b1.setText("Attack");
      b2.setText("Defend");
      b3.setText("Flee");
      b4.setText("Skills");

    } else if (gm.isOver()) {
      Log.d(TAG, "Game over");
      Intent over = new Intent(StartGame.this, GameOver.class);
      startActivity(over);
      this.finish();
    } else {
      b1.setText(ch[0]);
      b2.setText(ch[1]);
      b3.setText(ch[2]);
      b4.setText(ch[3]);
    }
  }
示例#4
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    String choice = null;
    switch (v.getId()) {
      case R.id.choice1:
        choice = (String) b1.getText();
        gm.chose(ONE);
        try {
          Thread.sleep(2000);
          update();
        } catch (InterruptedException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }

        Log.d(TAG, choice);

        break;
      case R.id.choice2:
        choice = (String) b2.getText();
        gm.chose(TWO);
        try {
          Thread.sleep(2000);
          update();
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        Log.d(TAG, choice);
        break;
      case R.id.choice3:
        choice = (String) b3.getText();
        gm.chose(THREE);
        try {
          Thread.sleep(2000);
          update();

        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        Log.d(TAG, choice);
        break;
      case R.id.choice4:
        choice = (String) b4.getText();
        gm.chose(FOUR);
        try {
          Thread.sleep(2000);
          update();
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        Log.d(TAG, choice);
        break;
      case R.id.Items:
        Intent it = new Intent(StartGame.this, ItemList.class);

        break;
    }
  }