Пример #1
0
        /// <summary>
        /// Load screen resources
        /// </summary>
        public override void LoadContent()
        {
            AudioManager.PlaySound("menu");

            MenuEntry returnGameMenuEntry = new MenuEntry("Resume");
            returnGameMenuEntry.Scale = 0.7f;
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            // Calculate menu positions - we do this here since we want the screen
            // manager to be available
            int quarterViewportWidth = ScreenManager.GraphicsDevice.Viewport.Width / 4;
            int menuEntryHeight = SafeArea.Bottom - ScreenManager.ButtonBackground.Height * 2;            
            returnGameMenuEntry.Position = new Vector2(quarterViewportWidth -
                ScreenManager.ButtonBackground.Width / 2, menuEntryHeight);
            exitMenuEntry.Position = new Vector2(3 * quarterViewportWidth -
                ScreenManager.ButtonBackground.Width / 2, menuEntryHeight);

            // Hook up menu event handlers.
            returnGameMenuEntry.Selected += ReturnGameMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            //// Add entries to the menu.
            MenuEntries.Add(returnGameMenuEntry);
            MenuEntries.Add(exitMenuEntry);

            base.LoadContent();
        }
Пример #2
0
        public override void LoadContent()
        {
            // Create our menu entries.
            MenuEntry startGameMenuEntry = new MenuEntry("Start");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            // Calculate menu positions - we do this here since we want the screen
            // manager to be available
            int quarterViewportWidth = ScreenManager.GraphicsDevice.Viewport.Width / 4;
            int menuEntryHeight = SafeArea.Bottom - ScreenManager.ButtonBackground.Height * 2;
            startGameMenuEntry.Position = new Vector2(quarterViewportWidth -
                ScreenManager.ButtonBackground.Width / 2, menuEntryHeight);
            exitMenuEntry.Position = new Vector2(3 * quarterViewportWidth -
                ScreenManager.ButtonBackground.Width / 2, menuEntryHeight);

            // Hook up menu event handlers.
            startGameMenuEntry.Selected += StartGameMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(startGameMenuEntry);
            MenuEntries.Add(exitMenuEntry);            

            AudioManager.LoadSounds();
            AudioManager.LoadMusic();

            AudioManager.PlayMusic("MenuMusic_Loop");

            base.LoadContent();
        }
Пример #3
0
 /// <summary>
 /// Allows the screen to create the hit bounds for a particular menu entry.
 /// </summary>
 protected virtual Rectangle GetMenuEntryHitBounds(MenuEntry entry)
 {
     return entry.Bounds;
 }
Пример #4
0
 /// <summary>
 /// Allows the screen to create the hit bounds for a particular menu entry.
 /// </summary>
 protected virtual Rectangle GetMenuEntryHitBounds(MenuEntry entry)
 {
     return(entry.Bounds);
 }