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); }
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."); } }
// 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"); } }
void LateUpdate() { if (AdColony.IsV4VCAvailable(ADCOL_ZONE_ID)) { btn.interactable = true; } else { btn.interactable = false; } }
public void ShowRewardedVideo(Action <bool> success) { if (AdColony.IsV4VCAvailable(adIds.ADCOLONY_RewardedVideoZoneID)) { print("adcolony have a rewarded video"); AdColony.OfferV4VC(true, adIds.ADCOLONY_RewardedVideoZoneID); AdColony.OnV4VCResult += delegate(bool successRewarded, string name, int amount) { print("adcolony have callback rewarded video success = " + success); if (success != null) { success(successRewarded); } }; return; } print("adcolony have not rewarded video so don't show!!"); }
public void ShowRewardedVideo() { #if DEBUG_INFO Debug.Log("AndroidManager: attempting to show rewarded video advertisement"); #endif #if UNITY_ANDROID #if VIDEO_ADMOB AndroidAdMob.Client.ShowRewardedVideo(); #elif VIDEO_ADCOLONY if (AdColony.IsV4VCAvailable(ProjectManager.adZoneId)) { AdColony.ShowV4VC(false, ProjectManager.adZoneId); } else { ShowPopUp(ProjectManager.rewardTitle, ProjectManager.rewardMessageError); } GameManager.Instance.OnVideoStarted(); #endif #endif }
public bool IsReadyRewardedVideo() { return(AdColony.IsV4VCAvailable(adIds.ADCOLONY_RewardedVideoZoneID)); }
private void OnGUI() { GUI.skin = this.guiSkin; if (this.paused) { return; } if (GUI.Button(this.changeSceneRect, this.changeSceneText)) { if (Application.loadedLevelName == "ACUBasic") { this.changeSceneText = "Change To Scene 1"; Application.LoadLevel("ACUScene2"); } else { this.changeSceneText = "Change To Scene 2"; Application.LoadLevel("ACUBasic"); } } if (GUI.Button(this.videoRect1, this.videoText1)) { Debug.Log("Status for zone: " + AdColony.StatusForZone(this.zoneId1)); if (AdColony.IsVideoAvailable(this.zoneId1)) { Debug.Log("Play AdColony Video1"); AdColony.ShowVideoAd(this.zoneId1); } else { Debug.Log("Video1 Not Available"); } } if (GUI.Button(this.videoRect2, this.videoText2)) { if (AdColony.IsVideoAvailable(this.zoneId2)) { Debug.Log("Play AdColony Video2"); AdColony.ShowVideoAd(this.zoneId2); } else { Debug.Log("Video2 Not Available"); } } if (GUI.Button(this.v4vcRect, this.v4vcText)) { if (AdColony.IsV4VCAvailable(this.v4vcId)) { Debug.Log("Do V4VC"); AdColony.OfferV4VC(true, this.v4vcId); } else { Debug.Log("V4VC Not Available"); } } if (Application.loadedLevelName == "ACUBasic") { this.changeSceneText = "Change To Scene 2"; } else { this.changeSceneText = "Change To Scene 1"; } if (AdColony.IsVideoAvailable(this.zoneId1)) { GUI.Box(this.statusIconRect1, this.iconReady); GUI.Label(this.statusLabelRect1, this.videoReadyText1); } else { GUI.Box(this.statusIconRect1, this.iconNotReady); GUI.Label(this.statusLabelRect1, this.videoNotReadyText1); } if (AdColony.IsVideoAvailable(this.zoneId2)) { GUI.Box(this.statusIconRect2, this.iconReady); GUI.Label(this.statusLabelRect2, this.videoReadyText2); } else { GUI.Box(this.statusIconRect2, this.iconNotReady); GUI.Label(this.statusLabelRect2, this.videoNotReadyText2); } if (AdColony.IsV4VCAvailable(this.v4vcId)) { GUI.Box(this.v4vcIconRect, this.iconReady); GUI.Label(this.v4vcLabelRect, this.v4vcReadyText); } else { GUI.Box(this.v4vcIconRect, this.iconNotReady); GUI.Label(this.v4vcLabelRect, this.v4vcNotReadyText); } GUI.Label(this.currencyBarRect, "Currency: " + this.currency); GUI.Box(this.brandStampRect, this.brandStamp); }