Пример #1
0
 /// <summary>
 /// Checks to see if a menu item has been touched.
 /// </summary>
 /// <param name="item">The menu item that needs to be checked.</param>
 /// <returns>True if the menu item was indeed touched.</returns>
 private bool isTapped(MenuItem item)
 {
     tapPosition();
     if (item.HitBounds.Contains((int)tapLocation.X, (int)tapLocation.Y))
         return true;  //return true if the location of the tap fell within the bounds of the menu item
     else
         return false;
 }
Пример #2
0
        /// <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);

            //Load the personal scores and sound setting
            ScoresData = personalScoresSaver.LoadMyData("LocalScores");
            if (ScoresData == null)
                ScoresData = new LocalScores();
            SoundManager.PlaySounds = ScoresData.soundOn;

            //Create banner ad on the screen
            bannerAd = adManager.CreateAd("10016958", new Rectangle(160, 0, 480, 80), RotationMode.Manual, false);

            //Load all the graphics
            gameScreen = Content.Load<Texture2D>(@"MenuScreens\gamestartscreen");
            howToScreen = Content.Load<Texture2D>(@"MenuScreens\howtoscreen");
            highScores = Content.Load<Texture2D>(@"MenuScreens\highscoresscreen");
            contactInfo = Content.Load<Texture2D>(@"MenuScreens\contactscreen");
            myScoresScreen = Content.Load<Texture2D>(@"MenuScreens\myscoresscreen");
            spriteSheet = Content.Load<Texture2D>("spritesheet");
            background1 = Content.Load<Texture2D>("background01");
            background2 = Content.Load<Texture2D>("background02");
            pausedScreen = Content.Load<Texture2D>(@"MenuScreens\pausedscreen");
            submitScore = Content.Load<Texture2D>(@"MenuScreens\enterhighscore");
            offonSprite = Content.Load<Texture2D>(@"MenuScreens\offonsprite");

            //Load all the fonts
            highScoresFont = Content.Load<SpriteFont>(@"Fonts\highscores");
            submitScoreFont = Content.Load<SpriteFont>(@"Fonts\submitscores");
            scoreFont = Content.Load<SpriteFont>(@"Fonts\score");

            //Set the size of the WHOLE world and the viewable screen
            CameraManager.WorldRectangle = new Rectangle(0, 0, 1600, 1440);
            CameraManager.ViewPortWidth = 800;
            CameraManager.ViewPortHeight = 480;

            //Initialize all the managers
            BackgroundManager.Initialize(background1, background2, new Rectangle(0, 0, 1600, 1440), 1);
            PlayerManager.Initialize(spriteSheet, new Rectangle(0, 0, 161, 86), new Vector2(65, 200), 2);
            ItemManager.Initialize(spriteSheet);
            SoundManager.Initialize(Content);
            HighScoreTable.Initialize();

            //Set the locations of the buttons for touching
            startGameButton = new MenuItem(new Rectangle(40, 240, 250, 55));
            howToButton = new MenuItem(new Rectangle(40, 325, 275, 55));
            myScoresButton = new MenuItem(new Rectangle(40, 416, 235, 55));
            highScoresButton = new MenuItem(new Rectangle(488, 240, 270, 55));
            contactInfoButton = new MenuItem(new Rectangle(465, 325, 305, 55));
            soundButton = new MenuItem(new Rectangle(488, 416, 270, 55));

            yesScore = new MenuItem(new Rectangle(257, 282, 121, 51));
            noScore = new MenuItem(new Rectangle(439, 282, 121, 51));
            yesExit = new MenuItem(new Rectangle(257, 307, 121, 51));
            noExit = new MenuItem(new Rectangle(439, 307, 121, 51));
        }