public void AboutScreeEvent(object obj, EventArgs e) { if ((double)obj == Game1.HOME) { mCurrentScreen = mHomeScreen; } }
//This event fires when the Controller detect screen is returning control back to the main game class public void HomeScreenEvent(object obj, EventArgs e) { //Switch to the title screen, the Controller detect screen is finished being displayed if ((double)obj == Game1.PLAY) { Game1.MENU_SOUND_INSTANCE.Stop(); mPlayScreen = new PlayScreen(this.Content, this.GraphicsDevice, new EventHandler(PlayScreenEvent)); mCurrentScreen = mPlayScreen; } else if ((double)obj == Game1.ABOUT) { mCurrentScreen = mAboutScreen; } else if ((double)obj == Game1.HOW_TO_PLAY) { mCurrentScreen = mHelpScreen; } else if ((double)obj == Game1.EXIT) { this.Exit(); } }
/// <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); // TODO: use this.Content to load your game content here CURSOR_ACTIVE = Content.Load<Texture2D>("image/cursor_negative_t"); CURSOR_HOVER = Content.Load<Texture2D>("image/cursor_t"); CURSOR_CSTM = CURSOR_ACTIVE; //Initialize the various screens in the game mHomeScreen = new HomeScreen(this.Content, this.GraphicsDevice, new EventHandler(HomeScreenEvent)); mAboutScreen = new AboutScreen(this.Content, this.GraphicsDevice, new EventHandler(AboutScreeEvent)); mHelpScreen = new HelpScreen(this.Content, this.GraphicsDevice, new EventHandler(AboutScreeEvent)); //Set the current screen mCurrentScreen = mHomeScreen; // static sound effent MOUSE_DOWN = this.Content.Load<SoundEffect>("sound/mousedown"); MENU_SOUND = this.Content.Load<SoundEffect>("sound/menu"); MENU_SOUND_INSTANCE = MENU_SOUND.CreateInstance(); MENU_SOUND_INSTANCE.IsLooped = true; MENU_SOUND_INSTANCE.Play(); }
public void PlayScreenEvent(object obj, EventArgs e) { if ((double)obj == Game1.HOME) { Game1.MENU_SOUND_INSTANCE.Play(); mCurrentScreen = mHomeScreen; } }