Exemple #1
0
 void Start()
 {
     print("Started");
     #error Replace with your own ad unit ID and then remove this error.
     GoogleMobileAdsPlugin.CreateBannerView("INSERT_YOUR_AD_UNIT_ID_HERE",
                                            GoogleMobileAdsPlugin.AdSize.SmartBanner,
                                            true);
     print("Created Banner View");
     GoogleMobileAdsPlugin.RequestBannerAd(true);
     print("Requested Banner Ad");
 }
Exemple #2
0
    void Start()
    {
        // Show a warning when running in the editor. Our Ad libraries require
        // running on a physical device.
        if (Application.isEditor)
        {
            Debug.LogWarning("Ads cannot be displayed in the editor, you must run on an Android or iOS device");
            AdsEnabled = false;
        }

        // Do nothing if we don't want ads.
        if (AdsEnabled == false || UserData.adRemoved)
        {
            this.enabled = false;
            return;
        }

        string extras = "{\"color_bg\":\"AAAAFF\", \"color_bg_top\":\"FFFFFF\"}";

        // Determine which ad space identifier to use, based on the platform.
        string adUnitID;

#if UNITY_IOS
        adUnitID = Settings.instance.admobIOS;
#elif UNITY_ANDROID
        adUnitID = Settings.instance.admobAndroid;
#else
        adUnitID = null;
#endif

        if (string.IsNullOrEmpty(adUnitID))
        {
            Debug.LogError("You must define a valid Ad Unity ID in order to use the GoogleMobileAds plugin!");
        }
        else
        {
            GoogleMobileAdsPlugin.CreateBannerView(adUnitID, GoogleMobileAdsPlugin.AdSize.Banner, BannerAtTop);
            Debug.Log("Created Banner View");

            GoogleMobileAdsPlugin.RequestBannerAd(TestAds, extras);
            Debug.Log("Requested Banner Ad");
        }
    }
Exemple #3
0
 protected void CompletePurchase(MarketLot lot)
 {
     Debug.Log("Purchase completed:" + lot.Id);
     if (lot == MarketLot.UndoPack1)
     {
         UndoBtn.undoCnt += 5;
     }
     else if (lot == MarketLot.UndoPack2)
     {
         UndoBtn.undoCnt += 15;
     }
     else if (lot == MarketLot.UndoPack3)
     {
         UndoBtn.undoCnt += 50;
     }
     else if (lot == MarketLot.RemoveAds)
     {
         UserData.adRemoved = true;
         GoogleMobileAdsPlugin.HideBannerView();
     }
 }
Exemple #4
0
 void Start()
 {
     GoogleMobileAdsPlugin.CreateInterstitial(PublisherId);
     GoogleMobileAdsPlugin.RequestInterstitial(true);
 }
Exemple #5
0
 public void HandleReceivedAd()
 {
     print("HandleReceivedAd event received");
     GoogleMobileAdsPlugin.ShowInterstitial();
 }
 void Start()
 {
     GoogleMobileAdsPlugin.CreateBannerView(PublisherId, GoogleMobileAdsPlugin.AdSize.SmartBanner, true);
     GoogleMobileAdsPlugin.RequestBannerAd(true);
 }