|
@@ -120,57 +120,59 @@ public class NewMenuActivity extends Activity implements View.OnClickListener{
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.activity_new_menu);
|
|
|
- mRootLayout = (RelativeLayout)findViewById(R.id.menu_root);
|
|
|
+ System.out.println( " == " + (mGame == null) );
|
|
|
+
|
|
|
+ setContentView(R.layout.activity_new_menu);
|
|
|
+ mRootLayout = (RelativeLayout) findViewById(R.id.menu_root);
|
|
|
+
|
|
|
+
|
|
|
+ Game g = Game.load(this);
|
|
|
+ System.out.println( (g != null) + " == " + (mGame == null) );
|
|
|
+ if (g != null && mGame == null) {
|
|
|
+ mGame = g;
|
|
|
+ Game.setGame(mGame);
|
|
|
+ mGame.newSensorManager(this);
|
|
|
+ Toast.makeText(this, "Chargement", Toast.LENGTH_LONG).show();
|
|
|
+ } else if (mGame == null) {
|
|
|
+ mGame = new Game("game_medium", this);
|
|
|
+ Game.setGame(mGame);
|
|
|
+ Toast.makeText(this, "Nouveau Jeu", Toast.LENGTH_LONG).show();
|
|
|
+ } else if (mGame == null) {
|
|
|
+ Toast.makeText(this, "Erreur", Toast.LENGTH_LONG).show();
|
|
|
+ throw new Error("Le jeu n'est pas sauvegardé");
|
|
|
+ }
|
|
|
+
|
|
|
+ updateSize();
|
|
|
+ Settings.setSettings(mGame.getmSettings());
|
|
|
+
|
|
|
+ mIbScanner = new Button(this);
|
|
|
+ //mIbScanner.setImageResource(R.drawable.scanner);
|
|
|
+ //mIbScanner.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
|
|
+ mRootLayout.addView(mIbScanner);
|
|
|
+ mIbScanner.setBackgroundResource(R.drawable.uibuttoncircle);
|
|
|
+ mIbScanner.setText("Scanner");
|
|
|
+ mIbScanner.setTextColor(getResources().getColor(R.color.dull_4));
|
|
|
+ mIbScanner.setTextSize(22);
|
|
|
+ mIbScanner.setOnClickListener(this);
|
|
|
+
|
|
|
+ moveView(mIbScanner, mWidth / 2 - mHeight / 8, mHOffset + mHeight / 2 - mHeight / 8, mHeight / 4, mHeight / 4);
|
|
|
+
|
|
|
+ mBBriefing = newButton("Briefing");
|
|
|
+ mBInvotory = newButton("Inventaire");
|
|
|
+ mBMap = newButton("Carte");
|
|
|
+ mBOptions = newButton("Options");
|
|
|
+ mBMenu = newButton("Menu Principal");
|
|
|
+ mBMenu.setBackgroundResource(R.drawable.title);
|
|
|
+ mBSend = newButton("Envoyer les données");
|
|
|
+ Resources r = getResources();
|
|
|
+ float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, r.getDisplayMetrics());
|
|
|
+ moveView(mBMenu, 0, 0, mWidth, (int) px);
|
|
|
+ //mBSend = newButton("Envoyer");
|
|
|
+
|
|
|
+
|
|
|
+ setUpStyle();
|
|
|
+ mCustomHandler.postDelayed(updateTimerThread, 10);
|
|
|
|
|
|
- Game g = Game.load(this);
|
|
|
-
|
|
|
- if (g!= null && mGame==null) {
|
|
|
- mGame = g;
|
|
|
- Game.setGame(mGame);
|
|
|
- mGame.newSensorManager(this);
|
|
|
- Toast.makeText(this, "Chargement", Toast.LENGTH_LONG).show();
|
|
|
- }
|
|
|
- else if( mGame==null)
|
|
|
- {
|
|
|
- mGame = new Game("game_medium", this);
|
|
|
- Game.setGame(mGame);
|
|
|
- Toast.makeText(this, "Nouveau Jeu", Toast.LENGTH_LONG).show();
|
|
|
- }else if( mGame==null)
|
|
|
- {
|
|
|
- Toast.makeText(this, "Erreur", Toast.LENGTH_LONG).show();
|
|
|
- throw new Error("Le jeu n'est pas sauvegardé");
|
|
|
- }
|
|
|
- updateSize();
|
|
|
- Settings.setSettings(mGame.getmSettings());
|
|
|
-
|
|
|
- mIbScanner = new Button(this);
|
|
|
- //mIbScanner.setImageResource(R.drawable.scanner);
|
|
|
- //mIbScanner.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
|
|
- mRootLayout.addView(mIbScanner);
|
|
|
- mIbScanner.setBackgroundResource(R.drawable.uibuttoncircle);
|
|
|
- mIbScanner.setText("Scanner");
|
|
|
- mIbScanner.setTextColor(getResources().getColor(R.color.dull_4));
|
|
|
- mIbScanner.setTextSize(22);
|
|
|
- mIbScanner.setOnClickListener(this);
|
|
|
-
|
|
|
- moveView(mIbScanner, mWidth/2-mHeight/8, mHOffset+mHeight/2-mHeight/8, mHeight/4, mHeight/4);
|
|
|
-
|
|
|
- mBBriefing = newButton("Briefing");
|
|
|
- mBInvotory = newButton("Inventaire");
|
|
|
- mBMap = newButton("Carte");
|
|
|
- mBOptions = newButton("Options");
|
|
|
- mBMenu = newButton("Menu Principal");
|
|
|
- mBMenu.setBackgroundResource(R.drawable.title);
|
|
|
- mBSend = newButton("Envoyer les données");
|
|
|
- Resources r = getResources();
|
|
|
- float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, r.getDisplayMetrics());
|
|
|
- moveView(mBMenu, 0, 0, mWidth, (int)px);
|
|
|
- //mBSend = newButton("Envoyer");
|
|
|
-
|
|
|
-
|
|
|
- setUpStyle();
|
|
|
- mCustomHandler.postDelayed(updateTimerThread, 10);
|
|
|
/*
|
|
|
mGame.pickResource("aa");
|
|
|
mGame.pickResource("ab");
|