Пример #1
0
        // Creates FloatAd instance.
        public FloatAd(string adAppId, string adUnitId, GameObject gameObject, AdOptions adOptions)
        {
            client = AtmosplayAdsClientFactory.BuildFloatAdClient(adAppId, adUnitId, gameObject);

            if (adOptions == null)
            {
                adOptions = new AdOptionsBuilder().build();
            }
            client.SetChannelId(adOptions.mChannelId);
            client.SetAutoloadNext(adOptions.isAutoLoad);
            client.LoadAd(adUnitId);

            client.OnAdLoaded += (sender, args) =>
            {
                if (OnAdLoaded != null)
                {
                    OnAdLoaded(this, args);
                }
            };

            client.OnAdFailedToLoad += (sender, args) =>
            {
                if (OnAdFailedToLoad != null)
                {
                    OnAdFailedToLoad(this, args);
                }
            };

            client.OnAdStarted += (sender, args) =>
            {
                if (OnAdStarted != null)
                {
                    OnAdStarted(this, args);
                }
            };

            client.OnAdClicked += (sender, args) =>
            {
                if (OnAdClicked != null)
                {
                    OnAdClicked(this, args);
                }
            };

            client.OnAdRewarded += (sender, args) =>
            {
                if (OnAdRewarded != null)
                {
                    OnAdRewarded(this, args);
                }
            };

            client.OnAdClosed += (sender, args) =>
            {
                if (OnAdClosed != null)
                {
                    OnAdClosed(this, args);
                }
            };
        }
Пример #2
0
    void Start()
    {
        AdOptions adOptions = new AdOptionsBuilder()
                              .SetChannelId(GlobleSettings.GetChannelId)
                              .SetAutoLoadNext(GlobleSettings.IsAutoload)
                              .build();

        rewardVideo                   = new RewardVideoAd(GlobleSettings.GetAppID, GlobleSettings.GetRewardVideoUnitID, adOptions);
        rewardVideo.OnAdLoaded       += HandleRewardVideoLoaded;
        rewardVideo.OnAdFailedToLoad += HandleRewardVideoFailedToLoad;
        rewardVideo.OnAdStarted      += HandleRewardVideoStart;
        rewardVideo.OnAdClicked      += HandleRewardVideoClicked;
        rewardVideo.OnAdRewarded     += HandleRewardVideoRewarded;
        rewardVideo.OnAdClosed       += HandleRewardVideoClosed;

        interstitial                   = new InterstitialAd(GlobleSettings.GetAppID, GlobleSettings.GetInterstitialUnitID, adOptions);
        interstitial.OnAdLoaded       += HandleInterstitialLoaded;
        interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.OnAdStarted      += HandleInterstitialStart;
        interstitial.OnAdClicked      += HandleInterstitialClicked;
        interstitial.OnAdClosed       += HandleInterstitialClosed;

        BannerViewOptions bannerOptions = new BannerViewOptionsBuilder()
                                          .setAdPosition(AdPosition.BOTTOM)
                                          .setChannelID(GlobleSettings.GetChannelId)
                                          .setBannerSize(BannerAdSize.BANNER_AD_SIZE_320x50)
                                          .Build();

        bannerView                   = new BannerView(GlobleSettings.GetAppID, GlobleSettings.GetBannerUnitID, bannerOptions);
        bannerView.OnAdLoaded       += HandleBannerAdLoaded;
        bannerView.OnAdFailedToLoad += HandleBannerAdFailedToLoad;
        bannerView.OnAdClicked      += HandleBannerClicked;
    }
Пример #3
0
        // Creates RewardVideoAd instance.
        public RewardVideoAd(string adAppId, string adUnitId, AdOptions adOptions)
        {
            client = ZPLAYAdsClientFactory.BuildRewardVideoClient(adAppId, adUnitId);

            if (adOptions == null)
            {
                adOptions = new AdOptionsBuilder().build();
            }
            client.SetChannelId(adOptions.mChannelId);
            client.SetAutoloadNext(adOptions.isAutoLoad);

            client.OnAdLoaded += (sender, args) =>
            {
                if (OnAdLoaded != null)
                {
                    OnAdLoaded(this, args);
                }
            };

            client.OnAdFailedToLoad += (sender, args) =>
            {
                if (OnAdFailedToLoad != null)
                {
                    OnAdFailedToLoad(this, args);
                }
            };

            client.OnAdStarted += (sender, args) =>
            {
                if (OnAdStarted != null)
                {
                    OnAdStarted(this, args);
                }
            };

            client.OnAdClicked += (sender, args) =>
            {
                if (OnAdClicked != null)
                {
                    OnAdClicked(this, args);
                }
            };

            client.OnAdRewarded += (sender, args) =>
            {
                if (OnAdRewarded != null)
                {
                    OnAdRewarded(this, args);
                }
            };

            client.OnAdClosed += (sender, args) =>
            {
                if (OnAdClosed != null)
                {
                    OnAdClosed(this, args);
                }
            };
        }
Пример #4
0
    void Start()
    {
        AdOptions adOptions = new AdOptionsBuilder()
                              .SetChannelId(GlobleSettings.GetChannelId)
                              .build();

        windowAd                   = new WindowAd(GlobleSettings.GetAppID, GlobleSettings.GetWindowAdUnitID, gameObject, adOptions);
        windowAd.OnAdLoaded       += HandleWindowAdLoaded;
        windowAd.OnAdFailedToLoad += HandleWindowAdFailedToLoad;
        windowAd.OnAdStarted      += HandleWindowAdStart;
        windowAd.OnAdClicked      += HandleWindowAdClicked;
        windowAd.OnAdFinished     += HandleWindowAdFinished;
        windowAd.OnAdClosed       += HandleWindowAdClosed;
        windowAd.OnAdFailToShow   += HandleWindowAdFailToShow;
    }
    public void init()
    {
        AdOptions adOptions = new AdOptionsBuilder()
                              .SetChannelId(GlobleSettings.GetChannelId)
                              .SetAutoLoadNext(GlobleSettings.IsAutoload)
                              .build();

        floatAd                   = new FloatAd(GlobleSettings.GetAppID, GlobleSettings.GetFloatAdUnitID, gameObject, adOptions);
        floatAd.OnAdLoaded       += HandleFloatAdLoaded;
        floatAd.OnAdFailedToLoad += HandleFloatAdFailedToLoad;
        floatAd.OnAdStarted      += HandleFloatAdStart;
        floatAd.OnAdClicked      += HandleFloatAdClicked;
        floatAd.OnAdRewarded     += HandleFloatAdRewarded;
        floatAd.OnAdClosed       += HandleFloatAdClosed;
    }
Пример #6
0
    void Start()
    {
        AdOptions adOptions = new AdOptionsBuilder()
                              .SetChannelId(GlobleSettings.GetChannelId)
                              .SetAutoLoadNext(GlobleSettings.IsAutoload)
                              .build();

        rewardVideo                   = new RewardVideoAd(GlobleSettings.GetAppID, GlobleSettings.GetRewardVideoUnitID, adOptions);
        rewardVideo.OnAdLoaded       += HandleRewardVideoLoaded;
        rewardVideo.OnAdFailedToLoad += HandleRewardVideoFailedToLoad;
        rewardVideo.OnAdStarted      += HandleRewardVideoStart;
        rewardVideo.OnAdClicked      += HandleRewardVideoClicked;
        rewardVideo.OnAdRewarded     += HandleRewardVideoRewarded;
        rewardVideo.OnAdClosed       += HandleRewardVideoClosed;

        interstitial                   = new InterstitialAd(GlobleSettings.GetAppID, GlobleSettings.GetInterstitialUnitID, adOptions);
        interstitial.OnAdLoaded       += HandleInterstitialLoaded;
        interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.OnAdStarted      += HandleInterstitialStart;
        interstitial.OnAdClicked      += HandleInterstitialClicked;
        interstitial.OnAdClosed       += HandleInterstitialClosed;
    }
Пример #7
0
        // Creates WindowAd instance.
        public WindowAd(string adAppId, string adUnitId, GameObject gameObject, AdOptions adOptions)
        {
            client = AtmosplayAdsClientFactory.BuildWindowAdClient(adAppId, adUnitId, gameObject);

            if (adOptions == null)
            {
                adOptions = new AdOptionsBuilder().build();
            }
            client.SetChannelId(adOptions.mChannelId);

            client.OnAdLoaded += (sender, args) =>
            {
                if (OnAdLoaded != null)
                {
                    OnAdLoaded(this, args);
                }
            };

            client.OnAdFailedToLoad += (sender, args) =>
            {
                if (OnAdFailedToLoad != null)
                {
                    OnAdFailedToLoad(this, args);
                }
            };

            client.OnAdStarted += (sender, args) =>
            {
                if (OnAdStarted != null)
                {
                    OnAdStarted(this, args);
                }
            };

            client.OnAdClicked += (sender, args) =>
            {
                if (OnAdClicked != null)
                {
                    OnAdClicked(this, args);
                }
            };

            client.OnAdFinished += (sender, args) =>
            {
                if (OnAdFinished != null)
                {
                    OnAdFinished(this, args);
                }
            };

            client.OnAdClosed += (sender, args) =>
            {
                if (OnAdClosed != null)
                {
                    OnAdClosed(this, args);
                }
            };

            client.OnAdFailToShow += (sender, args) =>
            {
                if (OnAdFailToShow != null)
                {
                    OnAdFailToShow(this, args);
                }
            };
        }
Пример #8
0
 internal AdOptions(AdOptionsBuilder builder)
 {
     mChannelId = builder.mChannelId;
     isAutoLoad = builder.isAutoLoad;
 }