public TableAds Get(string id) { TableAds data = null; _ins.mDict.TryGetValue(id, out data); return(data); }
private void DelayRequestAll() { var allAds = TableAds.GetAll().ToList(a => a.priority > 0); for (int i = 0; i < allAds.Count; i++) { RequestAdDelay(allAds[i].unitID, i * AD_AUTO_LOAD_INTERAL + AD_AUTO_LOAD_DELAY); } }
private List <string> GetAdUnits(string type) { var ads = TableAds.GetAll().ToList(a => a.type == type); var adUnits = new List <string>(); foreach (var ad in ads) { if (!adUnits.Contains(ad.unitID)) { adUnits.Add(ad.unitID); } } return(adUnits); }
private AdType GetAdType(string adUnit) { switch (TableAds.Get(a => a.unitID == adUnit).type) { case "Banner": return(AdType.Banner); case "Interstitial": return(AdType.Interstitial); case "RewardedVideo": return(AdType.RewardedVideo); } return(AdType.None); }
public void ShowAd(Action successCallback, Action errorCallback) { currentSuccessCallback = successCallback; currentErrorCallback = errorCallback; currentShowingAd = true; currentNeedAutoPlay = false; currentWaitForAutoPlayCD = 0; var topAd = ""; var topAdPriority = 0f; foreach (var ad in TableAds.GetAll()) { if (!IsLoaded(ad.unitID)) { continue; } if (ad.priority > topAdPriority) { topAd = ad.unitID; topAdPriority = ad.priority; } } if (!string.IsNullOrEmpty(topAd)) { ShowAd(topAd); } else if (loadingAds.Count > 0) { currentNeedAutoPlay = true; currentWaitForAutoPlayCD = AD_LOAD_TIMEOUT; HoldOn(); } else { Failed(); } }