コード例 #1
0
    void onInterstitialEvent(string eventName, string msg)
    {
        LoadingBlockCtrl.Hide();
        Debug.Log("handler onAdmobEvent---" + eventName + "   " + msg);
        switch (eventName)
        {
        case "onAdFailedToLoad":
            if (showInterstitialLoading)
            {
                if (reloadTimes-- > 0)
                {
                    LoadingBlockCtrl.Show();
                    ad.loadInterstitial();
                }
                else
                {
                    ConfirmCtrl.Show("没有找到可以播放的广告,是否继续看广告?", () => {
                        reloadTimes = 1;
                        LoadingBlockCtrl.Show();
                        ad.loadInterstitial();
                    }, null, "要看", "不看");
                }
            }
            break;

        case "onAdLoaded":
            ad.showInterstitial();
            SendEvent("InterstitialLoaded", DbManager.Instance.HostData.Lv.ToString());
            break;
        }
    }
コード例 #2
0
    /// <summary>
    /// 支付
    /// </summary>
    public static void PayForProduct(string productId)
    {
        string ipaValue = string.Format(productId);

        PaymentManagerExample.buyItem(ipaValue);
        LoadingBlockCtrl.Show();
    }
コード例 #3
0
    public static void ShowInterstitial(bool showLoading = true)
    {
//        if (ad.isInterstitialReady())
//        {
//            ad.showInterstitial();
//        }
//        else
//        {
        showInterstitialLoading = showLoading;
        reloadTimes             = 1;
        if (showInterstitialLoading)
        {
            LoadingBlockCtrl.Show();
        }
        ad.loadInterstitial();
//        }
    }
コード例 #4
0
 public static void StartRewardedVideo(System.Action callback, bool showLoading = true)
 {
     rewardedVideoCallback    = callback;
     showRewardedVideoLoading = showLoading;
     if (ad.isRewardedVideoReady())
     {
         ad.showRewardedVideo();
     }
     else
     {
         reloadTimes = 1;
         if (showRewardedVideoLoading)
         {
             LoadingBlockCtrl.Show();
         }
         ad.loadRewardedVideo("ca-app-pub-4618478478287634/9895676018");
     }
 }
コード例 #5
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;
        }
    }