public void ShowRewardedAd(AdLocation location) { #if UNITY_ADS if (IsRewardedAdReady(location)) { var showOptions = new ShowOptions { resultCallback = (result) => { RewardedAdCallback(result, location); } }; Advertisement.Show( location == AdLocation.Default ? DEFAULT_REWARDED_ZONE_ID : location.ToUnityAdsZoneId(), showOptions ); } else { Debug.Log("Could not show UnityAds rewarded ad: ad is not loaded."); } #else Debug.LogError(NO_SDK_MESSAGE); #endif }
/// <summary> /// 添加一条记录 /// </summary> public ResultSet Add(AdLocation entity) { Func <AdLocation, ResultStatus> validate = (_entity) => { return(new ResultStatus()); }; Func <AdLocation, ResultStatus> op = (_entity) => { int ret = new AdLocationDal().Add(entity); if (ret > 0) { return(new ResultStatus()); } else { return new ResultStatus() { Success = false, Code = StatusCollection.AddFailed.Code, Description = StatusCollection.AddFailed.Description } }; }; return(HandleBusiness(entity, op, validate)); }
//------------------------------------------------------------ // Interstitial Ads. //------------------------------------------------------------ public void LoadInterstitialAd(AdLocation location) { #if EM_ADMOB // Note: On iOS, InterstitialAd objects are one time use objects. // That means once an interstitial is shown, the InterstitialAd object can't be used to load another ad. // To request another interstitial, you'll need to create a new InterstitialAd object. if (interstitialAd != null && interstitialAd.IsLoaded()) { return; } if (interstitialAd == null) { // Create new interstitial object. interstitialAd = new InterstitialAd(globalAdSettings.AdMobIds.InterstitialAdId); // Register for interstitial ad events. interstitialAd.OnAdLoaded += HandleAdMobInterstitialLoaded; interstitialAd.OnAdFailedToLoad += HandleAdMobInterstitialFailedToLoad; interstitialAd.OnAdOpening += HandleAdMobInterstitialOpened; interstitialAd.OnAdClosed += HandleAdMobInterstitialClosed; interstitialAd.OnAdLeavingApplication += HandleAdMobInterstitialLeftApplication; } // By this time interstitialAd either holds the existing, unloaded, unused ad object, or the newly created one. interstitialAd.LoadAd(CreateAdMobAdRequest()); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
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; }
void CBDidCloseInterstitial(CBLocation location) { if (InterstitialAdCompleted != null) { InterstitialAdCompleted(InterstitialAdNetwork.Chartboost, AdLocation.LocationFromName(location.ToString())); } }
void RewardedAdCompletedHandler(RewardedAdNetwork network, AdLocation location) { int beers = PlayerPrefs.GetInt("BEERS"); PlayerPrefs.SetInt("BEERS", beers + 15); UpdateIndicators(); }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_ADCOLONY if (!isInitialized) { return; } // Do nothing if a rewarded ad is already loaded. if (rewardedAd != null && !rewardedAd.Expired) { return; } var adOptions = new EM_AdColony.AdOptions() { ShowPrePopup = globalAdSettings.AdColonyShowRewardedAdPrePopup, ShowPostPopup = globalAdSettings.AdColonyShowRewardedAdPostPopup }; EM_AdColony.Ads.RequestInterstitialAd(globalAdSettings.AdColonyIds.RewardedAdId, adOptions); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { // Unity Ads are loaded automatically if enabled. #if !UNITY_ADS Debug.LogError(NO_SDK_MESSAGE); #endif }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_ADMOB // Loading a new rewarded ad seems to disable all events of the currently playing ad, // so we shouldn't perform rewarded ad loading while playing another one. if (isRewardedAdPlaying) { return; } if (rewardedAd == null) { rewardedAd = RewardBasedVideoAd.Instance; // RewardBasedVideoAd is a singleton, so handlers should only be registered once. rewardedAd.OnAdLoaded += HandleAdMobRewardBasedVideoLoaded; rewardedAd.OnAdFailedToLoad += HandleAdMobRewardBasedVideoFailedToLoad; rewardedAd.OnAdOpening += HandleAdMobRewardBasedVideoOpened; rewardedAd.OnAdStarted += HandleAdMobRewardBasedVideoStarted; rewardedAd.OnAdRewarded += HandleAdMobRewardBasedVideoRewarded; rewardedAd.OnAdClosed += HandleAdMobRewardBasedVideoClosed; rewardedAd.OnAdLeavingApplication += HandleAdMobRewardBasedVideoLeftApplication; } rewardedAd.LoadAd(CreateAdMobAdRequest(), globalAdSettings.AdMobIds.RewardedAdId); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_HEYZAP HZIncentivizedAd.Fetch(); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public bool IsInterstitialAdReady(AdLocation location) { #if EM_HEYZAP return(HZInterstitialAd.IsAvailable()); #else return(false); #endif }
//------------------------------------------------------------ // Interstitial Ads. //------------------------------------------------------------ public void LoadInterstitialAd(AdLocation location) { #if EM_HEYZAP HZInterstitialAd.Fetch(); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public bool IsRewardedAdReady(AdLocation location) { #if EM_CHARTBOOST return(Chartboost.hasRewardedVideo(location.ToChartboostLocation())); #else return(false); #endif }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_CHARTBOOST Chartboost.cacheRewardedVideo(location.ToChartboostLocation()); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public bool IsInterstitialAdReady(AdLocation location) { #if EM_CHARTBOOST return(Chartboost.hasInterstitial(location.ToChartboostLocation())); #else return(false); #endif }
void OnRewardedAdCompleted(RewardedAdNetwork adNetwork, AdLocation location) { // Unsubscribe AdManager.RewardedAdCompleted -= OnRewardedAdCompleted; // Reward the user with coins RewardCoins(); }
public bool IsRewardedAdReady(AdLocation location) { #if EM_HEYZAP return(HZIncentivizedAd.IsAvailable()); #else return(false); #endif }
public bool IsRewardedAdReady(AdLocation location) { #if EM_ADMOB return(rewardedAd != null && rewardedAd.IsLoaded()); #else return(false); #endif }
public bool IsInterstitialAdReady(AdLocation location) { #if EM_ADMOB return(interstitialAd != null && interstitialAd.IsLoaded()); #else return(false); #endif }
//------------------------------------------------------------ // Interstitial Ads. //------------------------------------------------------------ public void LoadInterstitialAd(AdLocation location) { #if EM_CHARTBOOST Chartboost.cacheInterstitial(location.ToChartboostLocation()); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public bool IsRewardedAdReady(AdLocation location) { #if EM_ADCOLONY return(rewardedAd != null && !rewardedAd.Expired); #else return(false); #endif }
public bool IsInterstitialAdReady(AdLocation location) { #if EM_ADCOLONY return(interstitialAd != null && !interstitialAd.Expired); #else return(false); #endif }
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); }
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")); } }
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); }
private AdLocation GetPlacement(string placemnetName) { AdLocation al = new AdLocation(); foreach(AdLocation al1 in adLocations) { if(al1.Name.Equals(placemnetName, StringComparison.OrdinalIgnoreCase)) { al = al1; } } return al; }
public IActionResult GetAd(AdLocation type) { var adv = new AdvertisingModel(); if (type.Equals(AdLocation.Home)) { adv.AdName = "测试"; } return(Json(type)); }
public bool IsRewardedAdReady(AdLocation location) { #if UNITY_ADS return(Advertisement.IsReady( location == AdLocation.Default ? DEFAULT_REWARDED_ZONE_ID : location.ToUnityAdsZoneId() )); #else return(false); #endif }
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; } }