Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game (Unless used and added more than once) and is the place to load
        /// all of your content.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            spriteBatch = ScreenManager.SpriteBatch;

            tetrisLogo         = ScreenManager.Content.Load <Texture2D>(@"MainMenuTextures\Tetris-logo");
            Globals.TetrisFont = ScreenManager.Content.Load <SpriteFont>(@"Fonts\TetrisFont");

            //TODO: Read from XML
            AudioHelper.AddSoundEffect("LockDown", ScreenManager.Content.Load <SoundEffect>(@"Audio\TetrisPlace"));
            AudioHelper.AddSoundEffect("Tetris!", ScreenManager.Content.Load <SoundEffect>(@"Audio\TetrisUnlocked"));
            AudioHelper.AddSoundEffect("LineClear", ScreenManager.Content.Load <SoundEffect>(@"Audio\TetrisLineClear"));
            AudioHelper.AddSoundEffect("LevelUp", ScreenManager.Content.Load <SoundEffect>(@"Audio\TetrisLevelUp"));

            AudioHelper.AddSong("TetrisClassic", ScreenManager.Content.Load <Song>(@"Audio\TetrisClassic"));
            AudioHelper.AddSong("TetrisAcapella", ScreenManager.Content.Load <Song>(@"Audio\TetrisAcapella"));
            AudioHelper.AddSong("TetrisMetal", ScreenManager.Content.Load <Song>(@"Audio\TetrisMetal"));
            AudioHelper.PlaySong("TetrisMetal", true);

            Viewport port = this.ScreenManager.GraphicsDevice.Viewport;

            Vector2 fontMetrics       = Globals.TetrisFont.MeasureString("Touch Anywhere to Begin");
            Vector2 startTextPosition = new Vector2((port.Width / 2) - (fontMetrics.X / 2), ((port.Height / 2)) - (fontMetrics.Y / 2) + 50);

            startFlasher = new TextFlasher(Globals.TetrisFont, "Touch Anywhere to Begin", startTextPosition, 1.0f, Color.Orange, 1000);
        }
        /// <summary>
        /// LoadContent will be called once per game (Unless used and added more than once) and is the place to load
        /// all of your content.
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            spriteBatch = ScreenManager.SpriteBatch; //Keep a local instance so we're not always calling a method
            Globals.TetrominoTexture = ScreenManager.Content.Load <Texture2D>(@"GameplayTextures\tetriminos");
            Globals.FieldTexture     = ScreenManager.Content.Load <Texture2D>(@"GameplayTextures\Panda Attack");
            Globals.ArrowsTexture    = ScreenManager.Content.Load <Texture2D>(@"GameplayTextures\arrows_2");

            Vector2 fontMetrics  = Globals.TetrisFont.MeasureString("Demo Mode") * 2;
            Vector2 demoPosition = new Vector2((field.Width * Globals.MinoWidth / 2) - (fontMetrics.X / 2), ((field.Height - 2) * Globals.MinoHeight / 2) - (fontMetrics.Y / 2));

            Vector2 subHeadingMetrics = Globals.TetrisFont.MeasureString("Touch Anywhere");
            Vector2 subDemoPosition   = new Vector2((field.Width * Globals.MinoWidth / 2) - (subHeadingMetrics.X / 2), demoPosition.Y + fontMetrics.Y + 10);

            demoFlasher = new TextFlasher(Globals.TetrisFont,
                                          new String[] { "Demo Mode", "Touch Anywhere" },
                                          new Vector2[] { demoPosition, subDemoPosition },
                                          new float[] { 2.0f, 1.0f },
                                          new Color[] { Color.Orange, Color.Orange },
                                          1000);
        }