Esempio n. 1
0
 // ------------------------------------------------------------------------------
 public void onClick(View v) {
   // TODO Auto-generated method stub
   switch (v.getId()) {
     case R.id.choilai:
       {
         nhac_nen_gameover.stop();
         choilai();
         break;
       }
     case R.id.luu:
       {
         luu();
         break;
       }
     case R.id.menu:
       {
         Intent i = new Intent(this, TankActivity.class);
         nhac_nen_gameover.stop();
         this.startActivity(i);
         this.finish();
         break;
       }
     case R.id.xem_diem_cao:
       {
         xemdiemcao();
         break;
       }
   }
 }
Esempio n. 2
0
 // ------------------------------------------------------------------------------
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     DialogExit dialogexit = new DialogExit(this, this);
     nhac_nen_gameover.stop();
     dialogexit.show();
   }
   return super.onKeyDown(keyCode, event);
 }
Esempio n. 3
0
  // ------------------------------------------------------------------------------
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.luudiem);

    nhac_nen_gameover = new Sound(this, R.raw.nhac_nen_gameover);
    if (ControlerStatic.SOUND) nhac_nen_gameover.play();

    db = new Database(this);

    Bundle b = getIntent().getExtras();

    if (b != null) {
      diem = b.getInt("diem");
    }

    choilai = (Button) findViewById(R.id.choilai);
    choilai.setOnClickListener(this);

    luu = (Button) findViewById(R.id.luu);
    luu.setOnClickListener(this);

    menu = (Button) findViewById(R.id.menu);
    menu.setOnClickListener(this);

    xem_diem_cao = (Button) findViewById(R.id.xem_diem_cao);
    xem_diem_cao.setOnClickListener(this);

    text_diem = (TextView) findViewById(R.id.diem);
    text_diem.setText(String.valueOf(diem));

    edit_ten = (EditText) findViewById(R.id.name);
  }