Пример #1
0
        public void LoadContent()
        {
            g = new GraphicsDevice();

            // Loads all the used Texture-Files through the Content-Pipeline
            background     = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Others/bg_1080p.png"));
            newGame_select = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/NewGame_select.png"));
            newGame        = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/NewGame.png"));
            options_select = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/Options_select.png"));
            options        = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/Options.png"));
            quit_select    = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/Quit_select.png"));
            quit           = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/Quit.png"));

            // Loads all the used Sound-files through the Content-Pipeline
            backgroundMusicFile = SoundEffect.FromStream(TitleContainer.OpenStream("Content/Sounds/MoveForward.wav"));
            backgroundMusic     = new SoundEffectInstance(backgroundMusicFile);

            // Stops the current Background-Music in case there is any
            if (Session.Active == true)
            {
                Extension.StopSound();
            }

            if (GameSpecs.PreviousGamestate == GameState.Startscreen || GameSpecs.PreviousGamestate == GameState.MainMenuSession || GameSpecs.PreviousGamestate == GameState.Highscore)
            {
                // Starts the Background-Music suited for the Menu
                Extension.StartSound(ref backgroundMusic);

                if (!GameSpecs.MusicOn)
                {
                    Extension.MuteMusic();
                }
            }

            if (GameSpecs.PreviousGamestate == GameState.OptionMenu)
            {
                // NONE
            }
        }
Пример #2
0
        public void LoadContent()
        {
            g = new GraphicsDevice();

            // Loads all the used Texture-Files through the Content-Pipeline
            background       = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Others/bg_1080p.png"));
            backside         = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Cardset2/card_back2.png"));
            correct          = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Cardset2/card_tick3.png"));
            backArrow        = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/BackArrow.png"));
            backArrow_select = Texture2D.FromStream(g, TitleContainer.OpenStream("Content/Textures/Buttons/BackArrow_select.png"));

            // Loads all the used Sound-files through the Content-Pipeline
            backgroundMusicFile = SoundEffect.FromStream(TitleContainer.OpenStream("Content/Sounds/SillyFun.wav"));
            backgroundMusic     = new SoundEffectInstance(backgroundMusicFile);

            if (Session.Active == true)
            {
                Extension.ResumeSound();
                cardList = Session.CardList;
            }
            else
            {
                // Start the Scoretelling
                switch (GameSpecs.Difficulty)
                {
                case 1:
                {
                    Timer.Initialize(6000);
                    break;
                }

                case 2:
                {
                    Timer.Initialize(8000);
                    break;
                }

                case 3:
                {
                    Timer.Initialize(10000);
                    break;
                }
                }


                // Generates a new Set of Cards to begin a new Session
                cardList = GenerateNewCardList();

                // Starts the Timer for Scoretelling
                Timer.StartTimer();

                // Fills the cardList with new cards which are generated by GenerateNewCardList
                cardList.Reverse();
                Session.NewSession(GameSpecs.Difficulty, cardList);
                Session.Active = true;

                // Stops playing old sounds if there are any
                Extension.StopSound();

                // Starts playing new sound...
                Extension.StartSound(ref backgroundMusic);

                // ... and mutes it if the Gamespecs are set to muted
                if (!GameSpecs.MusicOn)
                {
                    Extension.MuteMusic();
                }
            }
        }