Guest User

Untitled

a guest
Jan 6th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. public class WW3Activity extends Activity
  2. {
  3. public boolean DebugMode = false;
  4. private String buildMenuEmplacement = "";
  5.  
  6. //[Initialization] Called when the app is first launched
  7. @Override
  8. public void onCreate(Bundle savedInstanceState)
  9. {
  10. super.onCreate(savedInstanceState);
  11. setContentView(R.layout.startscreen);
  12.  
  13. //[Initialization] Makes the button resources available to the class
  14. final Button newGame = (Button) findViewById(R.id.buttonNewGame);
  15. final Button loadGame = (Button) findViewById(R.id.buttonLoadGame);
  16. final Button exitGame = (Button) findViewById(R.id.buttonExit);
  17. final Button about = (Button) findViewById(R.id.buttonAbout);
  18. final Button troll = (Button) findViewById(R.id.buttonTroll);
  19. final Button debug = (Button) findViewById(R.id.buttonDebug);
  20.  
  21. //[Action] When user pushes the New Game button
  22. newGame.setOnClickListener(new View.OnClickListener()
  23. {
  24. public void onClick(View v)
  25. {
  26. // Perform action on click
  27. setContentView(R.layout.main);
  28. buttonInitialize();
  29. }
  30. });
  31. //[Action] When user pushes the Exit Game button
  32. exitGame.setOnClickListener(new View.OnClickListener()
  33. {
  34. public void onClick(View v)
  35. {
  36. // Perform action on click
  37. finish();
  38. }
  39. });
  40. //[Action] When user pushes the Debug Mode button
  41. exitGame.setOnClickListener(new View.OnClickListener()
  42. {
  43. public void onClick(View v)
  44. {
  45. // Perform action on click
  46. DebugMode = true;
  47. }
  48.  
  49.  
  50. });
  51. }
  52.  
  53. //[Initialization] Gets the emplacements ready to be pushed
  54. public void buttonInitialize()
  55. {
  56. final ImageView pe1 = (ImageView) findViewById(R.id.playerEmplacement1);
  57. final ImageView pe2 = (ImageView) findViewById(R.id.playerEmplacement2);
  58. final ImageView pe3 = (ImageView) findViewById(R.id.playerEmplacement3);
  59. final ImageView pc = (ImageView) findViewById(R.id.playerCity);
  60. final ImageView ee1 = (ImageView) findViewById(R.id.enemyEmplacement1);
  61. final ImageView ee2 = (ImageView) findViewById(R.id.enemyEmplacement2);
  62. final ImageView ee3 = (ImageView) findViewById(R.id.enemyEmplacement3);
  63. final ImageView ec = (ImageView) findViewById(R.id.enemyCity);
  64.  
  65. registerForContextMenu(findViewById(R.id.playerEmplacement1));
  66. registerForContextMenu(findViewById(R.id.playerEmplacement2));
  67. registerForContextMenu(findViewById(R.id.playerEmplacement3));
  68. registerForContextMenu(findViewById(R.id.enemyEmplacement1));
  69. registerForContextMenu(findViewById(R.id.enemyEmplacement2));
  70. registerForContextMenu(findViewById(R.id.enemyEmplacement3));
  71.  
  72. /*empAction(pe1);
  73. empAction(pe2);
  74. empAction(pe3);
  75. empAction(ee1);
  76. empAction(ee2);
  77. empAction(ee3);
  78. empAction(ec);
  79. empAction(pc);*/
  80. }
  81. And the LogCat:
Advertisement
Add Comment
Please, Sign In to add comment