Changeset 4666fae in advance-wars for src/com/medievaltech/advancewars/Game.java


Ignore:
Timestamp:
Oct 20, 2011, 3:25:50 PM (13 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
bb2fa26
Parents:
331d180
Message:

Moved many widely used variables to the Static class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/medievaltech/advancewars/Game.java

    r331d180 r4666fae  
    99import android.view.MenuItem;
    1010import android.view.Window;
    11 import android.widget.TextView;
    1211
    13 import com.medievaltech.advancewars.GameView.*;
    1412import com.medievaltech.advancewars.Enum.*;
    1513
    1614public class Game extends Activity {
    17     public DrawingThread mThread;
    18     private GameView mGameView;
    19    
     15       
    2016    /**
    2117     * Invoked during init to give the Activity a chance to set up its Menu.
     
    4743       
    4844        if(i == MenuOption.END_TURN.ordinal()) {
    49                 mThread.mTurn = Turn.ENEMY_TURN;
     45                Static.turn = Turn.ENEMY_TURN;
    5046        }else if(i == MenuOption.SAVE.ordinal()) {
    5147                try {
     
    5753                }
    5854        }else if(i == MenuOption.MAIN.ordinal()) {
    59                 mThread.mGameState = GameState.MAIN_MENU;
     55                Static.gameState = GameState.MAIN_MENU;
    6056        }else if(i == MenuOption.EXIT.ordinal()) {
    6157                finish();
     
    8581        setContentView(R.layout.main);
    8682
    87         mGameView = (GameView) findViewById(R.id.lunar);
    88         mThread = mGameView.getThread();
    89         mGameView.mGame = this;
    90 
    91         mGameView.setTextView((TextView) findViewById(R.id.text));
     83        Static.game = this;
    9284
    9385        if (savedInstanceState == null) {       // we were just launched: set up a new game
     
    9688            Log.w("AdvanceWars", "SIS is nonnull");
    9789           
    98             mGameView.getThread().mGameState = (GameState)savedInstanceState.getSerializable("gameState");
     90            Static.gameState = (GameState)savedInstanceState.getSerializable("gameState");
    9991        }
    10092    }
     
    108100    @Override
    109101    protected void onSaveInstanceState(Bundle outState) {
    110         outState.putSerializable("gameState", mGameView.getThread().mGameState);
     102        outState.putSerializable("gameState", Static.gameState);
    111103       
    112104        super.onSaveInstanceState(outState);
Note: See TracChangeset for help on using the changeset viewer.