Ejemplo n.º 1
0
        // Called when Activity is first created. Turns off the title bar, sets up
        // the content views, and fires up the SnakeView.
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.snake_layout);

            snake_view = FindViewById <SnakeView> (Resource.Id.snake);
            snake_view.SetTextView(FindViewById <TextView> (Resource.Id.text));

            if (savedInstanceState == null)
            {
                // We were just launched -- set up a new game
                snake_view.SetMode(GameMode.Ready);
            }
            else
            {
                // We are being restored
                Bundle map = savedInstanceState.GetBundle(ICICLE_KEY);

                if (map != null)
                {
                    snake_view.RestoreState(map);
                }
                else
                {
                    snake_view.SetMode(GameMode.Paused);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnPause()
        {
            base.OnPause();

            // Pause the game along with the activity
            snake_view.SetMode(GameMode.Paused);
        }
Ejemplo n.º 3
0
		// Called when Activity is first created. Turns off the title bar, sets up
		// the content views, and fires up the SnakeView.
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.snake_layout);

			snake_view = FindViewById<SnakeView> (Resource.Id.snake);
			snake_view.SetTextView (FindViewById<TextView> (Resource.Id.text));

			if (savedInstanceState == null) {
				// We were just launched -- set up a new game
				snake_view.SetMode (GameMode.Ready);
			} else {
				// We are being restored
				Bundle map = savedInstanceState.GetBundle (ICICLE_KEY);

				if (map != null)
					snake_view.RestoreState (map);
				else
					snake_view.SetMode (GameMode.Paused);
			}
		}