public bool IsAdAvailable(string placement) { bool retValue = false; if(GameUtility.Me.playerData.isRemoveAds && !placement.ToLower().Contains("free")) { MyDebug.Log("AdsMCG::IsAdAvailable => Remove Ad purchsed"); return false; } AdLocation al = GetPlacement(placement); StoreInfo storeInfo = al.GetIdsFor(_store); if(null == storeInfo) { MyDebug.Log("AdsMCG::IsAdsAvailable => There are not info of {0} store for {1} location", _store, al.Name); return false; } MyDebug.Log(false, "AdsMCG::IsAdsAvailable => Is Ads Available Called"); switch(storeInfo.Type) { case AdType.Interstitial: retValue = IsInterstitialAvailable(storeInfo); break; case AdType.RewardVideo: retValue = IsRewardAdAvailable(storeInfo); break; case AdType.MoreApp: retValue = false; MyDebug.Warning(false, "AdsMCG::IsAdsAvailable => More App Wall Is not Integrated"); break; } return retValue; }
private void GMAInterstitialOpening(string adUnitID) { AdLocation al = GetPlacement("GameStart"); StoreInfo si = al.GetIdsFor(_store); if(si.AdMobUnitID.Equals(adUnitID)) { isFirstTimeShow = false; MyDebug.Log(false, "Game Start Ads Shown at " + DateTime.UtcNow.ToString("O")); } }
private void CacheAdMob(AdLocation al) { if(GameUtility.Me.playerData.isRemoveAds && !al.Name.ToLower().Contains("free")) { MyDebug.Log(false, "AdsMCG::CacheAdMobRewardAd => Remove Ad purchsed"); return; } StoreInfo si = al.GetIdsFor(_store); CacheAdMob(si.AdMobUnitID); }
private void GMAInterstitialClosed(string adUnitID) { AdLocation al = GetPlacement("BackFromBG"); StoreInfo si = al.GetIdsFor(_store); if(si.AdMobUnitID.Equals(adUnitID)) { MyDebug.Log(false, "Back From BG Ads Shown at " + DateTime.UtcNow.ToString("O")); _lastBGAddShown = DateTime.UtcNow; } CacheAdMob(adUnitID); }
void CBDidDisplayInterstitial(CBLocation location) { MyDebug.Log(false, "AdsMGS::CBDidDisplayInterstitial: " + location); AdLocation al = GetPlacement("GameStart"); StoreInfo si = al.GetIdsFor(_store); if(si.CBLoation.Equals(location.ToString())) { isFirstTimeShow = false; MyDebug.Log(false, "Game Start Ads Shown at " + DateTime.UtcNow.ToString("O")); } }
void CBDidCloseInterstitial(CBLocation location) { MyDebug.Log(false, "AdsMGS::CBDidCloseInterstitial: " + location); AdLocation al = GetPlacement("BackFromBG"); StoreInfo si = al.GetIdsFor(_store); if(si.CBLoation.Equals(location.ToString())) { MyDebug.Log(false, "Back From BG Ads Shown at " + DateTime.UtcNow.ToString("O")); _lastBGAddShown = DateTime.UtcNow; } }
public void ShowAd(string placement) { if(GameUtility.Me.playerData.isRemoveAds && !placement.ToLower().Contains("free")) { MyDebug.Log("AdsMCG::ShowAd => Remove Ad purchsed"); return; } if(CoreUtility.Me.settings.gameLaunchCount < GameUtility.Me.noAdUntilGameLunch || CoreUtility.Me.settings.gamePlayCount < GameUtility.Me.noAdUntilGamePlay || CoreUtility.Me.settings.gameOverCount < GameUtility.Me.noAdUntilGameOver) { MyDebug.Log("AdsMCG::ShowAds => Ad will not show becasue noAd rule applied\n" + "launch count: {0}, launch need: {1},\nplay count; {2}, play need: {3},\nover Count: {4}, over need: {5}\n\n", CoreUtility.Me.settings.gameLaunchCount, GameUtility.Me.noAdUntilGameLunch, CoreUtility.Me.settings.gamePlayCount, GameUtility.Me.noAdUntilGamePlay, CoreUtility.Me.settings.gamePlayCount, GameUtility.Me.noAdUntilGameOver); return; } if(!IsAdAvailable(placement)) { MyDebug.Log(false, "AdsMCG::ShowAd => ad not available for location {0}", placement); return; } AdLocation al = GetPlacement(placement); StoreInfo storeInfo = al.GetIdsFor(_store); if(null == storeInfo) { MyDebug.Log(false, "AdsMCG::ShowAd => There are not info of {0} store for {1} location", _store, al.Name); return; } storeInfo.requestCount++; if(storeInfo.requestCount % storeInfo.showAtEveryFrequency != 0) { MyDebug.Log(false, "AdsMCG::ShowAds => display Frequency not match for placement " + al.Name); return; } MyDebug.Log(false, "AdsMCG::ShowAds => Show Ad Called"); switch(storeInfo.Type) { case AdType.Interstitial: ShowInterstitialAd(storeInfo); break; case AdType.RewardVideo: ShowRewardAd(storeInfo); break; case AdType.MoreApp: MyDebug.Warning(false, "AdsMCG::ShowAds => More App Wall Is not Integrated"); break; } }
private void CacheAdMobRewardAd(AdLocation al) { StoreInfo si = al.GetIdsFor(_store); CacheAdMobRewardAd(si.AdMobUnitID); }