Esempio n. 1
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));
        }
Esempio n. 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);

            // TODO: use this.Content to load your game content here
            bannerAd = adManager.CreateAd("Image300_50",
                                          new Rectangle(10, 390, GraphicsDevice.Viewport.Bounds.Width, 120), RotationMode.Manual, false);
        }
Esempio n. 3
0
 public void LoadPage(int adPerLevelAmount)
 {
     if (currentPage == null)
     {
         currentPage           = Instantiate(pageBackgrounds[Random.Range(0, pageBackgrounds.Length)]);
         currentPageYTransform = -1f * currentPage.transform.position.y;
     }
     else
     {
         currentPage.transform.Translate(0.0f, currentPageYTransform, 0.0f);
     }
     for (int i = 0; i < adPerLevelAmount; i++)
     {
         adManager.CreateAd(new Vector2(Random.Range(cameraMinX, cameraMaxX),
                                        Random.Range(cameraMinY, cameraMaxY)), i);
     }
 }
Esempio n. 4
0
    // -----------------------------------------------
    // NOTE: You can set up multiple platforms at once and the API will use the correct desc data for each
    // -----------------------------------------------
    void Start()
    {
        singleton = this;

        // bind button events
        RefreshButton.Select();
        RefreshButton.onClick.AddListener(refreshClicked);
        VisibilityButton.onClick.AddListener(visibilityClicked);
        BackButton.onClick.AddListener(backClicked);

        // make sure we don't init the same Ad twice
        if (created)
        {
            if (ad != null)
            {
                ad.Visible = true;
            }
            return;
        }
        created = true;

        // Ads - NOTE: You can pass in multiple "AdDesc" objects if you want more then one ad.
        var desc = new AdDesc();

        // global settings
        desc.Testing            = true;// NOTE: To test ads on iOS, you must enable them in iTunes Connect.
        desc.Visible            = true;
        desc.EventCallback      = eventCallback;
        desc.UseClassicGUI      = false;
        desc.GUIOverrideEnabled = false;
        desc.UnityUI_SortIndex  = 1000;

        // Editor
        desc.Editor_AdAPI     = AdAPIs.EditorTestAd;
        desc.Editor_AdGravity = AdGravity.BottomCenter;
        desc.Editor_AdScale   = 1.5f;
        //desc.Editor_FixedWidthOverride = 250;
        //desc.Editor_FixedHeightOverride = 64;

        desc.Editor_MillennialMediaAdvertising_APID      = "";
        desc.Editor_MillennialMediaAdvertising_AdGravity = AdGravity.BottomCenter;
        //desc.Editor_MillennialMediaAdvertising_RefreshRate = 120,

        // WinRT settings (Windows 8.1)
        desc.WinRT_AdAPI = AdAPIs.MicrosoftAdvertising;        // NOTE: If building for WP 8.1 or Universal targets this value is used. All other WinRT values or used for Win8
        desc.WinRT_MicrosoftAdvertising_ApplicationID = "";
        desc.WinRT_MicrosoftAdvertising_UnitID        = "";
        desc.WinRT_MicrosoftAdvertising_AdGravity     = AdGravity.BottomCenter;
        desc.WinRT_MicrosoftAdvertising_AdSize        = WinRT_MicrosoftAdvertising_AdSize.Wide_728x90;
        //desc.WinRT_MicrosoftAdvertising_UseBuiltInRefresh = false;
        //desc.WinRT_MicrosoftAdvertising_RefreshRate = 120;

        desc.WinRT_AdDuplex_ApplicationKey = "";
        desc.WinRT_AdDuplex_UnitID         = "";
        desc.WinRT_AdDuplex_AdGravity      = AdGravity.BottomCenter;
        desc.WinRT_AdDuplex_AdSize         = WinRT_AdDuplex_AdSize.Wide_728x90;
        //desc.WinRT_AdDuplex_RefreshRate = 120;

        // WP8 settings (Windows Phone 8.1)
        desc.WP8_AdAPI = AdAPIs.MicrosoftAdvertising;        // NOTE: If building for WP 8.1 or Universal targets this value is NOT used (Use the WinRT value instead). All other WP8 values are still used for WP 8.0, 8.1 and Universal.
        desc.WP8_MicrosoftAdvertising_ApplicationID = "";
        desc.WP8_MicrosoftAdvertising_UnitID        = "";
        desc.WP8_MicrosoftAdvertising_AdGravity     = AdGravity.BottomCenter;
        desc.WP8_MicrosoftAdvertising_AdSize        = WP8_MicrosoftAdvertising_AdSize.Wide_480x80;
        //desc.WP8_MicrosoftAdvertising_UseBuiltInRefresh = false;
        //desc.WP8_MicrosoftAdvertising_RefreshRate = 120;

        desc.WP8_AdDuplex_ApplicationKey = "";
        desc.WP8_AdDuplex_UnitID         = "";
        desc.WP8_AdDuplex_AdGravity      = AdGravity.BottomCenter;
        //desc.WP8_AdDuplex_RefreshRate = 120;

        desc.WP8_AdMob_UnitID    = "";     // NOTE: You MUST have this even for Testing!
        desc.WP8_AdMob_AdGravity = AdGravity.BottomCenter;
        desc.WP8_AdMob_AdSize    = Reign.WP8_AdMob_AdSize.Banner;

        // BB10 settings
        desc.BB10_AdAPI = AdAPIs.MillennialMediaAdvertising;
        desc.BB10_BlackBerryAdvertising_ZoneID    = "";
        desc.BB10_BlackBerryAdvertising_AdGravity = AdGravity.BottomCenter;
        desc.BB10_BlackBerryAdvertising_AdSize    = BB10_BlackBerryAdvertising_AdSize.Wide_320x53;

        desc.BB10_MillennialMediaAdvertising_APID      = "";
        desc.BB10_MillennialMediaAdvertising_AdGravity = AdGravity.BottomCenter;
        //desc.BB10_MillennialMediaAdvertising_RefreshRate = 120;
        desc.BB10_AdScale = 1.5f;

        // iOS settings
        desc.iOS_AdAPI         = AdAPIs.iAd;
        desc.iOS_iAd_AdGravity = AdGravity.BottomCenter;

        desc.iOS_AdMob_AdGravity = AdGravity.BottomCenter;
        desc.iOS_AdMob_UnitID    = "";     // NOTE: You can use legacy (PublisherID) too, You MUST have this even for Testing!
        desc.iOS_AdMob_AdSize    = iOS_AdMob_AdSize.Banner_320x50;

        // Android settings
                #if AMAZON
        desc.Android_AdAPI = AdAPIs.Amazon;       // Choose between AdMob or Amazon
                #else
        desc.Android_AdAPI = AdAPIs.AdMob;        // Choose between AdMob or Amazon
                #endif

        desc.Android_AdMob_UnitID    = "";     // NOTE: You MUST have this even for Testing!
        desc.Android_AdMob_AdGravity = AdGravity.BottomCenter;
        desc.Android_AdMob_AdSize    = Android_AdMob_AdSize.Banner_320x50;

        desc.Android_AmazonAds_ApplicationKey = "";
        desc.Android_AmazonAds_AdSize         = Android_AmazonAds_AdSize.Wide_320x50;
        desc.Android_AmazonAds_AdGravity      = AdGravity.BottomCenter;
        //desc.Android_AmazonAds_RefreshRate = 120;

        // create ad
        ad = AdManager.CreateAd(desc, adCreatedCallback);
    }
Esempio n. 5
0
        public void CreateAd()
        {
            created = true;

            // Ads - NOTE: You can pass in multiple "AdDesc" objects if you want more then one ad.
            var desc = new AdDesc();

            // global settings
            desc.Testing             = true;// NOTE: To test ads on iOS, you must enable them in iTunes Connect.
            desc.Visible             = true;
            desc.UnityUI_AdMaxWidth  = 0.3f;
            desc.UnityUI_AdMaxHeight = 0.15f;
            desc.UseClassicGUI       = false;
            desc.GUIOverrideEnabled  = false;
            desc.UnityUI_SortIndex   = 1000;

            // Editor
            desc.Editor_AdAPI     = AdAPIs.EditorTestAd;
            desc.Editor_AdGravity = AdGravity.BottomCenter;
            desc.Editor_AdScale   = 2;

            desc.Editor_MillennialMediaAdvertising_APID      = "";
            desc.Editor_MillennialMediaAdvertising_AdGravity = AdGravity.BottomCenter;
            //desc.Editor_MillennialMediaAdvertising_RefreshRate = 120,
            // WinRT settings (Windows 8.0 & 8.1)
            desc.WinRT_AdAPI = AdAPIs.MicrosoftAdvertising;
            desc.WinRT_MicrosoftAdvertising_ApplicationID = "";
            desc.WinRT_MicrosoftAdvertising_UnitID        = "";
            desc.WinRT_MicrosoftAdvertising_AdGravity     = AdGravity.BottomCenter;
            desc.WinRT_MicrosoftAdvertising_AdSize        = WinRT_MicrosoftAdvertising_AdSize.Wide_728x90;

            // iOS settings
            desc.iOS_AdAPI         = AdAPIs.AdMob;
            desc.iOS_iAd_AdGravity = AdGravity.BottomCenter;

            desc.iOS_AdMob_AdGravity = AdGravity.BottomCenter;
            desc.iOS_AdMob_UnitID    = "";// NOTE: You can use legacy (PublisherID) too, You MUST have this even for Testing!
            desc.iOS_AdMob_AdSize    = iOS_AdMob_AdSize.Banner_320x50;

            // Android settings
#if AMAZON
            desc.Android_AdAPI = AdAPIs.Amazon; // Choose between AdMob or Amazon
#else
            desc.Android_AdAPI = AdAPIs.AdMob;  // Choose between AdMob or Amazon
#endif

            desc.Android_AdMob_UnitID    = "";// NOTE: You MUST have this even for Testing!
            desc.Android_AdMob_AdGravity = AdGravity.BottomCenter;
            desc.Android_AdMob_AdSize    = Android_AdMob_AdSize.Banner_320x50;

            desc.Android_AmazonAds_ApplicationKey = "";
            desc.Android_AmazonAds_AdSize         = Android_AmazonAds_AdSize.Wide_320x50;
            desc.Android_AmazonAds_AdGravity      = AdGravity.BottomCenter;
            //desc.Android_AmazonAds_RefreshRate = 120;

            // create ad
            ad = AdManager.CreateAd(desc, null);
            if (ad != null)
            {
                ad.Visible = true;
            }
        }