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"); } }
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."); } }
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; } }
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); }
/// <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; }
// Use this for initialization public override void Start() { base.Start(); zoneId = ADCAdManager.GetZoneIdByKey(zoneIdKey); ADCAdManager.AddOnAdAvailabilityChangeMethod(OnAvailabilityChange); UpdateReadyTexture(AdColony.IsVideoAvailable(zoneId)); }
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 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!!"); }
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."); } }
/// <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!"); } }
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"); } }
public override bool isVideoAvailable() { try { if (Info.IsEditor() || Info.IsWeb()) { return(false); } return(AdColony.IsVideoAvailable()); } catch { return(Error(API, ERROR_CHECK_VIDEO)); } }
// 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 PlayAVideo() { // Check to see if a video is available in the zone. if (AdColony.IsVideoAvailable(zoneID)) { Debug.Log("Play AdColony Video"); // Call AdColony.ShowVideoAd with that zone to play an interstitial video. // Note that you should also pause your game here (audio, etc.) AdColony will not // pause your app for you. AdColony.ShowVideoAd(zoneID); } else { Debug.Log("Video Not Available"); } }
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); }
private void ShowRewardAd(StoreInfo al) { MyDebug.Log(false, "AdsMCG::ShowRewardAd => Show Reward Ads 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); } else { NotificationCenter.Me.PostNotification (new Notification (this, "AdsFail", "AdColony")); } break; #endif #if ADMOB case Provider.AdMob: if(GoogleMobileAdsScript.Me.IsRewardVideoAdReady(al.AdMobUnitID)) { ShowAdMobRewardAds(al.AdMobUnitID); } else { NotificationCenter.Me.PostNotification(new NotificationInfo(this, "AdsFail", "AdMob")); } break; #endif #if CHARTBOOST case Provider.Chartboost: if(Chartboost.hasRewardedVideo(new CBLocation(al.CBLoation))) { ShowCBRewardAd(al.CBLoation); } else { NotificationCenter.Me.PostNotification(new NotificationInfo(this, "AdsFail", "Chartboost")); } break; #endif case Provider.Inmobi: break; } }
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); }
public bool IsVideoAvailable() { return(AdColony.IsVideoAvailable(AdsConfig.AdsColonyAdPlacement) || Supersonic.Agent.isRewardedVideoAvailable() || Advertisement.IsReady(AdsConfig.AdsUnityAdsPlacement)); }
// 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 { } } }
void DisplayRestartButton() { //Player dead int highScore = PlayerPrefs.GetInt("HighScore"); //Run this portion only once if (!displayRan) { displayRan = true; float diceRoll = Random.Range(0, 100); float threshold = 100f - (coins * 15); if ((diceRoll > threshold) && AdColony.IsVideoAvailable("vzff120c3f1c414eae9c")) { Debug.Log("Play AdColony Video"); AdColony.ShowVideoAd("vzff120c3f1c414eae9c"); } //Highscore newHigh = SetHighScore(coins); } //GUI Rect buttonRect = new Rect(swidth * 0.1f, sheight * 0.8f, swidth * 0.8f, sheight * 0.1f); //Again Button if (GUI.Button(new Rect(swidth * .1f, sheight * .75f, swidth * .8f, sheight * .15f), againButton)) { Application.LoadLevel(Application.loadedLevelName); } //Rest GUI.DrawTexture(new Rect(swidth * .1f, sheight * .35f, swidth * .8f, sheight * .3f), scoreScreen); GUIStyle newStyle = new GUIStyle(); newStyle.fontSize = (int)swidth / 10; newStyle.fontStyle = FontStyle.Bold; newStyle.normal.textColor = Color.yellow; newStyle.font = (Font)Resources.Load("COMIC"); Rect scoreLabelRect = new Rect(swidth * .26f, sheight * .475f, 10, 10); GUI.Label(scoreLabelRect, coins.ToString(), newStyle); Rect highLabelRect = new Rect(swidth * .645f, sheight * .475f, 10, 10); GUI.Label(highLabelRect, highScore.ToString(), newStyle); //Achievements(Awards) Button if (GUI.Button(new Rect(swidth * .1f, sheight * .175f, swidth * .35f, sheight * .10f), awardsButton)) { //first, authenticate Social.localUser.Authenticate((bool success) => { //handle sucess/failure if (success) { Debug.Log("Log In Success"); } else { Debug.Log("Log In Failed"); } }); //then show Social.ShowAchievementsUI(); } //Scores Button if (GUI.Button(new Rect(swidth * .55f, sheight * .175f, swidth * .35f, sheight * .10f), scoresButton)) { //first, authenticate Social.localUser.Authenticate((bool success) => { //handle sucess/failure if (success) { Debug.Log("Log In Success"); } else { Debug.Log("Log In Failed"); } }); //then show ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI("CgkIgbqWkoIcEAIQBg"); } if (newHigh) { GUI.DrawTexture(new Rect(swidth * .574f, sheight * .57f, swidth * .2f, sheight * .04f), newHighScore); } }
public bool IsReadyVideoAds() { return(AdColony.IsVideoAvailable(adIds.ADCOLONY_InterstitialVideoZoneID)); }
public override bool isLoad() { return(AdColony.IsVideoAvailable(Adzones [0])); }