Android Open Source - Apocalypse-Defense Apocalypse Defense Activity






From Project

Back to project page Apocalypse-Defense.

License

The source code is released under:

MIT License

If you think the Android project Apocalypse-Defense listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.apocalypsedefense.app;
/*  w ww.j  a v a2  s .c om*/
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import com.apocalypsedefense.core.GameData;
import com.apocalypsedefense.core.Shared;

//import android.support.v4.app.ListFragment;

public class ApocalypseDefenseActivity extends Activity {
  protected static final int OVERWRITE_EXISTING_GAME_DIALOG_ID = 0;
    Boolean _isResumeGameEnabled = true;
    private static final String TAG = "ApocalypseDefenseActivity";

    @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        if (savedInstanceState != null){
            if(savedInstanceState.containsKey(Shared.GAME_DATA_01)){
    //            Shared.gameData = (GameData) savedInstanceState.get(Shared.GAME_DATA_01);
                final Object gameData01 = savedInstanceState.get(Shared.GAME_DATA_01);
                Log.d(TAG, "bundle contained: " + gameData01.toString());
            }
        }

    setContentView(R.layout.main);

    // new game screen transition
    View newgamebutton = this.findViewById(R.id.newGame);
    final ApocalypseDefenseActivity thisActivity = this;
    newgamebutton.setOnClickListener(new OnClickListener() {
      public void onClick(View v) {
        startActivity(new Intent(getBaseContext(), NewGameSettingsActivity.class));
        // TODO: Add logic for overwriting-game dialog
//        showDialog(OVERWRITE_EXISTING_GAME_DIALOG_ID);
      }
    });

//    // resume game handler
//    View r = this.findViewById(R.id.resumeGame);
//    r.setEnabled(_isResumeGameEnabled);
//    r.setOnClickListener(new OnClickListener() {
//      public void onClick(View v) {
//        // TODO: resume saved game
//        startActivity(new Intent(thisActivity,
//            InGameActivity.class));
//      }
//    });
//
//    // achievements handler
//    View a = this.findViewById(R.id.viewAchievements);
//    a.setOnClickListener(new OnClickListener() {
//      public void onClick(View v) {
//        startActivity(new Intent(thisActivity,
//            AchievementsActivity.class));
//      }
//    });
  }

  @Override
  protected Dialog onCreateDialog(int id) {
    switch (id) {
    case OVERWRITE_EXISTING_GAME_DIALOG_ID:
      return new OverwriteExistingGameDialog(this);
//      LayoutInflater factory = LayoutInflater.from(this);
//      final View xmlLayout = factory.inflate(
//          R.layout.overwrite_existing_game_dialog, null);
//      return new AlertDialog.Builder(ApocalypseDefenseActivity.this)
//          // .setIcon(R.drawable.alert_dialog_icon)
//          // .setTitle(R.string.alert_dialog_two_buttons_msg)
//          // .setMessage("Overwrite message")
//          .setView(xmlLayout)
//          .setPositiveButton("Overwrite", _newGameListener)
//          .setNegativeButton("Keep", null)
////          .setPositiveButton("Overwrite", new
////              DialogInterface.OnClickListener() {
////            public void onClick(DialogInterface dialog, int
////                whichButton) {
////
////              /* User clicked OK so do some stuff */
////            }
////          })
//          // .setNeutralButton(R.string.alert_dialog_something, new
//          // DialogInterface.OnClickListener() {
//          // public void onClick(DialogInterface dialog, int
//          // whichButton) {
//          //
//          // /* User clicked Something so do some stuff */
//          // }
//          // })
//          // .setNegativeButton("Keep", new
//          // DialogInterface.OnClickListener() {
//          // public void onClick(DialogInterface dialog, int
//          // whichButton) {
//          //
//          // /* User clicked Cancel so do some stuff */
//          // }
//          // })
//          .create();
    }
    return null;
  }
}




Java Source Code List

com.apocalypsedefense.app.AchievementsActivity.java
com.apocalypsedefense.app.ApocalypseDefenseActivity.java
com.apocalypsedefense.app.EndOfGameDialog.java
com.apocalypsedefense.app.ExitConfirmationDialog.java
com.apocalypsedefense.app.InGameActivity.java
com.apocalypsedefense.app.InstructionsDialog.java
com.apocalypsedefense.app.NewGameSettingsActivity.java
com.apocalypsedefense.app.OverwriteExistingGameDialog.java
com.apocalypsedefense.app.gameplay_visuals.AndroidLogAdapter.java
com.apocalypsedefense.app.gameplay_visuals.GameFacade.java
com.apocalypsedefense.app.gameplay_visuals.GameObject.java
com.apocalypsedefense.app.gameplay_visuals.GameSurfaceView.java
com.apocalypsedefense.app.gameplay_visuals.GameThread.java
com.apocalypsedefense.app.gameplay_visuals.OnGameEndListener.java
com.apocalypsedefense.app.gameplay_visuals.OnStatsChangedListener.java
com.apocalypsedefense.app.gameplay_visuals.Sprite.java
com.apocalypsedefense.core.ActorType.java
com.apocalypsedefense.core.Armor.java
com.apocalypsedefense.core.GameData.java
com.apocalypsedefense.core.GameState.java
com.apocalypsedefense.core.Game.java
com.apocalypsedefense.core.Gun.java
com.apocalypsedefense.core.LogAdapter.java
com.apocalypsedefense.core.MapElement.java
com.apocalypsedefense.core.Map.java
com.apocalypsedefense.core.Movement.java
com.apocalypsedefense.core.Person.java
com.apocalypsedefense.core.Point.java
com.apocalypsedefense.core.PrintLogAdapter.java
com.apocalypsedefense.core.Shared.java
com.apocalypsedefense.core.SurvivorManager.java
com.apocalypsedefense.core.Survivor.java
com.apocalypsedefense.core.Weapon.java
com.apocalypsedefense.core.ZombieManager.java
com.apocalypsedefense.core.Zombie.java
com.apocalypsedefense.core.testDriver.java