private void ShowInterstitialAd(StoreInfo al) { MyDebug.Log(false, "AdsMCG::ShowInterstitialAd => Show Interstitial Ad Called"); switch(al.ShowAdsFrom) { #if ADCOLONY case Provider.AdColony: string rawStatus, status; rawStatus = AdColony.StatusForZone (al.AdColonyZone); status = string.Format ("Zone {0} status is {1}", al.AdColonyZone, rawStatus); MyDebug.Log (false,status); if (AdColony.IsVideoAvailable (al.AdColonyZone)) { ShowAdColonyAds (al.AdColonyZone); } break; #endif #if ADMOB case Provider.AdMob: if(GoogleMobileAdsScript.Me.IsInterstitialReady(al.AdMobUnitID)) { ShowAdMobAds(al.AdMobUnitID); } break; #endif #if CHARTBOOST case Provider.Chartboost: if(Chartboost.hasInterstitial(new CBLocation(al.CBLoation))) { ShowChartboostAds(al.CBLoation); } break; #endif case Provider.Inmobi: break; } }
/// <summary> /// Return true if a rewarded video is available (Chartboost and / or Unity Ads if integrated, please refere to the ADS_INTEGRATION_DOCUMENTATION.PDF) /// </summary> public bool RewardedVideoIsInitialized() { print("RewardedVideoIsInitialized method check"); bool adsReady = false; #if CHARTBOOST adsReady = adsReady || Chartboost.hasRewardedVideo(CBLocation.Default); if (!Chartboost.hasRewardedVideo(CBLocation.Default)) { Chartboost.cacheRewardedVideo(CBLocation.Default); } #endif #if ADCOLONY adsReady = adsReady || AdColony.IsVideoAvailable(ADCOLONY_RewardedVideoZoneID); #endif #if UNITY_ADS adsReady = adsReady || Advertisement.IsReady(rewardedVideoZoneUnityAds); #endif if (Application.isEditor) { adsReady = rewardedVideoAlwaysReadyInSimulator; } print("RewardedVideoIsInitialized method check finished, adsReady = " + adsReady); return(adsReady); }
private bool IsRewardAdAvailable(StoreInfo al) { bool retValue = false; MyDebug.Log(false, "AdsMCG::IsRewardAdAvailable => IsReward Ad Available Called"); switch(al.ShowAdsFrom) { #if ADCOLONY case Provider.AdColony: string rawStatus, status; rawStatus = AdColony.StatusForZone (al.AdColonyZone); status = string.Format ("Zone {0} status is {1}", al.AdColonyZone, rawStatus); MyDebug.Log (false,status); retValue = AdColony.IsVideoAvailable (al.AdColonyZone); break; #endif #if ADMOB case Provider.AdMob: retValue = GoogleMobileAdsScript.Me.IsRewardVideoAdReady(al.AdMobUnitID); //if(!retValue) GoogleMobileAdsScript.Me.RequestRewardVideoAd(al.AdMobUnitID); break; #endif #if CHARTBOOST case Provider.Chartboost: retValue = Chartboost.hasRewardedVideo(new CBLocation(al.CBLoation)); if(!retValue) Chartboost.cacheRewardedVideo(new CBLocation(al.CBLoation)); break; #endif case Provider.Inmobi: default: break; } return retValue; }
private void InitAdvertising() { #if UNITY_ANDROID // Initialize Admob client and set advertisements ids AndroidAdMob.Client.Init(ProjectManager.bannerId); AndroidAdMob.Client.SetInterstisialsUnitID(ProjectManager.intersticialId); for (int i = 0; i < ProjectManager.adKeywords.Length; i++) { AndroidAdMob.Client.AddKeyword(ProjectManager.adKeywords[i]); } AndroidAdMob.Client.TagForChildDirectedTreatment(false); #if VIDEO_ADMOB AndroidAdMob.Client.SetRewardedVideoAdUnitID(ProjectManager.rewardedId); AndroidAdMob.Client.OnRewardedVideoAdClosed += OnRewardedVideoAdClosed; #elif VIDEO_ADCOLONY // Initialize AdColony client and advertisements ids AdColony.OnVideoStarted += OnVideoStarted; AdColony.OnV4VCResult = OnV4VCResult; AdColony.Configure(ProjectManager.adVersion, ProjectManager.adAppId, ProjectManager.adZoneId); #endif #endif #if DEBUG_INFO Debug.Log("AndroidManager: advertising initialized successfully"); #endif }
public static void ShowVideoAdByZoneKey(string zoneIdKey, bool offerV4VCBeforePlay = false, bool showPopUpAfter = false) { ADCVideoZone videoZone = GetVideoZoneObjectByKey(zoneIdKey); string zoneId = GetZoneIdByKey(zoneIdKey); if (IsVideoAvailableByZoneKey(zoneIdKey)) { if (videoZone.zoneType == ADCVideoZoneType.Interstitial) { AdColony.ShowVideoAd(zoneId); } else if (videoZone.zoneType == ADCVideoZoneType.V4VC) { if (offerV4VCBeforePlay) { AdColony.OfferV4VC(showPopUpAfter, zoneId); } else { AdColony.ShowV4VC(showPopUpAfter, zoneId); } } else { //Check nothing, video zone type isn't correct Debug.Log("An incorrect video zone type was requested to play. Please resolve this issue."); } Debug.Log("The zone '" + zoneId + "' was requested to play."); } else { Debug.Log("The zone '" + zoneId + "' was requested to play, but it is NOT ready to play yet."); } }
//--------------------------------------------------------------------------- // Use this for initialization public override void Start() { base.Start(); ConfigureZoneString(); AdColony.Configure(appVersion, appId, zoneString); AdColony.OnAdAvailabilityChange = OnAdAvailabilityChange; }
// When a video is available, you may choose to play it in any fashion you like. // Generally you will play them automatically during breaks in your game, // or in response to a user action like clicking a button. // Below is a method that could be called, or attached to a GUI action. public void PlayV4VCAd(string zoneID, bool prePopup, bool postPopup) { // Check to see if a video for V4VC is available in the zone. if (AdColony.IsV4VCAvailable(zoneID)) { Debug.Log("Play AdColony V4VC Ad"); // The AdColony class exposes two methods for showing V4VC Ads. // --------------------------------------- // The first `ShowV4VC`, plays a V4VC Ad and, optionally, displays // a popup when the video is finished. // --------------------------------------- // The second is `OfferV4VC`, which popups a confirmation before // playing the ad and, optionally, displays popup when the video // is finished. // Call one of the V4VC Video methods: // Note that you should also pause your game here (audio, etc.) AdColony will not // pause your app for you. if (prePopup) { AdColony.OfferV4VC(postPopup, zoneID); } else { AdColony.ShowV4VC(postPopup, zoneID); } } else { Debug.Log("V4VC Ad Not Available"); } }
public static void ShowVideoAdByZoneKey(string zoneIdKey, bool offerV4VCBeforePlay = false, bool showPopUpAfter = false) { ADCVideoZoneCustom videoZone = GetVideoZoneObjectByKey(zoneIdKey); string zoneId = GetZoneIdByKey(zoneIdKey); if (videoZone.zoneType == ADCVideoZoneTypeCustom.Interstitial && AdColony.IsVideoAvailable(zoneId)) { AdColony.ShowVideoAd(zoneId); } else if (videoZone.zoneType == ADCVideoZoneTypeCustom.V4VC && AdColony.IsV4VCAvailable(zoneId)) { if (offerV4VCBeforePlay) { AdColony.OfferV4VC(showPopUpAfter, zoneId); } else { AdColony.ShowV4VC(showPopUpAfter, zoneId); } } else { Debug.Log("AdColony ---- The zone '" + zoneId + "' was requested to play, but it is NOT ready to play yet."); } }
public void PlayAVideo(string adPlacement) { if (OnVideoStarted != null) { OnVideoStarted(); } if (AdColony.IsVideoAvailable(adPlacement)) { Debug.Log("Play a video"); AdColony.ShowVideoAd(adPlacement); } else if (Supersonic.Agent.isRewardedVideoAvailable()) { Debug.Log("Play a supersonic's video"); Supersonic.Agent.showRewardedVideo(adPlacement); } else if (Advertisement.isReady(adPlacement)) { ShowOptions options = new ShowOptions(); options.resultCallback = AdCallbackHandler; Advertisement.Show(adPlacement, options); } else { Debug.Log("No video to show"); } }
// Update is called once per frame void Update() { // currencyText.text = ("Credits: " + ADCAdManager.GetRegularCurrencyAmount()); PlayVideoZoneButton playVideoZoneButton = currencyButton.GetComponent <PlayVideoZoneButton>(); currencyText.text = (AdColony.GetV4VCName(ADCAdManager.GetZoneIdByKey(playVideoZoneButton.zoneIdKey)) + ": " + ADCAdManager.GetRegularCurrencyAmount()); }
public static bool IsVideoAvailableByZoneKey(string zoneKey) { bool isZoneAvailable = false; if (ContainsZoneKey(zoneKey)) { ADCVideoZone videoZone = ADCAdManager.GetVideoZoneObjectByKey(zoneKey); if (videoZone != null) { if (videoZone.zoneType == ADCVideoZoneType.Interstitial) { if (AdColony.IsVideoAvailable(videoZone.zoneId)) { isZoneAvailable = true; } } else if (videoZone.zoneType == ADCVideoZoneType.V4VC) { if (AdColony.IsV4VCAvailable(videoZone.zoneId)) { isZoneAvailable = true; } } else { //Check nothing, video zone type isn't correct } } } return(isZoneAvailable); }
// Use this for initialization public override void Start() { base.Start(); zoneId = ADCAdManager.GetZoneIdByKey(zoneIdKey); ADCAdManager.AddOnAdAvailabilityChangeMethod(OnAvailabilityChange); UpdateReadyTexture(AdColony.IsVideoAvailable(zoneId)); }
private void RequestBannerAd() { // Optional Ad specific options to be sent with request adOptions = new AdColonyAdOptions(); //Request Ad AdColony.RequestAdView(ZONE_ID, listener, AdColonyAdSize.Banner, adOptions); }
//--------------------------------------------------------------------------- // Use this for initialization public override void Start() { base.Start(); ConfigureZoneString(); AdColony.Configure(appVersion, appId, zoneId); AdColony.OnAdAvailabilityChange = OnAdAvailabilityChange; AdColony.OnV4VCResult = UpdateCurrencyText; }
public override void OnExpiring(AdColonyInterstitial ad) { // Request a new ad if ad is expiring _activity.showButton.Enabled = false; _activity.progress.Visibility = ViewStates.Visible; AdColony.RequestInterstitial(ZONE_ID, this, _activity.adOptions); Log.Debug(TAG, "onExpiring"); }
public void InitAdColony() { AdColony.Configure ( "version:1.0,store:google", AdsConfig.AdsAdColonyAppId, // app id AdsConfig.AdsColonyAdPlacement // zone id ); }
private void OnVideoFinishedWithInfo(AdColonyAd ad) { ++onVideoFinishedWithInfoCounter; Debug.Log("On Video Finished With Info, ad Played: " + ad.toString()); if (ad.iapEnabled) { AdColony.NotifyIAPComplete("ProductID", "TransactionID", null, 0, 1); } Resume(); }
private void ShowAdColonyAds(string zoneID) { #if ADCOLONY if (AdColony.IsVideoAvailable (zoneID)) { AdColony.ShowVideoAd (zoneID); } else { MyDebug.Log (false,"AdsMCG::ShowAdColonyAds => Cache not Interstitialed"); NotificationCenter.Me.PostNotification (new Notification (this, "AdsFail", "AdColony")); } #endif }
public void ConfigureADCPlugin() { //THIS MUST BE RUN BEFORE ADCOLONY.CONFIGURE() IN ORDER FOR THE AD MANAGER TO BE AWARE OF WHAT INFORMATION TO PASS TO THE ADCOLONY PLUGIN ConfigureZones(); // This configures the AdColony SDK so that the application is targetting the correct zone for generating ads AdColony.Configure(version, // Arbitrary app version appId, // ADC App ID from adcolony.com GetVideoZoneIdsAsStringArray()); }
public void ShowVideoAds() { if (AdColony.IsVideoAvailable(adIds.ADCOLONY_InterstitialVideoZoneID)) { bool showAds = AdColony.ShowVideoAd(adIds.ADCOLONY_InterstitialVideoZoneID); print("Ad Colony show interstitiazl video = " + showAds); return; } print("Ad Colony doesn't have interstitiazl video so don't show!!"); }
void LateUpdate() { if (AdColony.IsV4VCAvailable(ADCOL_ZONE_ID)) { btn.interactable = true; } else { btn.interactable = false; } }
private void OnVideoFinishedWithInfo(AdColonyAd ad) { Debug.Log("On Video Finished With Info, ad Played: " + ad.toString()); if (ad.iapEnabled) { Debug.Log("Calling Notify IAP Complete"); AdColony.notifyIAPComplete("ProductID", "TransactionID"); Debug.Log("Notified of IAP Complete"); } Resume(); }
private static void ensureInstance() { if (instance == null) { instance = FindObjectOfType(typeof(AdColony)) as AdColony; if (instance == null) { instance = new GameObject("AdColony").AddComponent <AdColony>(); } } }
private static void ensureInstance() { if (instance == null) { Debug.LogWarning("AdColony Unity version -- " + AdColony.version); instance = FindObjectOfType(typeof(AdColony)) as AdColony; if (instance == null) { instance = new GameObject("AdColony").AddComponent <AdColony>(); } } }
public void PlayAVideo(string zoneID) { if (AdColony.IsVideoAvailable(zoneID)) { Debug.Log("Play a video"); AdColony.ShowVideoAd(zoneID); } else { Debug.Log("Video not avaiable"); } }
/// <summary> /// This is the default logic to be performed on button pressed /// </summary> public override void PerformButtonPressLogic() { if (AdColony.IsVideoAvailable(zoneString)) { Debug.Log(this.gameObject.name + " triggered playing a video ad."); AdColony.ShowVideoAd(zoneString); } else { Debug.Log(this.gameObject.name + " tried to trigger playing an ad, but the video is not available yet."); } }
private static void ensureInstance() { if(instance == null) { Debug.LogWarning("AdColony Unity version -- " + AdColony.version); instance = FindObjectOfType( typeof(AdColony) ) as AdColony; if(instance == null) { instance = new GameObject("AdColony").AddComponent<AdColony>(); } } }
void Start() { #if UNITY_ANDROID appId = Global.ADCOLONY_APP_ID; zoneString = Global.ADCOLONY_ZONE; #elif UNITY_IPHONE appId = appId_Ios; zoneString = zoneString_Ios; #endif AdColony.Configure("1.0", appId, zoneString); AdColony.OnVideoStarted = OnVideoStarted; AdColony.OnVideoFinished = OnVideoFinished; }
/// <summary> /// 동영상을 보여주는 함수 /// </summary> public void ShowVideoAdmob() { if (AdColony.IsVideoAvailable(zoneString)) { Debug.Log(this.gameObject.name + " triggered playing a video ad."); AdColony.ShowVideoAd(zoneString); } else { Debug.Log(this.gameObject.name + " tried to trigger playing an ad, but the video is not available yet."); UIManager.Inst.PopupMessage("adcolony not available yet!"); } }
//end of vars public void Awake() { //Google play services activate //Ad initialization AdColony.Configure( "version:2.0,store:google", "app0c620af3b8854f0eaa", "vzff120c3f1c414eae9c" ); }
public void PlayAdColonyVideo() { Debug.Log("Status for zone: " + AdColony.StatusForZone(this.zoneId1)); if (AdColony.IsVideoAvailable(this.zoneId1)) { Debug.Log("Playing AdColony Video1"); AdColony.ShowVideoAd(this.zoneId1); } else { Debug.Log("Video1 is not Not Available"); } }
private static void ensureInstance() { if(instance == null) { instance = FindObjectOfType( typeof(AdColony) ) as AdColony; if(instance == null) { instance = new GameObject("AdColony").AddComponent<AdColony>(); } } }
public static void RemoveOnAdAvailabilityChangeMethod(AdColony.AdAvailabilityChangeDelegate onAdAvailabilityChange) { AdColony.OnAdAvailabilityChange -= onAdAvailabilityChange; }
public static void RemoveOnV4VCResultMethod(AdColony.V4VCResultDelegate onV4VCResult) { AdColony.OnV4VCResult -= onV4VCResult; }
public static void RemoveOnVideoFinishedWithInfoMethod(AdColony.VideoFinishedWithInfoDelegate onVideoFinishedWithInfo) { AdColony.OnVideoFinishedWithInfo -= onVideoFinishedWithInfo; }
public static void RemoveOnVideoStartedMethod(AdColony.VideoStartedDelegate onVideoStarted) { AdColony.OnVideoStarted -= onVideoStarted; }
//----------------- public static void AddOnAdAvailabilityChangeMethod(AdColony.AdAvailabilityChangeDelegate onAdAvailabilityChange) { AdColony.OnAdAvailabilityChange += onAdAvailabilityChange; }
//----------------- public static void AddOnV4VCResultMethod(AdColony.V4VCResultDelegate onV4VCResult) { AdColony.OnV4VCResult += onV4VCResult; }
//----------------- public static void AddOnVideoFinishedWithInfoMethod(AdColony.VideoFinishedWithInfoDelegate onVideoFinishedWithInfo) { AdColony.OnVideoFinishedWithInfo += onVideoFinishedWithInfo; }
//--------------------------------------------------------------------------- // AdManager Delegate Wrapper //--------------------------------------------------------------------------- public static void AddOnVideoStartedMethod(AdColony.VideoStartedDelegate onVideoStarted) { AdColony.OnVideoStarted += onVideoStarted; }