public void ShowAds(bool chartboost = true) { if (chartboost) { Chartboost.showInterstitial(CBLocation.Default); Chartboost.cacheInterstitial(CBLocation.Default); } else { if (interstitial.IsLoaded()) { interstitial.Show(); #if UNITY_ANDROID interstitial = new InterstitialAd(admobUIDAndroid); #elif UNITY_IOS interstitial = new InterstitialAd(admobUIDIOS); #else interstitial = new InterstitialAd(admobUIDAndroid); #endif // Create an empty ad request. requestAdmob = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(requestAdmob); } } }
private bool IsInterstitialAvailable(StoreInfo al) { bool retValue = false; MyDebug.Log(false, "AdsMCG::IsInterstitialAvailable => Is Interstitial 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.IsInterstitialReady(al.AdMobUnitID); //if(!retValue) GoogleMobileAdsScript.Me.RequestInterstitial(al.AdMobUnitID); break; #endif #if CHARTBOOST case Provider.Chartboost: retValue = Chartboost.hasInterstitial(new CBLocation(al.CBLoation)); if(!retValue) Chartboost.cacheInterstitial(new CBLocation(al.CBLoation)); break; #endif case Provider.Inmobi: default: break; } return retValue; }
// Use this for initialization void Start() { DontDestroyOnLoad(this.gameObject); Chartboost.cacheInterstitial(CBLocation.Default); Chartboost.cacheRewardedVideo(CBLocation.Default); Chartboost.setAutoCacheAds(true); }
void Update() { foreach (AdNetwork network in Enum.GetValues(typeof(AdNetwork))) { if (allNetworks.Contains(network)) { DebugPanel.Log(network.ToString(), "Ads", IsReady(network)); } } if (!Chartboost.hasInterstitial(CBLocation.Default) && !CBdownloading) { CBdownloading = true; Chartboost.cacheInterstitial(CBLocation.Default); } if (!AdMob_Interstitial.IsLoaded() && !AdMob_loading) { AdMob_loading = true; AdMob_Interstitial = new InterstitialAd(GetAdMobIDs()); AdMob_Interstitial.LoadAd(new AdRequest.Builder().Build()); } else if (AdMob_Interstitial.IsLoaded()) { AdMob_loading = false; } }
void Start() { GameObject.Find("SoundManager").GetComponents <AudioSource>()[0].volume = PlayerPrefs.GetFloat("musicLevel") / 100f; soundmanager = GameObject.Find("SoundManager"); Chartboost.cacheInterstitial(CBLocation.Default); Chartboost.cacheRewardedVideo(CBLocation.Default); text.text = PlayerPrefs.GetInt("coins").ToString(); int bttnLength = bttn.Length; distance = new float[bttnLength]; bttnDistance = (int)Mathf.Abs(bttn[1].GetComponent <RectTransform>().anchoredPosition.x - bttn[0].GetComponent <RectTransform>().anchoredPosition.x); foreach (Button button in bttn) { string[] splitString = button.name.Split('-'); string itemName = splitString[0]; //name of item //Debug.Log (splitString[1]); //price if (PlayerPrefs.GetString(itemName) == "true") { button.GetComponent <Image>().color = Color.white; } else { button.GetComponent <Image>().sprite = unknown; } } }
public void BuyOrSelect() { string[] splitString = selectedButton.name.Split('-'); if (PlayerPrefs.GetString(splitString[0]) == "true") //select { PlayerPrefs.SetString("selected", splitString[0]); shopPanel.SetActive(false); } else //buy { int coins = PlayerPrefs.GetInt("coins"); if (splitString[1] != "Free") { coins = coins - int.Parse(splitString[1]); } if (coins >= 0) { PlayerPrefs.SetString(splitString[0], "true"); if (splitString[0] == "BlueGuy") { selectedButton.GetComponent <Image>().sprite = BlueGuy; } else if (splitString[0] == "WhiteGuy") { selectedButton.GetComponent <Image>().sprite = WhiteGuy; } else if (splitString[0] == "BlackGuy") { selectedButton.GetComponent <Image>().sprite = BlackGuy; } else if (splitString[0] == "Gold") { Chartboost.cacheInterstitial(CBLocation.Default); selectedButton.GetComponent <Image>().sprite = Gold; } else if (splitString[0] == "Ice") { selectedButton.GetComponent <Image>().sprite = Ice; } else if (splitString[0] == "Smile") { selectedButton.GetComponent <Image>().sprite = Smile; } else if (splitString[0] == "Ghost") { selectedButton.GetComponent <Image>().sprite = Ghost; } else if (splitString[0] == "Radioactive") { selectedButton.GetComponent <Image>().sprite = Radioactive; } else if (splitString[0] == "Drake") { selectedButton.GetComponent <Image>().sprite = Drake; } PlayerPrefs.SetInt("coins", coins); text.text = PlayerPrefs.GetInt("coins").ToString(); } } }
public void ShowInter() { Chartboost.cacheInterstitial(CBLocation.HomeScreen); Chartboost.setAutoCacheAds(true); if (PlayerPrefs.HasKey("AdCount")) { if (PlayerPrefs.GetInt("AdCount") == 2) { if (Chartboost.hasInterstitial(CBLocation.HomeScreen)) { Chartboost.showInterstitial(CBLocation.HomeScreen); } PlayerPrefs.SetInt("AdCount", 0); } else { PlayerPrefs.SetInt("AdCount", PlayerPrefs.GetInt("AdCount") + 1); } } else { PlayerPrefs.SetInt("AdCount", 0); } Chartboost.cacheInterstitial(CBLocation.HomeScreen); Chartboost.setAutoCacheAds(true); if (Chartboost.hasInterstitial(CBLocation.HomeScreen)) { Chartboost.showInterstitial(CBLocation.HomeScreen); } }
public void gameOver() { Chartboost.cacheInterstitial(CBLocation.GameOver); Chartboost.showInterstitial(CBLocation.GameOver); Time.timeScale = 0; Canvas.SetActive(true); Value = PlayerPrefs.GetInt("Value"); PlayerPrefs.GetInt("value", Score.scoreValue); PlayerPrefs.SetInt("value", Score.scoreValue); HighScore.text = "HighScore: " + Score.scoreValue; GameObject.FindGameObjectWithTag("Inactive").SetActive(false); if (Score.scoreValue > Value) { PlayerPrefs.SetInt("value", Score.scoreValue); PlayerPrefs.SetInt("Value", Score.scoreValue); if (PlayerPrefs.GetInt("value", Score.scoreValue) == PlayerPrefs.GetInt("Value", Score.scoreValue)) { NewRecord.SetActive(true); } } else { NewRecord.SetActive(false); } }
void LayoutButtons() { // The view with buttons to trigger the main Chartboost API calls GUILayout.Space(5); GUILayout.Label("Has Interstitial: " + hasInterstitial); if (GUILayout.Button("Cache Interstitial", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.cacheInterstitial(CBLocation.Default); } if (GUILayout.Button("Show Interstitial", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.showInterstitial(CBLocation.Default); } GUILayout.Space(5); GUILayout.Label("Has Rewarded Video: " + hasRewardedVideo); if (GUILayout.Button("Cache Rewarded Video", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.cacheRewardedVideo(CBLocation.Default); } if (GUILayout.Button("Show Rewarded Video", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.showRewardedVideo(CBLocation.Default); } GUILayout.Space(5); GUILayout.Label("Post install events:"); if (GUILayout.Button("Send PIA Main Level Event", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, "Test Send mail level Information"); } if (GUILayout.Button("Send PIA Sub Level Event", GUILayout.Width(ELEMENT_WIDTH))) { Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, 2, "Test Send sub level Information"); } if (GUILayout.Button("Track IAP", GUILayout.Width(ELEMENT_WIDTH))) { TrackIAP(); } }
public override void Init() { #if CHARTBOOST if (isInit) { return; } else { isInit = true; } Debug.Log("Ads - Chartboost - Init..."); settings.isLoggingEnabled = Debug.isDebugBuild; Chartboost.didFailToLoadInterstitial += didFailToLoadInterstitial; Chartboost.didDismissInterstitial += didDismissInterstitial; Chartboost.didCloseInterstitial += didCloseInterstitial; Chartboost.didClickInterstitial += didClickInterstitial; Chartboost.didCacheInterstitial += didCacheInterstitial; Chartboost.shouldDisplayInterstitial += shouldDisplayInterstitial; Chartboost.didDisplayInterstitial += didDisplayInterstitial; Chartboost.cacheInterstitial(CBLocation.Default); #endif }
public void ShowAds(bool chartboost = true) { if (chartboost) { #if CHARTBOOST_ADS Debug.Log("show Chartboost Interstitial in " + LevelManager.THIS.gameStatus); Chartboost.showInterstitial(CBLocation.Default); Chartboost.cacheInterstitial(CBLocation.Default); #endif } else { #if GOOGLE_MOBILE_ADS Debug.Log("show Google mobile ads Interstitial in " + LevelManager.THIS.gameStatus); if (interstitial.IsLoaded()) { interstitial.Show(); #if UNITY_ANDROID interstitial = new InterstitialAd(admobUIDAndroid); #elif UNITY_IOS interstitial = new InterstitialAd(admobUIDIOS); #else interstitial = new InterstitialAd(admobUIDAndroid); #endif // Create an empty ad request. requestAdmob = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(requestAdmob); } #endif } }
void Start() { // Register callbacks for Grow Insights before initialization HighwayEvents.OnInsightsRefreshFinished += OnInsightsRefreshFinished; // Register callbacks for SOOMLA LevelUp before initialization LevelUpEvents.OnLevelEnded += OnLevelEnded; // Register callbacks for Chartboost events SetChartboostEvents(); Chartboost.cacheInterstitial(CBLocation.LevelComplete); Chartboost.cacheRewardedVideo(CBLocation.LevelComplete); // Make sure to make this call in your earliest loading scene, // and before initializing any other SOOMLA/GROW components // i.e. before SoomlaStore.Initialize(...) GrowHighway.Initialize(); GrowInsights.Initialize(); // Initialize SOOMLA Store & LevelUp // Assumes you've implemented your store assets // and an initial world with levels and missions SoomlaStore.Initialize(new YourStoreAssetsImplementation()); SoomlaLevelUp.Initialize(WORLD); }
public void ShowInterstitialChartboost() { #if UNITY_IPHONE Chartboost.showInterstitial(CBLocation.Default); Chartboost.cacheInterstitial(CBLocation.Default); #endif }
//------------------------------------------------------------ // Interstitial Ads. //------------------------------------------------------------ public void LoadInterstitialAd(AdLocation location) { #if EM_CHARTBOOST Chartboost.cacheInterstitial(location.ToChartboostLocation()); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
void Start() { delegateHistory = new List <string>(); Chartboost.setShouldPauseClickForConfirmation(ageGate); Chartboost.setAutoCacheAds(autocache); Chartboost.cacheInterstitial(CBLocation.Default); Chartboost.cacheRewardedVideo(CBLocation.Default); }
public void CBCacheInterstitial() { if (CBIsInterstitialCached()) { return; } Chartboost.cacheInterstitial("default"); }
void Start() { SetupDelegates(); Chartboost.setAutoCacheAds(true); Chartboost.setPIDataUseConsent(CBPIDataUseConsent.YesBehavioral); Chartboost.cacheInterstitial(CBLocation.Default); CheckSound(); }
// Use this for initialization void Start() { Chartboost.cacheInterstitial(CBLocation.Default); Chartboost.cacheRewardedVideo(CBLocation.MainMenu); /** Cache rewarded video pre-roll message and video ad at location Main Menu. * See /assets/chartboost/scripts/chartboost.cs for available location options. **/ Chartboost.cacheRewardedVideo(CBLocation.Default); }
// Register Chartboost events private static void SetChartboostEvents() { Chartboost.didFailToLoadInterstitial += (location, error) => { Chartboost.cacheInterstitial(location); }; Chartboost.didDismissInterstitial += location => { Chartboost.cacheInterstitial(location); }; }
private void CacheCBInterstitial(string placement) { #if CHARTBOOST cbLocation = new CBLocation(placement); if(GameUtility.Me.playerData.isRemoveAds && !placement.ToLower().Contains("free")) { MyDebug.Log(false, "AdsMCG::CacheCBInterstitial => Remove Ad purchsed"); return; } MyDebug.Log(false, "AdsMCG::CacheCBInterstitial => Caching CB Interstitial for " + placement); Chartboost.cacheInterstitial(cbLocation); #endif }
private void Start() { Chartboost.cacheInterstitial(CBLocation.Default); variableControl = 0; player = GameObject.Find("Player").GetComponent <Player>(); playerRig = player.GetComponent <Rigidbody2D>(); //floorHeigth = Mathf.Abs(player.position.y - alturaDeEdificio.transform.position.y); restartMenu.SetActive(false); }
public void Victory() { foreach (Transform t in endMenu.transform.parent) { t.gameObject.SetActive(false); } endMenu.SetActive(true); Rigidbody rigid = player.GetComponent <Rigidbody>(); rigid.constraints = RigidbodyConstraints.FreezePosition; levelDuration = Time.time - (startTime + TIME_BEFORE_START); string minutes = ((int)levelDuration / 60).ToString("00"); string seconds = (levelDuration % 60).ToString("00.00"); endTimerText.text = minutes + ":" + seconds; if (levelDuration < goldTime) { GameManager.Instance.currency += 50; endTimerText.color = Color.yellow; } else if (levelDuration < silverTime) { GameManager.Instance.currency += 25; endTimerText.color = Color.gray; } else { GameManager.Instance.currency += 10; endTimerText.color = new Color(0.8f, 0.5f, 0.2f, 1.0f); } GameManager.Instance.Save(); string saveString = ""; //"30&60&45" LevelData level = new LevelData(SceneManager.GetActiveScene().name); saveString += (level.BestTime > levelDuration || level.BestTime == 0.0f) ? levelDuration.ToString() : level.BestTime.ToString(); saveString += '&'; saveString += silverTime.ToString(); saveString += '&'; saveString += goldTime.ToString(); PlayerPrefs.SetString(SceneManager.GetActiveScene().name, saveString); Chartboost.cacheInterstitial(CBLocation.Default); if (Chartboost.hasInterstitial(CBLocation.Default)) { Chartboost.showInterstitial(CBLocation.Default); } }
public static void ShowAd() { if (PlayerPrefs.GetInt("AdsRemoved") != 1) { if (Chartboost.hasInterstitial(CBLocation.Default)) { Chartboost.showInterstitial(CBLocation.Default); Chartboost.cacheInterstitial(CBLocation.Default); } } }
private bool _IsReadyInterstitial(CBLocation location) { bool isOK = Chartboost.hasInterstitial(location); if (!isOK) { Chartboost.cacheInterstitial(location); } return(isOK); }
public void ShowGameOverInterstitial() { if (Chartboost.hasCachedInterstitial()) { Chartboost.showInterstitial(); } else { Chartboost.cacheInterstitial(); } }
public static bool isCached() { if (Chartboost.hasInterstitial(CBLocation.Default)) { Debug.Log("Arslan::Chartboost::isCached: true"); return(true); } Debug.Log("Arslan::Chartboost::isCached: false"); Chartboost.cacheInterstitial(CBLocation.Default); return(false); }
void Start() { if (num == 0) { Chartboost.cacheInterstitial(CBLocation.Default); } else { Chartboost.showInterstitial(CBLocation.Default); Chartboost.cacheInterstitial(CBLocation.Default); } }
void Start() { if (death) { Chartboost.cacheInterstitial(CBLocation.Default); } btnScript = this.GetComponent <ButtonScript>(); if (pauseObj != null) { pauseScript = pauseObj.GetComponent <ButtonScript>(); } }
// Use this for initialization public static void initialize() { if (m_isInitialize) { return; } m_isInitialize = true; getInstance().SetupDelegates(); Chartboost.setAutoCacheAds(getInstance().autocache); Chartboost.cacheInterstitial(CBLocation.Default); Debug.Log("Arslan::Chartboost::Is Initialized: " + Chartboost.isInitialized()); }
void Start() { Chartboost.init("55bb8a96c909a66315763faa", "5ee308bc8a482c70f6408d8a75a5789cad00d580", "55bb8a96c909a66315763fa9", "c70bb9fe554de9639e875dc6ccf2da3618a2517b"); ChartboostAndroid.setImpressionsUseActivities(true); Chartboost.cacheInterstitial(); Chartboost.cacheRewardedVideo(); }