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."); } }
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"); } }
/// <summary> /// This is the default logic to be performed on button pressed /// </summary> public override void PerformButtonPressLogic() { if (AdColony.IsVideoAvailable(zoneId)) { Debug.Log(this.gameObject.name + " triggered playing a video ad."); AdColony.OfferV4VC(true, zoneId); } else { Debug.Log(this.gameObject.name + " tried to trigger playing an ad, but the video is not available yet."); } }
private bool ShowRewardedVideoGameOverADCOLONY(Action <bool> success) { print("check if adcolony have a video"); if (AdColony.IsVideoAvailable(ADCOLONY_RewardedVideoZoneID)) { print("adcolony have a video"); AdColony.OfferV4VC(true, ADCOLONY_RewardedVideoZoneID); AdColony.OnV4VCResult += delegate(bool successRewarded, string name, int amount) { if (success != null) { success(successRewarded); } }; return(true); } return(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!!"); }
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); }