public static void RequestAdView(string zoneId, AdSize adSize, AdPosition adPosition, AdOptions adOptions)
 {
     if (Ads.IsInitialized())
     {
         SharedInstance.RequestAdView(zoneId, adSize, adPosition, adOptions);
     }
 }
        public void _OnRewardGranted(string paramJson)
        {
            string zoneId    = null;
            bool   success   = false;
            string productId = null;
            int    amount    = 0;

            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values != null)
            {
                if (values.ContainsKey(Constants.OnRewardGrantedZoneIdKey))
                {
                    zoneId = values[Constants.OnRewardGrantedZoneIdKey] as string;
                }
                if (values.ContainsKey(Constants.OnRewardGrantedSuccessKey))
                {
                    success = Convert.ToBoolean(Convert.ToInt32(values[Constants.OnRewardGrantedSuccessKey]));
                }
                if (values.ContainsKey(Constants.OnRewardGrantedNameKey))
                {
                    productId = values[Constants.OnRewardGrantedNameKey] as string;
                }
                if (values.ContainsKey(Constants.OnRewardGrantedAmountKey))
                {
                    amount = Convert.ToInt32(values[Constants.OnRewardGrantedAmountKey]);
                }
            }

            if (Ads.OnRewardGranted != null)
            {
                Ads.OnRewardGranted(zoneId, success, productId, amount);
            }
        }
Beispiel #3
0
        public void _OnCustomMessageReceived(string paramJson)
        {
            Debug.Log("_OnCustomMessageReceived called");

            string type    = null;
            string message = null;

            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values != null)
            {
                if (values.ContainsKey(Constants.OnCustomMessageReceivedTypeKey))
                {
                    type = values[Constants.OnCustomMessageReceivedTypeKey] as string;
                }
                if (values.ContainsKey(Constants.OnCustomMessageReceivedMessageKey))
                {
                    message = values[Constants.OnCustomMessageReceivedMessageKey] as string;
                }
            }

            if (Ads.OnCustomMessageReceived != null)
            {
                Ads.OnCustomMessageReceived(type, message);
            }
        }
        public void _OnIAPOpportunity(string paramJson)
        {
            Hashtable            values       = (AdColonyJson.Decode(paramJson) as Hashtable);
            Hashtable            valuesAd     = null;
            string               iapProductId = null;
            AdsIAPEngagementType engagement   = AdsIAPEngagementType.AdColonyIAPEngagementEndCard;

            if (values.ContainsKey(Constants.OnIAPOpportunityAdKey))
            {
                valuesAd = values[Constants.OnIAPOpportunityAdKey] as Hashtable;
            }
            if (values.ContainsKey(Constants.OnIAPOpportunityEngagementKey))
            {
                engagement = (AdsIAPEngagementType)Convert.ToInt32(values[Constants.OnIAPOpportunityEngagementKey]);
            }
            if (values.ContainsKey(Constants.OnIAPOpportunityIapProductIdKey))
            {
                iapProductId = values[Constants.OnIAPOpportunityIapProductIdKey] as string;
            }

            InterstitialAd ad = GetAdFromHashtable(valuesAd);

            if (Ads.OnIAPOpportunity != null)
            {
                Ads.OnIAPOpportunity(ad, iapProductId, engagement);
            }
        }
        public void _OnCustomMessageReceived(string paramJson)
        {
            string type    = null;
            string message = null;

            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnCustomMessageReceived, " + (paramJson ?? "null"));
                return;
            }

            if (values != null)
            {
                if (values.ContainsKey(Constants.OnCustomMessageReceivedTypeKey))
                {
                    type = values[Constants.OnCustomMessageReceivedTypeKey] as string;
                }
                if (values.ContainsKey(Constants.OnCustomMessageReceivedMessageKey))
                {
                    message = values[Constants.OnCustomMessageReceivedMessageKey] as string;
                }
            }

            if (Ads.OnCustomMessageReceived != null)
            {
                Ads.OnCustomMessageReceived(type, message);
            }
        }
        //Start Native Banner Callbacks.
        //below methods called from native code for Banner Ad.
        public void _OnAdColonyAdViewLoaded(string paramJson)
        {
            Debug.Log("AdColony.Wrapper._OnAdColonyAdViewLoaded called.");
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnAdColonyAdViewLoaded, " + (paramJson ?? "null"));
                return;
            }

            AdColonyAdView adColonyAdView = GetAdColonyAdViewFromHashtable(values);

            if (adColonyAdView == null)
            {
                Debug.LogError("Unable to create ad within _OnAdColonyAdViewLoaded, " + (paramJson ?? "null"));
                return;
            }

            if (Ads.OnAdViewLoaded != null)
            {
                if (adColonyAdView != null)
                {
                    Ads.OnAdViewLoaded(adColonyAdView);
                }
                else
                {
                    Debug.LogError(Constants.AdsMessageErrorUnableToRebuildAd);
                }
            }
        }
        public void _OnRequestInterstitialFailed(string paramJson)
        {
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnRequestInterstitialFailed, " + (paramJson ?? "null"));
                return;
            }

            string zoneId = "";

            if (values != null && values.ContainsKey("zone_id"))
            {
                zoneId = values["zone_id"] as string;
            }

            if (Ads.OnRequestInterstitialFailed != null)
            {
                Ads.OnRequestInterstitialFailed();
            }
            if (Ads.OnRequestInterstitialFailedWithZone != null)
            {
                Ads.OnRequestInterstitialFailedWithZone(zoneId);
            }
        }
        public void _OnClicked(string paramJson)
        {
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnClicked, " + (paramJson ?? "null"));
                return;
            }

            InterstitialAd ad = GetAdFromHashtable(values);

            if (ad == null)
            {
                Debug.LogError("Unable to create ad within _OnClicked, " + (paramJson ?? "null"));
                return;
            }

            if (Ads.OnClicked != null)
            {
                if (ad != null)
                {
                    Ads.OnClicked(ad);
                }
                else
                {
                    Debug.LogError(Constants.AdsMessageErrorUnableToRebuildAd);
                }
            }
        }
Beispiel #9
0
 public void _OnRequestInterstitialFailed()
 {
     Debug.Log("_OnRequestInterstitialFailed called");
     if (Ads.OnRequestInterstitialFailed != null)
     {
         Ads.OnRequestInterstitialFailed();
     }
 }
        public void _OnAudioStopped(string paramJson)
        {
            Hashtable      values = (AdColonyJson.Decode(paramJson) as Hashtable);
            InterstitialAd ad     = GetAdFromHashtable(values);

            if (Ads.OnAudioStopped != null)
            {
                Ads.OnAudioStopped(ad);
            }
        }
        public void _OnLeftApplication(string paramJson)
        {
            Hashtable      values = (AdColonyJson.Decode(paramJson) as Hashtable);
            InterstitialAd ad     = GetAdFromHashtable(values);

            if (Ads.OnLeftApplication != null)
            {
                Ads.OnLeftApplication(ad);
            }
        }
Beispiel #12
0
        public void _OnAudioStopped(string paramJson)
        {
            Debug.Log("_OnAudioStopped called");
            Hashtable      values = (AdColonyJson.Decode(paramJson) as Hashtable);
            InterstitialAd ad     = new InterstitialAd(values);

            if (Ads.OnAudioStopped != null)
            {
                Ads.OnAudioStopped(ad);
            }
        }
        public void _OnExpiring(string paramJson)
        {
            Hashtable      values = (AdColonyJson.Decode(paramJson) as Hashtable);
            InterstitialAd ad     = GetAdFromHashtable(values);

            if (Ads.OnExpiring != null)
            {
                Ads.OnExpiring(ad);
            }

            _ads.Remove(ad.Id);
        }
        public void _OnRequestInterstitialFailed(string paramJson)
        {
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
            string    zoneId = "";

            if (values != null && values.ContainsKey("zone_id"))
            {
                zoneId = values["zone_id"] as string;
            }

            if (Ads.OnRequestInterstitialFailedWithZone != null)
            {
                Ads.OnRequestInterstitialFailedWithZone(zoneId);
            }
        }
        public void _OnConfigure(string paramJson)
        {
            List <Zone> zoneList     = new List <Zone>();
            ArrayList   zoneJsonList = (AdColonyJson.Decode(paramJson) as ArrayList);

            foreach (string zoneJson in zoneJsonList)
            {
                Hashtable zoneValues = (AdColonyJson.Decode(zoneJson) as Hashtable);
                zoneList.Add(new Zone(zoneValues));
            }

            if (Ads.OnConfigurationCompleted != null)
            {
                Ads.OnConfigurationCompleted(zoneList);
            }
        }
        public void _OnIAPOpportunity(string paramJson)
        {
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);

            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnIAPOpportunity, " + (paramJson ?? "null"));
                return;
            }

            Hashtable            valuesAd     = null;
            string               iapProductId = null;
            AdsIAPEngagementType engagement   = AdsIAPEngagementType.AdColonyIAPEngagementEndCard;

            if (values.ContainsKey(Constants.OnIAPOpportunityAdKey))
            {
                valuesAd = (AdColonyJson.Decode(values[Constants.OnIAPOpportunityAdKey] as String)) as Hashtable;
            }
            if (values.ContainsKey(Constants.OnIAPOpportunityEngagementKey))
            {
                engagement = (AdsIAPEngagementType)Convert.ToInt32(values[Constants.OnIAPOpportunityEngagementKey]);
            }
            if (values.ContainsKey(Constants.OnIAPOpportunityIapProductIdKey))
            {
                iapProductId = values[Constants.OnIAPOpportunityIapProductIdKey] as string;
            }

            InterstitialAd ad = GetAdFromHashtable(valuesAd);

            if (ad == null)
            {
                Debug.LogError("Unable to create ad within _OnIAPOpportunity, " + (paramJson ?? "null"));
                return;
            }

            if (Ads.OnIAPOpportunity != null)
            {
                Ads.OnIAPOpportunity(ad, iapProductId, engagement);
            }
        }
        //below methods called from native code for Interstital Ad.
        public void _OnConfigure(string paramJson)
        {
            List <Zone> zoneList     = new List <Zone>();
            ArrayList   zoneJsonList = (AdColonyJson.Decode(paramJson) as ArrayList);

            if (zoneJsonList == null)
            {
                Debug.LogError("Unable to parse parameters in _OnConfigure, " + (paramJson ?? "null"));
                return;
            }

            foreach (string zoneJson in zoneJsonList)
            {
                Hashtable zoneValues = (AdColonyJson.Decode(zoneJson) as Hashtable);
                zoneList.Add(new Zone(zoneValues));
            }

            if (Ads.OnConfigurationCompleted != null)
            {
                Ads.OnConfigurationCompleted(zoneList);
            }
        }
Beispiel #18
0
 public void ShowAdView()
 {
     Debug.Log("AdColony.AdColonyAdView.show called.");
     Ads.ShowAdView(Id);
 }
 public void DestroyAd()
 {
     Debug.Log("AdColony.InterstitialAd.DestroyAd called.");
     Ads.DestroyAd(Id);
 }
Beispiel #20
0
 public void DestroyAdView()
 {
     Debug.Log("AdColony.AdColonyAdView.DestroyAdView called.");
     Ads.DestroyAdView(Id);
 }
Beispiel #21
0
 public void HideAdView()
 {
     Debug.Log("AdColony.AdColonyAdView.hide called.");
     Ads.HideAdView(Id);
 }