Exemplo n.º 1
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);
                }
            };
        }