Changeset bb2fa26 in advance-wars for src/com/medievaltech
- Timestamp:
- Jan 19, 2015, 10:25:28 PM (10 years ago)
- Branches:
- master
- Parents:
- 4666fae
- Location:
- src/com/medievaltech/advancewars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/medievaltech/advancewars/Game.java
r4666fae rbb2fa26 6 6 import android.os.Bundle; 7 7 import android.util.Log; 8 import android.view.ContextMenu; 8 9 import android.view.Menu; 10 import android.view.MenuInflater; 9 11 import android.view.MenuItem; 12 import android.view.View; 13 import android.view.ContextMenu.ContextMenuInfo; 10 14 import android.view.Window; 11 15 … … 77 81 // turn off the window's title bar 78 82 requestWindowFeature(Window.FEATURE_NO_TITLE); 79 83 80 84 // tell system to use the layout defined in our XML file 81 85 setContentView(R.layout.main); 82 86 87 /*View v = findViewById(R.id.main_view); 88 Log.i("AdvanceWars", "view is null?: " + (v==null));*/ 89 83 90 Static.game = this; 84 91 … … 90 97 Static.gameState = (GameState)savedInstanceState.getSerializable("gameState"); 91 98 } 99 } 100 101 @Override 102 public void onCreateContextMenu(ContextMenu menu, View v, 103 ContextMenuInfo menuInfo) { 104 super.onCreateContextMenu(menu, v, menuInfo); 105 MenuInflater inflater = getMenuInflater(); 106 inflater.inflate(R.menu.map_menu, menu); 92 107 } 93 108 -
src/com/medievaltech/advancewars/GameView.java
r4666fae rbb2fa26 12 12 import android.os.*; 13 13 import android.view.*; 14 import android.view.ContextMenu.ContextMenuInfo; 14 15 import android.util.AttributeSet; 15 16 import android.util.Log; … … 209 210 } 210 211 } 211 212 /** Pointer to the text view to display "Paused.." etc. */ 213 //private TextView mStatusText; 214 212 215 213 public GameView(Context context, AttributeSet attrs) { 216 214 super(context, attrs); … … 233 231 switch(Static.gameState) { 234 232 case MAIN_MENU: 235 Log.i("AdvanceWars", "Switching to battle map");236 233 if(Static.wndMainMenu.getGUIObject("btnNewGame").isClicked(event.getX(), event.getY())) { 234 Log.i("AdvanceWars", "Switching to battle map"); 237 235 Static.gameState = GameState.BATTLE_MAP; 238 236 }else if(Static.wndMainMenu.getGUIObject("btnLoadGame").isClicked(event.getX(), event.getY())) { … … 293 291 int y = ((int)event.getY() - Static.map.offset.y) / 50; 294 292 293 Log.i("AdvanceWars", "About to show context menu"); 294 showContextMenu(); 295 296 /* 297 295 298 Unit target = Static.map.getTile(x, y).currentUnit; 296 299 297 300 if(Static.thread.selectedUnit != null && Static.thread.selectedUnit.getMovementRange().contains(new Point(x, y))) { 301 //Display a menu allowing the player to move to the target or attack the target or 302 //get more info on the target 303 298 304 if(target == null || target == Static.thread.selectedUnit) { 299 305 Static.map.getTile(Static.thread.selectedUnit.location.x, Static.thread.selectedUnit.location.y).removeUnit(); 300 306 Static.map.getTile(x, y).addUnit(Static.thread.selectedUnit); 301 307 }else { 302 // the target contains another unit. If the unit is enemy-controlled, attack it308 // Display a context menu that gives the option of attacking the target 303 309 } 304 310 Static.thread.selectedUnit = null; 305 311 }else 306 312 Static.thread.selectedUnit = target; 313 */ 307 314 } 308 315
Note:
See TracChangeset
for help on using the changeset viewer.