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 } }
public GameState Update(Microsoft.Xna.Framework.GameTime gameTime) { lastState = currentState; currentState = Mouse.GetState(); // Hover-Check-Routines if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[0].Texture = back_select; } else { bl[0].Texture = back; } if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { if (GameSpecs.SoundOn) { bl[1].Texture = sound_select; } else { bl[1].Texture = noSound_select; } } else { if (GameSpecs.SoundOn) { bl[1].Texture = sound; } else { bl[1].Texture = noSound; } } if (bl[2].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { if (GameSpecs.MusicOn) { bl[2].Texture = sound2_select; } else { bl[2].Texture = noSound2_select; } } else { if (GameSpecs.MusicOn) { bl[2].Texture = sound2; } else { bl[2].Texture = noSound2; } } // Click-Check-Routine if (currentState.LeftButton == ButtonState.Released && lastState.LeftButton == ButtonState.Pressed) { // Button to return to MainMenu-Screen if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { Extension.PlaySoundEffect("menuClick"); g.Clear(Color.Black); Thread.Sleep(200); GameSpecs.PreviousGamestate = GameState.OptionMenu; return(GameState.MainMenuNoSession); } if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); if (GameSpecs.SoundOn) { Extension.MuteUnmuteClickSounds(); Thread.Sleep(150); } else { Extension.MuteUnmuteClickSounds(); } } if (bl[2].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); if (GameSpecs.MusicOn) { Extension.MuteMusic(); GameSpecs.MusicOn = false; Thread.Sleep(150); } else { Extension.UnmuteMusic(); GameSpecs.MusicOn = true; Thread.Sleep(150); } } } return(GameState.OptionMenu); }
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(); } } }