示例#1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            switch (scene0.State + scene1.State + scene2.State)
            {
            case 0:
                scene0.Show();
                scene1.Hide();
                scene2.Hide();
                break;

            case 1:
                scene0.Hide();
                scene1.Show();
                scene2.Hide();
                break;

            case 2:
                scene0.Hide();
                scene1.Hide();
                scene2.Show();
                break;
            }
            base.Update(gameTime);
        }
示例#2
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                Exit();
            }

            switch (_scene0.State + _scene1.State)
            {
            case 0:
                _scene0.Show();
                _scene1.Hide();
                break;

            case 1:
                _scene0.Hide();
                _scene1.Show();
                break;

            case 2:
                _scene0.Hide();
                _scene1.Hide();
                if (_scene2 == null)
                {
                    _scene2 = new Scene2(this, _device);
                    Components.Add(_scene2);
                }
                _scene2.Show();
                break;
            }
            base.Update(gameTime);
        }
示例#3
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     soundCenter = new SoundCenter(this);
     font        = Content.Load <SpriteFont>("MyFont");
     Services.AddService(typeof(SpriteBatch), spriteBatch);
     Services.AddService(typeof(SoundCenter), soundCenter);
     Services.AddService(typeof(SpriteFont), font);
     scene0 = new Scene0(this);
     scene1 = new Scene1(this, screenWidth, screenHeight, 1);
     scene2 = new Scene2(this, screenWidth, screenHeight);
     scene2.Hide();
     scene1.Hide();
     scene0.Show();
     Components.Add(scene0);
     Components.Add(scene1);
     Components.Add(scene2);
 }
示例#4
0
 protected override void LoadContent()
 {
     _spriteBatch   = new SpriteBatch(GraphicsDevice);
     _device        = _graphics.GraphicsDevice;
     ScreenWidth    = _device.PresentationParameters.BackBufferWidth;
     ScreenHeight   = _device.PresentationParameters.BackBufferHeight;
     _soundCenter   = new SoundCenter(this);
     _textureCenter = new TextureCenter(this);
     _font          = Content.Load <SpriteFont>("MyFont");
     Services.AddService(typeof(SpriteBatch), _spriteBatch);
     Services.AddService(typeof(SoundCenter), _soundCenter);
     Services.AddService(typeof(SpriteFont), _font);
     Services.AddService(typeof(TextureCenter), _textureCenter);
     _scene0 = new Scene0(this);
     _scene1 = new Scene1(this, _device);
     _scene1.Hide();
     _scene0.Show();
     Components.Add(_scene0);
     Components.Add(_scene1);
 }