예제 #1
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();
        }
예제 #2
0
        public override void LoadContent()
        {
            AudioManager.LoadSounds();
            AudioManager.LoadMusic();

            AudioManager.PlayMusic("MenuMusic_Loop");

            base.LoadContent();
        }