Esempio n. 1
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     this.Services.AddService(typeof(SpriteBatch), spriteBatch);
     textureBackgournd   = Content.Load <Texture2D>("MainMenu//BackGround");
     btnPlay             = new cButton(this, Content.Load <Texture2D>("MainMenu//Play"), new Point(x / 2 - 150, y / 2 - 150), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnHowToPlay        = new cButton(this, Content.Load <Texture2D>("MainMenu//HowToPlay"), new Point(x / 2 - 150, y / 2 - 50), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnAbout            = new cButton(this, Content.Load <Texture2D>("MainMenu//About"), new Point(x / 2 - 150, y / 2 + 50), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnExit             = new cButton(this, Content.Load <Texture2D>("MainMenu//Exit"), new Point(x / 2 - 150, y / 2 + 150), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnBack             = new cButton(this, Content.Load <Texture2D>("MainMenu//Back"), new Point(x - 150, y - 50), new Vector2(160, 75), Content.Load <SoundEffect>("audios//magicstep"));
     btnEasy             = new cButton(this, Content.Load <Texture2D>("MainMenu//Easy"), new Point(x / 2 - 150, y / 2 - 150), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnMedium           = new cButton(this, Content.Load <Texture2D>("MainMenu//Medium"), new Point(x / 2 - 150, y / 2), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnHard             = new cButton(this, Content.Load <Texture2D>("MainMenu//Hard"), new Point(x / 2 - 150, y / 2 + 150), new Vector2(300, 100), Content.Load <SoundEffect>("audios//magicstep"));
     btnWin              = new cButton(this, Content.Load <Texture2D>("MainMenu//Win"), new Point(x / 2 - 150, y / 2 - 75), new Vector2(300, 150), Content.Load <SoundEffect>("audios//magicstep"));
     btnLose             = new cButton(this, Content.Load <Texture2D>("MainMenu//Lose"), new Point(x / 2 - 150, y / 2 - 75), new Vector2(300, 150), Content.Load <SoundEffect>("audios//magicstep"));
     btnRestart          = new cButton(this, Content.Load <Texture2D>("MainMenu//Restart"), new Point(-20, y - 50), new Vector2(150, 75), Content.Load <SoundEffect>("audios//magicstep"));
     btnMute             = new cButton(this, Content.Load <Texture2D>("MainMenu//Mute"), new Point(850, 20), new Vector2(100, 50), Content.Load <SoundEffect>("audios//magicstep"));
     btnUnmute           = new cButton(this, Content.Load <Texture2D>("MainMenu//Unmute"), new Point(850, 20), new Vector2(100, 50), Content.Load <SoundEffect>("audios//magicstep"));
     soundExplosion      = Content.Load <SoundEffect>("Audios//explosion");
     soundGameover       = Content.Load <SoundEffect>("Audios//gameover");
     soundStartgame      = Content.Load <SoundEffect>("Audios//startgame");
     soundWinner         = Content.Load <SoundEffect>("Audios//Winner");
     soundConvert        = soundMainMenu = Content.Load <Song>("Audios//MainMenu");
     soundPlayBackground = Content.Load <Song>("Audios//PlayBackground");
     MediaPlayer.Play(soundConvert);
 }
Esempio n. 2
0
        private void Start(int NumberOfButton, int NumberOfBoom)
        {
            soundConvert   = soundPlayBackground;
            LastTickCount -= 100000;
            player         = new cPlayer(this, Content.Load <Texture2D>("Sprite//PLayer"), StartPoint, new Point(NumberOfButton * 65 + 150, NumberOfButton * 65), Content.Load <SoundEffect>("Audios//magicstep"));
            fx             = rand.Next(NumberOfButton / 2 + 1, NumberOfButton + 1);
            fy             = rand.Next(NumberOfButton / 2 + 1, NumberOfButton + 1);
            if (sound == true)
            {
                if (startgame)
                {
                    soundStartgame.Play();
                }
            }
            stopped = false;
            count   = 0;
            winner  = Winner.Playing;
            Button  = new cButton[NumberOfButton + 1, NumberOfButton + 1];
            Button1 = new cButton[NumberOfButton + 1, NumberOfButton + 1];
            bState  = new int[NumberOfButton + 2, NumberOfButton + 2];
            for (int i = 1; i <= NumberOfButton; i++)
            {
                for (int j = 1; j <= NumberOfButton; j++)
                {
                    bState[i, j] = 1;
                }
            }
            for (int i = 0; i < NumberOfButton + 1; i++)
            {
                bState[i, 0] = 10;
                bState[0, i] = 10;
                bState[i, NumberOfButton + 1] = 10;
                bState[NumberOfButton + 1, i] = 10;
            }
            bState[fx, fy] = 100;
            FindAway(fx, fy);
            RandomBoom(NumberOfBoom, NumberOfButton);
            CheckBoom(NumberOfButton);
            int by = 0;

            for (int i = 1; i <= NumberOfButton; i++)
            {
                int bx = 150;
                for (int j = 1; j <= NumberOfButton; j++)
                {
                    Button[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_cell"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                    switch (bState[i, j])
                    {
                    case 1:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit1"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 2:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit2"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 3:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit3"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 4:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit4"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 5:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit5"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 6:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit6"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 7:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit7"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 8:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit8"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 0:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_poit9"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case -1:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_bom"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;

                    case 100:
                        Button1[i, j] = new cButton(this, Content.Load <Texture2D>("Buttons//img_finish"), new Point(bx, by), new Vector2(65, 65), Content.Load <SoundEffect>("audios//magicstep"));
                        break;
                    }
                    bx += 65;
                }
                by += 65;
            }
        }