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"); } }
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 }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector2 mousePosition = CM.ScreenToWorldPoint(Input.mousePosition); Collider2D hitCollider = Physics2D.OverlapPoint(mousePosition); try { if (hitCollider.name == "BotaoJogar") { Estrela1.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; Estrela2.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; Estrela3.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; LevelsMap.ChangeIsClickEnabled(true); Confirmacao.SetActive(false); LevelsMap.GoToLevel(SelectedLevelNumber); } if (hitCollider.name == "X1") { LevelsMap.ChangeIsClickEnabled(true); Confirmacao2.SetActive(false); Confirmacao3.SetActive(false); Estrela1.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; Estrela2.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; Estrela3.GetComponent <SpriteRenderer>().sprite = Resources.Load("EstrelaM", typeof(Sprite)) as Sprite; Confirmacao.SetActive(false); } if (hitCollider.name == "BotaoVidasGratis") { LevelsMap.ChangeIsClickEnabled(true); Debug.Log("Video ganha vidas"); // PlayerPrefs.SetInt("Vidas", PlayerPrefs.GetInt("Vidas") + 50); #if (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) if (AdColony.IsVideoAvailable()) { AdColony.ShowV4VC(false, "vzbf5bd67a56cb4d35bf"); Confirmacao2.SetActive(false); Confirmacao3.SetActive(false); PlayerPrefs.SetInt("Vidas", PlayerPrefs.GetInt("Vidas") + 20); } else if (UnityEngine.Advertisements.Advertisement.isReady()) { PlayerPrefs.SetInt("Vidas", PlayerPrefs.GetInt("Vidas") + 20); UnityEngine.Advertisements.Advertisement.Show(); Confirmacao2.SetActive(false); Confirmacao3.SetActive(false); } else { Debug.Log("Chega"); } #else Confirmacao2.SetActive(false); Confirmacao3.SetActive(false); #endif } if (hitCollider.name == "BotaoComprarVidas") { // LevelsMap.ChangeIsClickEnabled(true); // PlayerPrefs.SetInt("Vidas", PlayerPrefs.GetInt("Vidas") + 100); // Confirmacao2.SetActive(false); // Confirmacao3.SetActive(false); } } catch { } } }