//När man återvänder från svårighetsgrader startar spelet med vald svårighetsgrad, eller återvänder till huvudmenyn public void DifficultyEvent(object obj, EventArgs e) { sc = (ScreenChoice)e; if (sc.choice <= 2) { play = new Play(this.Content, new EventHandler(PlayEvent), this, gameField, sc.choice); currentScreen = play; } else { currentScreen = mainMenu; } }
//Skärm sätts beroende på vilket val man gjorde i huvudmenyn public void MainMenuEvent(object obj, EventArgs e) { sc = (ScreenChoice)e; switch (sc.choice) { case 0: currentScreen = difficulty; break; case 1: currentScreen = howToPlay; break; case 2: currentScreen = options; break; default: break; } }
public void HowToPlayEvent(object obj, EventArgs e) { currentScreen = mainMenu; }
public void GameCompleteEvent(object obj, EventArgs e) { currentScreen = mainMenu; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Skapar nya skärmar mainMenu = new MainMenu(this.Content, new EventHandler(MainMenuEvent), this); options = new Options(this.Content, new EventHandler(OptionsEvent), this, graphics); howToPlay = new HowToPlay(this.Content, new EventHandler(HowToPlayEvent), this); difficulty = new Difficulty(this.Content, new EventHandler(DifficultyEvent), this); gameComplete = new GameComplete(this.Content, new EventHandler(GameCompleteEvent), this); //Sätter igång bakgrundsmusiken music.Play(); IsMouseVisible = true; currentScreen = mainMenu; }
//Antinger går man till huvudmenyn eller så är spelet avklarat public void PlayEvent(object obj, EventArgs e) { sc = (ScreenChoice)e; IsMouseVisible = true; switch (sc.choice) { case 0: currentScreen = mainMenu; break; case 1: currentScreen = gameComplete; break; default: break; } }
public void OptionsEvent(object obj, EventArgs e) { currentScreen = mainMenu; }