예제 #1
0
    public void showRewardAds(System.Action <int> ation)
    {
        admobAction = ation;
        if (ad.isRewardedVideoReady())
        {
            GameMgr.inst().adsPlaying = true;
            admobRewardFinish = false;
            ad.showRewardedVideo();
        }
        else
        {
            admobAction(0);
        }

        //	admobAction(1);
    }
예제 #2
0
    public static void DoShowAd_Rewarded()
    {
        if (_pAdmob.isRewardedVideoReady() == false)
        {
            DoRequestAdMob_RewardedVideo(); Debug.LogWarning("보상형 광고 재생 실패"); return;
        }

        _pAdmob.showRewardedVideo();
    }
예제 #3
0
 public void ShowVideoAd()
 {
     if (_ad.isRewardedVideoReady())
     {
         _ad.showRewardedVideo();
     }
     else
     {
         _ad.loadRewardedVideo("ca-app-pub-3940256099942544/1712485313");
     }
 }
예제 #4
0
 public void ShowAdsVideo()
 {
     if (Ad.isRewardedVideoReady())
     {
         Ad.showRewardedVideo();
     }
     else
     {
         Ad.loadRewardedVideo(IdVideo);
     }
 }
 public void ShowRewardedVideo()
 {
     if (ad.isRewardedVideoReady())
     {
         ad.showRewardedVideo();
     }
     else
     {
         ad.loadRewardedVideo("ca-app-pub-2706666117164991/6051402869");
     }
 }
 public void ShowRewardedVideo()
 {
     Debug.Log("touch video button -------------");
     if (ad.isRewardedVideoReady())
     {
         ad.showRewardedVideo();
     }
     else
     {
         ad.loadRewardedVideo(videoID);
     }
 }
    void OnGUI()
    {
        if (GUI.Button(new Rect(120, 0, 100, 60), "showInterstitial"))
        {
            Debug.Log("touch inst button -------------");
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial(interstitialID);
            }
        }
        if (GUI.Button(new Rect(240, 0, 100, 60), "showRewardVideo"))
        {
            Debug.Log("touch video button -------------");
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo(videoID);
            }
        }
        if (GUI.Button(new Rect(0, 100, 100, 60), "showbanner"))
        {
            Admob.Instance().showBannerRelative(bannerID, AdSize.SMART_BANNER, AdPosition.BOTTOM_CENTER);
        }
        if (GUI.Button(new Rect(120, 100, 100, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(bannerID, AdSize.BANNER, 20, 220, "mybanner");
        }
        if (GUI.Button(new Rect(240, 100, 100, 60), "removebanner"))
        {
            Admob.Instance().removeBanner();
            Admob.Instance().removeBanner("mybanner");
        }

        if (GUI.Button(new Rect(0, 200, 100, 60), "showNative"))
        {
            Admob.Instance().showNativeBannerRelative(nativeBannerID, new AdSize(320, 280), AdPosition.BOTTOM_CENTER);
        }
        if (GUI.Button(new Rect(120, 200, 100, 60), "showNativeABS"))
        {
            Admob.Instance().showNativeBannerAbsolute(nativeBannerID, new AdSize(-1, 132), 0, 300);
        }
        if (GUI.Button(new Rect(240, 200, 100, 60), "removeNative"))
        {
            Admob.Instance().removeNativeBanner();
        }
    }
예제 #8
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(120, 0, 100, 60), "showInterstitial"))
        {
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(240, 0, 100, 60), "showRewardVideo"))
        {
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                //ad.loadRewardedVideo("ca-app-pub-3120877784109998/4714341465");
                ad.loadRewardedVideo("ca-app-pub-4622924889224894/8984406965");
            }
        }
        if (GUI.Button(new Rect(0, 100, 100, 60), "showbanner"))
        {
            Admob.Instance().showBannerRelative(AdSize.SmartBanner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(120, 100, 100, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.Banner, 0, 300);
        }
        if (GUI.Button(new Rect(240, 100, 100, 60), "removebanner"))
        {
            Admob.Instance().removeBanner();
        }
        string nativeBannerID = "ca-app-pub-6908989844804937/5541215009";//

        // string nativeBannerID = "ca-app-pub-3940256099942544/2562852117";//google
        if (GUI.Button(new Rect(0, 200, 100, 60), "showNative"))
        {
            Admob.Instance().showNativeBannerRelative(new AdSize(320, 120), AdPosition.BOTTOM_CENTER, 0, nativeBannerID);
        }
        if (GUI.Button(new Rect(120, 200, 100, 60), "showNativeABS"))
        {
            Admob.Instance().showNativeBannerAbsolute(new AdSize(320, 120), 0, 300, nativeBannerID);
        }
        if (GUI.Button(new Rect(240, 200, 100, 60), "removeNative"))
        {
            Admob.Instance().removeNativeBanner();
        }
    }
예제 #9
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(120, 0, 200, 80), "showInterstitial显示间隙"))
        {
            Debug.Log("touch inst button -------------");
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(440, 0, 200, 80), "showRewardVideo显示奖励视频"))
        {
            Debug.Log("touch video button -------------");
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo(videoID);
            }
        }
        if (GUI.Button(new Rect(0, 100, 200, 60), "showbanner横幅"))
        {
            Admob.Instance().showBannerRelative(AdSize.SmartBanner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(220, 100, 200, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.Banner, 20, 300);
        }
        if (GUI.Button(new Rect(440, 100, 200, 60), "removebanner删除横幅"))
        {
            Admob.Instance().removeBanner();
        }

        if (GUI.Button(new Rect(0, 200, 200, 60), "showNative(本地人)"))
        {
            Admob.Instance().showNativeBannerRelative(new AdSize(320, 100), AdPosition.BOTTOM_CENTER, 0, nativeBannerID);
        }
        if (GUI.Button(new Rect(220, 200, 200, 60), "showNativeABS"))
        {
            Admob.Instance().showNativeBannerAbsolute(new AdSize(-1, 132), 20, 300, nativeBannerID);
        }
        if (GUI.Button(new Rect(440, 200, 200, 60), "removeNative"))
        {
            Admob.Instance().removeNativeBanner();
        }
    }
예제 #10
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(120, 0, 100, 60), "showInterstitial"))
        {
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(240, 0, 100, 60), "showRewardVideo"))
        {
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo("ca-app-pub-3940256099942544/xxxxxxxxxxxx");
            }
        }
        if (GUI.Button(new Rect(0, 100, 100, 60), "showbanner"))
        {
            Admob.Instance().showBannerRelative(AdSize.SmartBanner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(120, 100, 100, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.Banner, 0, 300);
        }
        if (GUI.Button(new Rect(240, 100, 100, 60), "removebanner"))
        {
            Admob.Instance().removeBanner();
        }

        string nativeBannerID = "ca-app-pub-3940256099942544/2562852117";//google

        if (GUI.Button(new Rect(0, 200, 100, 60), "showNative"))
        {
            Admob.Instance().showNativeBannerRelative(new AdSize(320, 120), AdPosition.BOTTOM_CENTER, 0, nativeBannerID);
        }
        if (GUI.Button(new Rect(120, 200, 100, 60), "showNativeABS"))
        {
            Admob.Instance().showNativeBannerAbsolute(new AdSize(320, 120), 0, 300, nativeBannerID);
        }
        if (GUI.Button(new Rect(240, 200, 100, 60), "removeNative"))
        {
            Admob.Instance().removeNativeBanner();
        }
    }
예제 #11
0
    public void ShowRewardVideo(bool wait = false)
    {
        if (UTIL.appPurchased == 1)
        {
            return;
        }

        Debug.Log("touch video button -------------");
        if (ad.isRewardedVideoReady())
        {
            /*show ad randomly when come back to main menu*/
            int rand = Random.Range(0, 20);
            if (!wait || rand > 16)
            {
                ad.showRewardedVideo();
            }
        }
        else
        {
            ad.loadRewardedVideo(videoID);
        }
    }
예제 #12
0
 /// <summary>
 /// Shows rewarded video
 /// </summary>
 public void ShowRewardedVideo()
 {
     Debug.Log("pressed video button -------------");
     if (ad.isRewardedVideoReady())
     {
         ad.showRewardedVideo();
     }
     else
     {
         //you can show text on ui with message like "video is not available"
         LoadRewardedVideo();
     }
 }
예제 #13
0
    void onRewardedVideoEvent(string eventName, string msg)
    {
        LoadingBlockCtrl.Hide();
        Debug.Log("handler onRewardedVideoEvent---" + eventName + "  rewarded: " + msg);
        switch (eventName)
        {
        case "onAdFailedToLoad":
            if (showRewardedVideoLoading)
            {
                if (reloadTimes-- > 0)
                {
                    LoadingBlockCtrl.Show();
                    ad.loadRewardedVideo("ca-app-pub-4618478478287634/9895676018");
                }
                else
                {
                    ConfirmCtrl.Show("没有找到可以播放的广告,是否继续看广告?\n(Wifi不行可以切换4G试试)\n(也可以尝试断开重连下Wifi)", () => {
                        reloadTimes = 1;
                        LoadingBlockCtrl.Show();
                        ad.loadRewardedVideo("ca-app-pub-4618478478287634/9895676018");
                    }, null, "要看", "不看");
                }
            }
            break;

        case "onAdLoaded":
            ad.showRewardedVideo();
            SendEvent("RewardedVideoLoaded", DbManager.Instance.HostData.Lv.ToString());
            break;

        case "onRewarded":
            if (rewardedVideoCallback != null)
            {
                rewardedVideoCallback();
                SendEvent("EndRewardedVideo", DbManager.Instance.HostData.Lv.ToString());
            }
            break;
        }
    }
예제 #14
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(60, 0, 200, 120), "showInterstitial"))
        {
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(300, 0, 200, 120), "showRewardVideo"))
        {
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo("ca-app-pub-3940256099942544/1712485313");
            }
        }
        if (GUI.Button(new Rect(60, 150, 200, 120), "showbanner"))
        {
            Admob.Instance().showBannerRelative(AdSize.SmartBanner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(300, 150, 200, 120), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.Banner, 20, 300);
        }
        if (GUI.Button(new Rect(60, 300, 200, 120), "removebanner"))
        {
            Admob.Instance().removeBanner();
        }
        string nativeBannerID = "ca-app-pub-3940256099942544/2934735716";

        if (GUI.Button(new Rect(300, 300, 200, 120), "showNative"))
        {
            Admob.Instance().showNativeBannerRelative(new AdSize(320, 120), AdPosition.BOTTOM_CENTER, 0, nativeBannerID);
        }
        if (GUI.Button(new Rect(60, 450, 200, 120), "showNativeABS"))
        {
            Admob.Instance().showNativeBannerAbsolute(new AdSize(320, 120), 20, 300, nativeBannerID);
        }
        if (GUI.Button(new Rect(300, 450, 200, 120), "removeNative"))
        {
            Admob.Instance().removeNativeBanner();
        }
    }
예제 #15
0
 public void ShowRewardedAd()
 {
     //PleaseWait.SetActive(true);
     Debug.Log("touch video button -------------");
     if (ad.isRewardedVideoReady())
     {
         //RewardedButton.SetActive(false);
         ad.showRewardedVideo();
         rewardBasedVideo.OnAdRewarded += HandleOnAdRewarded;
     }
     else
     {
         ad.loadRewardedVideo(videoID);
     }
 }
    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 100, 60), "initadmob"))
        {
            Admob ad = Admob.Instance();

            ad.initAdmob("YOUR_VALUE_HERE", "YOUR_VALUE_HERE");

            //   ad.setTesting(true);
        }
        if (GUI.Button(new Rect(120, 0, 100, 60), "showInterstitial"))
        {
            Admob ad = Admob.Instance();
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(240, 0, 100, 60), "showRewardVideo"))
        {
            Admob ad = Admob.Instance();
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo("YOUR_VALUE_HERE");
            }
        }
        if (GUI.Button(new Rect(240, 100, 100, 60), "showbanner"))
        {
            Admob.Instance().showBannerRelative(AdSize.Banner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(240, 200, 100, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.SmartBanner, 0, 30);
        }
        if (GUI.Button(new Rect(240, 300, 100, 60), "hidebanner"))
        {
            Admob.Instance().removeBanner();
        }
    }
예제 #17
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 100, 60), "initadmob"))
        {
            Admob ad = Admob.Instance();

            ad.initAdmob("ca-app-pub-3940256099942544/2934735716", "ca-app-pub-3940256099942544/4411468910");

            //   ad.setTesting(true);
        }
        if (GUI.Button(new Rect(120, 0, 100, 60), "showInterstitial"))
        {
            Admob ad = Admob.Instance();
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
        }
        if (GUI.Button(new Rect(240, 0, 100, 60), "showRewardVideo"))
        {
            Admob ad = Admob.Instance();
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo("ca-app-pub-3940256099942544/xxxxxxxxxxx");
            }
        }
        if (GUI.Button(new Rect(240, 100, 100, 60), "showbanner"))
        {
            Admob.Instance().showBannerRelative(AdSize.Banner, AdPosition.BOTTOM_CENTER, 0);
        }
        if (GUI.Button(new Rect(240, 200, 100, 60), "showbannerABS"))
        {
            Admob.Instance().showBannerAbsolute(AdSize.SmartBanner, 0, 30);
        }
        if (GUI.Button(new Rect(240, 300, 100, 60), "hidebanner"))
        {
            Admob.Instance().removeBanner();
        }
    }
예제 #18
0
    void Start()
    {
        Admob.Instance().bannerEventHandler        += onBannerEvent;
        Admob.Instance().interstitialEventHandler  += onInterstitialEvent;
        Admob.Instance().rewardedVideoEventHandler += onRewardedVideoEvent;

        Admob ad = Admob.Instance();

        ad.initAdmob("app id", "app id");         // See it in your admob account for particular app. Get these ids from Admob account.

        int choose = Random.Range(0, 3);

        // Randomly selection of what to display.......
        switch (choose)
        {
        case 0:                         // Full Screen Ads...
            ad = Admob.Instance();
            if (ad.isInterstitialReady())
            {
                ad.showInterstitial();
            }
            else
            {
                ad.loadInterstitial();
            }
            break;

        case 1:                         // Rewarded Videos
            ad = Admob.Instance();
            if (ad.isRewardedVideoReady())
            {
                ad.showRewardedVideo();
            }
            else
            {
                ad.loadRewardedVideo("ca-app-pub-3940256099942544/xxxxxxxxxxx");                                 // Provide your Id here...
            }
            break;

        case 2:                         //  Banner Ads
            Admob.Instance().showBannerRelative(AdSize.Banner, AdPosition.BOTTOM_CENTER, 0);
            break;
        }
    }
예제 #19
0
 private void OnRewardVideoEvent(string eventName, string msg)
 {
     Debug.Log("RewardedAd. Event: " + eventName);
     if (eventName == "onAdLoaded")
     {
         _admob.showRewardedVideo();
         if (_lastRewardedVideoShowCallback != null)
         {
             UnityMainThreadDispatcher.Instance.Enqueue(_lastRewardedVideoShowCallback);
         }
     }
     else if (eventName == "onAdOpened")
     {
     }
     else if (eventName == "onAdClosed")
     {
         if (_lastRewardedVideoEndCallback != null)
         {
             UnityMainThreadDispatcher.Instance.Enqueue(_lastRewardedVideoEndCallback, false);
             _lastRewardedVideoEndCallback = null;
         }
         Shown = false;
     }
     else if (eventName == "onRewarded")
     {
         if (_lastRewardedVideoEndCallback != null)
         {
             UnityMainThreadDispatcher.Instance.Enqueue(_lastRewardedVideoEndCallback, true);
             _lastRewardedVideoEndCallback = null;
         }
     }
     else
     {
         if (_lastRewardedVideoEndCallback != null)
         {
             UnityMainThreadDispatcher.Instance.Enqueue(_lastRewardedVideoEndCallback, false);
             _lastRewardedVideoEndCallback = null;
         }
         Shown = false;
     }
 }