示例#1
0
    public void LoadNativeIntersititialAd()
    {
#if UNITY_IOS
        if (this.intersititialAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
#else
        if (this.mIntersititialAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
#endif
        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                     .SetCodeId("900546829")
#else
                     .SetCodeId("934332561")//InteractionAd插入式
#endif
                     .SetSupportDeepLink(true)
                     .SetImageAcceptedSize(600, 257)
                     .SetNativeAdType(AdSlotType.InteractionAd)
                     .SetAdCount(1)
                     .Build();
        this.AdNative.LoadNativeAd(adSlot, new NativeAdListener(this));
    }
示例#2
0
    /// <summary>
    /// Loads the full screen video ad.
    /// </summary>
    public void LoadFullScreenVideoAd(int direction)
    {
        var rit = "";
#if UNITY_IOS
        if (this.fullScreenVideoAd != null)
        {
            this.fullScreenVideoAd.Dispose();
            this.fullScreenVideoAd = null;
        }
        if (direction == 1) {
            rit = "900546154";
        } else {
            rit = "900546299";
        }
#else
        if (direction == 1) {
            rit = "945072452";
        } else {
            rit = "901121375";
        }
#endif
        var adSlot = new AdSlot.Builder()
            .SetCodeId(rit)
            .SetImageAcceptedSize(1080, 1920)
            .SetOrientation(AdOrientation.Horizontal)
            .Build();
        Debug.Log("LoadFullScreenVideoAd this.name:" + this.name);
        this.AdNative.LoadFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this));

    }
示例#3
0
    public void LoadNativeNannerAd()
    {
#if UNITY_IOS
        if (this.bannerAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
#else
        if (this.mBannerAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
#endif

        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                     .SetCodeId("900546687")
#else
                     .SetCodeId("934332956")//Banner
#endif
                     .SetSupportDeepLink(true)
                     .SetImageAcceptedSize(600, 257)
                     .SetNativeAdType(AdSlotType.Banner)
                     .SetAdCount(1)
                     .Build();
        this.AdNative.LoadNativeAd(adSlot, new NativeAdListener(this));
    }
示例#4
0
    /// <summary>
    /// Load the reward Ad.
    /// </summary>
    public void LoadRewardAd()
    {
        if (this.rewardAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }

        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                     .SetCodeId("900546826")
#else
                     .SetCodeId("934332012")//奖励广告
#endif
                     .SetSupportDeepLink(true)
                     .SetImageAcceptedSize(1080, 1920)
                     .SetRewardName("金币")                      // 奖励的名称
                     .SetRewardAmount(3)                       // 奖励的数量
                     .SetUserID("user123")                     // 用户id,必传参数
                     .SetMediaExtra("media_extra")             // 附加参数,可选
                     .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向
                     .Build();

        this.AdNative.LoadRewardVideoAd(
            adSlot, new RewardVideoAdListener(this));
    }
示例#5
0
    /// <summary>
    /// load native ad
    /// </summary>
    public void LoadNativeAd()
    {
#if UNITY_IOS
            if (this.nativeFeedAd != null)
            {
                Debug.LogError("广告已经加载");
                this.information.text = "广告已经加载";
                return;
            }
#else
        if (this.mNativeAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
#endif

        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                .SetCodeId("900546910")
                .SetNativeAdType(AdSlotType.Feed)
#else
                .SetCodeId("945092256")
#endif
            .SetImageAcceptedSize(600, 400)
            .SetAdCount(1)
            .Build();
#if UNITY_IOS
            this.AdNative.LoadNativeAd(adSlot, new NativeAdListener(this));
#else
            this.AdNative.LoadFeedAd(adSlot, new FeedAdListener(this));
#endif

    }
示例#6
0
    /// <summary>
    /// Load the reward Ad.
    /// </summary>
    public void LoadExpressRewardAd(int direction)
    {
        var rit = "";
#if UNITY_IOS
        if (this.expressRewardAd != null)
        {
            this.expressRewardAd.Dispose();
            this.expressRewardAd = null;
        }
        // @"945113162";//竖屏
        // @"945113163";//横屏
        if (direction == 1) {
            rit = "945113163";
        } else {
            rit = "945113162";
        }
#else
        if (this.rewardAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
        if (direction == 1) {
            rit = "945113161";
        } else {
            rit = "945113160";
        }
#endif

        var adSlot = new AdSlot.Builder()
            .SetCodeId(rit)
            .SetImageAcceptedSize(1080, 1920)
            .SetExpressViewAcceptedSize(100,100)//模板广告需要填写,大于0的值即可
            .IsExpressAd(true)
            //.SetRewardName("金币") // rewardname ,the data filled in by the platform shall prevail
            //.SetRewardAmount(3) // rewardamount ,the data filled in by the platform shall prevail
            .SetUserID("user123") // 用户id,必传参数
            .SetMediaExtra("media_extra") // 附加参数,可选
            .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向
            .Build();
#if UNITY_IOS
        this.AdNative.LoadExpressRewardAd(
            adSlot, new ExpressRewardVideoAdListener(this));
#else
        this.AdNative.LoadRewardVideoAd(
            adSlot, new RewardVideoAdListener(this));
#endif
    }
示例#7
0
    /// <summary>
    /// Loads the full screen video ad.
    /// </summary>
    public void LoadFullScreenVideoAd()
    {
        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                     .SetCodeId("900546299")
#else
                     .SetCodeId("934332469")
#endif
                     .SetSupportDeepLink(true)
                     .SetImageAcceptedSize(1080, 1920)
                     .SetOrientation(AdOrientation.Horizontal)
                     .Build();

        this.AdNative.LoadFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this));
    }
示例#8
0
        public void Reload(int id)
        {
            var tp     = AdHelper.tp.bannerIds[id];
            var adSlot = new AdSlot.Builder()
                         .SetCodeId(tp)
                         ////期望模板广告view的size,单位dp,//高度按照实际rit对应宽高传入
                         //.SetExpressViewAcceptedSize(size.x*0.5f * Screen.width, size.y * Screen.height)
                         .SetExpressViewAcceptedSize(widthDp, hightDp)
                         .SetSupportDeepLink(true)
                         .SetImageAcceptedSize(Screen.width, Screen.height)
                         .SetAdCount(1)
                         .SetOrientation(AdHelper.GetCurrentOrientation())
                         .Build();

            AdHelper.AdNative.LoadExpressBannerAd(adSlot, listener);
        }
示例#9
0
        public void Reload(int id)
        {
            var adSlot = new AdSlot.Builder()
                         .SetCodeId(AdHelper.tp.intersititialIds[id])
                         .SetSupportDeepLink(true)
                         .SetImageAcceptedSize(1080, 1920)
                         .SetOrientation(AdHelper.GetCurrentOrientation())
                         .Build();

            if (this.fullScreenVideoAd != null)
            {
                return;
            }

            AdHelper.AdNative.LoadFullScreenVideoAd(adSlot, listener);
        }
示例#10
0
    public void LoadExpressFeedAd()
    {
        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                             .SetCodeId("945579837")
#else
                             .SetCodeId("945294191")
                             ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
                             .SetExpressViewAcceptedSize(350, 0)
#endif
                             .SetImageAcceptedSize(1080, 1920)
                             .SetOrientation(AdOrientation.Horizontal)
                             .SetAdCount(1) //请求广告数量为1到3条
                             .Build();
        this.AdNative.LoadNativeExpressAd(adSlot, new ExpressAdListener(this,0));

    }
示例#11
0
    public void LoadExpressInterstitialAd()
    {
        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
                             .SetCodeId("900546270")
                             .SetExpressViewAcceptedSize(200, 300)
#else
                             .SetCodeId("945113151")
                             .SetExpressViewAcceptedSize(300, 0)
                               ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
#endif
                             .SetAdCount(1)
                             .SetImageAcceptedSize(1080, 1920)
                             .Build();
        this.AdNative.LoadExpressInterstitialAd(adSlot, new ExpressAdListener(this,2));

    }
示例#12
0
    /// <summary>
    /// Load Banner Ad.
    /// </summary>
    public void LoadBannerAd(int type)
    {
        ////remove old banner
#if UNITY_IOS
        if (this.iExpressBannerAd != null)
        {
            this.iExpressBannerAd.Dispose();
            this.iExpressBannerAd = null;
        }
#else

#endif
        float expressWidth = 320;
        float expressHeight = 50;
#if UNITY_IOS
        string ritID = "900546833";
        if (type == 1)
        {
            ritID = "945509778";
            expressWidth = 300;
            expressHeight = 250;
        }
#else
        string ritID = "945467907";
        if (type == 1)
        {
            ritID = "945509744";
            expressWidth = 300;
            expressHeight = 250;
        }
#endif
        var adSlot = new AdSlot.Builder()
                              .SetCodeId(ritID)
                             ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应//Only Android ,you must set height for iOS
                              .SetExpressViewAcceptedSize(expressWidth, expressHeight)
                              .SetImageAcceptedSize(1080, 1920)
                             .SetAdCount(1)
                             .SetOrientation(AdOrientation.Horizontal)
                             .Build();
        this.AdNative.LoadExpressBannerAd(adSlot, new ExpressAdListener(this, 1));

    }
示例#13
0
    /// <summary>
    /// Load the reward Ad.
    /// </summary>
    public void LoadRewardAd(int direction)
    {
        var rit = "";
#if UNITY_IOS
        if (this.rewardAd != null)
        {
            this.rewardAd.Dispose();
            this.rewardAd = null;
        }
        if (direction == 1) {
            rit = "900546319";
        } else {
            rit = "900546826";
        }
#else
        if (this.rewardAd != null)
        {
            Debug.LogError("广告已经加载");
            this.information.text = "广告已经加载";
            return;
        }
        if (direction == 1) {
            rit = "901121430";
        } else {
            rit = "901121365";
        }
#endif

        var adSlot = new AdSlot.Builder()
            .SetCodeId(rit)
            .SetImageAcceptedSize(1080, 1920)
            //.SetRewardName("金币") // rewardname ,the data filled in by the platform shall prevail
            //.SetRewardAmount(3) // rewardamount ,the data filled in by the platform shall prevail
            .SetUserID("user123") // 用户id,必传参数
            .SetMediaExtra("media_extra") // 附加参数,可选
            .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向
            .Build();

        this.AdNative.LoadRewardVideoAd(
            adSlot, new RewardVideoAdListener(this));
    }
示例#14
0
    /// <summary>
    /// Loads the full screen video ad.
    /// </summary>
    public void LoadExpressFullScreenVideoAd(int direction)
    {
        var rit = "";
#if UNITY_IOS
        if (this.expressFullScreenVideoAd != null)
        {
            this.expressFullScreenVideoAd.Dispose();
            this.expressFullScreenVideoAd = null;
        }
        // 945113164 竖屏
        // 945113165 横屏
        if (direction == 1) {
            rit = "945113165";
        } else {
            rit = "945113164";
        }
#else
        if (direction == 1) {
            rit = "945113167";
        } else {
            rit = "945113166";
        }

#endif
        var adSlot = new AdSlot.Builder()
            .SetCodeId(rit)
            .SetExpressViewAcceptedSize(100, 100)//模板广告需要填写,大于0的值即可
            .IsExpressAd(true)
            .SetImageAcceptedSize(1080, 1920)
            .SetOrientation(AdOrientation.Horizontal)
            .Build();
#if UNITY_IOS
        this.AdNative.LoadExpressFullScreenVideoAd(adSlot, new ExpressFullScreenVideoAdListener(this));
#else
        this.AdNative.LoadFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this));
#endif
    }