//------------------------------------------------------------ // Init. //------------------------------------------------------------ public void Init(AdSettings settings) { #if EM_HEYZAP if (isInitialized) { Debug.Log("Heyzap client is already initialized. Ignoring this call."); return; } // Store a reference to the global settings. globalAdSettings = settings; // Start Heyzap with no automatic fetching since we'll handle ad loading. HeyzapAds.Start(globalAdSettings.HeyzapPublisherId, HeyzapAds.FLAG_DISABLE_AUTOMATIC_FETCHING); // Add callback handlers HZBannerAd.SetDisplayListener(BannerAdCallback); HZInterstitialAd.SetDisplayListener(InterstitialAdCallback); HZIncentivizedAd.SetDisplayListener(RewardedAdCallback); isInitialized = true; Debug.Log("Heyzap client has been initialized."); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
// Use this for initialization void Start() { selectedColor = new Color(1, 205.0f / 255, 106.0f / 255, 1); unselectColor = new Color(1, 1, 1, 0); themeBtnBg.GetComponent <Outline>().effectColor = selectedColor; achvBtnBg.GetComponent <Outline>().effectColor = unselectColor; diamongBtnBg.GetComponent <Outline>().effectColor = unselectColor; themesTab.gameObject.SetActive(true); achivementTab.gameObject.SetActive(false); diamondTab.gameObject.SetActive(false); settingPanel.gameObject.SetActive(false); rewardPanel.gameObject.SetActive(false); if (GameData.gameType == EGameType.ThemeSelection) { mainCatPanel.gameObject.SetActive(false); subCatPanel.gameObject.SetActive(true); } else { if (!mainCatPanel.gameObject.activeSelf) { mainCatPanel.gameObject.SetActive(true); subCatPanel.gameObject.SetActive(false); } } HZIncentivizedAd.SetDisplayListener(videoAdListener); HZIncentivizedAd.Fetch(); }
public override void Show(AdsElement type) { if (!AdsController.NoAds) { switch (type.type) { case AdsType.Interstitial: HZShowOptions showOptions = new HZShowOptions(); showOptions.Tag = type.name; HZInterstitialAd.ShowWithOptions(showOptions); break; case AdsType.Video: HZShowOptions showOptionsVideo = new HZShowOptions(); showOptionsVideo.Tag = type.name; HZVideoAd.ShowWithOptions(showOptionsVideo); break; case AdsType.RewardedVideo: HZIncentivizedShowOptions showOptionsReward = new HZIncentivizedShowOptions(); showOptionsReward.Tag = type.name; HZIncentivizedAd.ShowWithOptions(showOptionsReward); break; } } }
public void ShowRewarded() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } }
public void showRewardVideo() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } }
protected override void InternalInit() { #if EM_HEYZAP // Store a reference to the global settings. mGlobalAdSettings = EM_Settings.Advertising.Heyzap; // Set GPDR consent (if any) *before* starting the SDK // https://developers.heyzap.com/docs/unity_sdk_setup_and_requirements var consent = GetApplicableDataPrivacyConsent(); ApplyDataPrivacyConsent(consent); // Start Heyzap with no automatic fetching since we'll handle ad loading. HeyzapAds.Start(mGlobalAdSettings.PublisherId, HeyzapAds.FLAG_DISABLE_AUTOMATIC_FETCHING); // Add callback handlers HZBannerAd.SetDisplayListener(BannerAdCallback); HZInterstitialAd.SetDisplayListener(InterstitialAdCallback); HZIncentivizedAd.SetDisplayListener(RewardedAdCallback); HeyzapAds.SetNetworkCallbackListener(NetworkCallbackListener); mIsInitialized = true; Debug.Log("Heyzap client has been initialized."); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public void CacheRewardedVideo(string tag) { #if API_ADS_HEYZAP //Debug.Log("CacheRewardedVideo: " + tag); HZIncentivizedAd.Fetch(tag); #endif }
void FetchAds() { foreach (string tag in adsSettings.rewardAdTags) { HZIncentivizedAd.Fetch(tag); Toaster.ShowDebugToast("Fetching 'reward' ad for tag; " + tag); } //Dont fetch interstitials if NoAds is baught if (adsRemoved) { Toaster.ShowDebugToast("Not fetching other ads because 'Remove_ads' is bought."); return; } HZInterstitialAd.ChartboostFetchForLocation("Default"); foreach (string tag in adsSettings.staticAdTags) { HZInterstitialAd.Fetch(tag); Toaster.ShowDebugToast("Fetching 'static' ad for tag; " + tag); } foreach (string tag in adsSettings.videoAdTags) { HZVideoAd.Fetch(tag); Toaster.ShowDebugToast("Fetching 'video' ad for tag; " + tag); } }
// Use this for initialization void Start() { StoreEvents.OnMarketPurchase += onMarketPurchase; StoreEvents.OnUnexpectedStoreError += onUnexpectedStoreError; HZIncentivizedAd.AdDisplayListener listener = delegate(string adState, string adTag){ if (adState.Equals("incentivized_result_complete")) { // The user has watched the entire video and should be given a reward. GameData.Instance.multiRemainingGameCount += 5; GameData.Instance.rewardedGameCount += 5; GameData.Instance.Save(); } if (adState.Equals("incentivized_result_incomplete")) { // The user did not watch the entire video and should not be given a reward. } }; HZIncentivizedAd.SetDisplayListener(listener); HZIncentivizedAd.Fetch(); // if (GameData.Instance.multiRemainingGameCount <= 0) { // active = true; //// checkDailyLimitExceed (); // } else { // active = false; // } // if (StoreInventory.GetItemBalance (NumberGameAssets.NO_ADS_ITEM_ID) > 0) { // noAds.enabled = false; // noAds.GetComponentInChildren<Text>().text = "All ads removed"; // } }
static void Initialize() { string HeyzapID; switch (StudioSettings.Instance.studio) { case StudioSettings.Studio.TopGame: HeyzapID = "cde2146866f96c9ad90736c1af512e13"; break; case StudioSettings.Studio.FreeGame: HeyzapID = "ef2a0c12b6d378ddce5063ca08a660b9"; break; case StudioSettings.Studio.CrystalBuffalo: HeyzapID = "70a2f87d4c05ba041dada7f272651dba"; break; case StudioSettings.Studio.SurvivalGame: HeyzapID = "9dff8b4f221dbad7cbbeeb52b2fc6125"; break; default: HeyzapID = "cde2146866f96c9ad90736c1af512e13"; break; } // TO DO: Something needs to be done to initialize Heyzap! // It is no longer in the launch controller. HeyzapAds.Start(HeyzapID, HeyzapAds.FLAG_NO_OPTIONS); HZVideoAd.Fetch(); HZIncentivizedAd.Fetch(); }
public void IsAvailableButton() { string tag = this.adTag(); bool available = false; switch (this.SelectedAdType) { case AdType.Interstitial: available = HZInterstitialAd.IsAvailable(tag); break; case AdType.Video: available = HZVideoAd.IsAvailable(tag); break; case AdType.Incentivized: available = HZIncentivizedAd.IsAvailable(tag); break; case AdType.Banner: // Not applicable break; case AdType.Offerwall: available = HZOfferWallAd.IsAvailable(tag); break; } string availabilityMessage = available ? "available" : "not available"; this.console.Append(this.SelectedAdType.ToString() + " with tag: " + tag + " is " + availabilityMessage); }
public void showHZRewardedAdVideos() { // if (GameData.Instance.multiRemainingGameCount <= 0) { // if (GameData.Instance.rewardedGameCount >= GameData.Instance.dailyLimit * 5) { // requestUTCTimeFromServer (); // GameData.Instance.rewardedGameCount = 0; // GameData.Instance.Save (); // // string message = "Unfortunately your credit limit exeeded. 4 hours later you can gain credit watching rewarded videos. You can gain more credits by purchasing game packages from the shopping list"; // dialogueManager = DialogueManager.Instance (); // dialogueManager.showDialog ("Info",message, 0); // return; // } if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } HZIncentivizedAd.Fetch(); // } else { // string message = "Please try again when your credit runs out. In case of no credits left you can gain again"; // dialogueManager = DialogueManager.Instance (); // dialogueManager.showDialog ("Info",message, 0); // } }
public bool IsRewardedAdReady(AdLocation location) { #if EM_HEYZAP return(HZIncentivizedAd.IsAvailable()); #else return(false); #endif }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_HEYZAP HZIncentivizedAd.Fetch(); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public static void initReceiver() { if (_instance == null) { GameObject receiverObject = new GameObject("HZIncentivizedAd"); DontDestroyOnLoad(receiverObject); _instance = receiverObject.AddComponent<HZIncentivizedAd>(); } }
/// <summary> /// Show Heyzap rewarded video /// </summary> /// <param name="CompleteMethod">callback called when user closes the rewarded video -> if true, video was not skipped</param> public void ShowRewardVideo(UnityAction <bool, string> CompleteMethod) { if (HZIncentivizedAd.IsAvailable()) { OnCompleteMethodWithAdvertiser = CompleteMethod; HZIncentivizedAd.Show(); } }
/// <summary> /// Show Heyzap rewarded video /// </summary> /// <param name="CompleteMethod">callback called when user closes the rewarded video -> if true, video was not skipped</param> public void ShowRewardVideo(UnityAction <bool> CompleteMethod) { if (HZIncentivizedAd.IsAvailable()) { OnCompleteMethod = CompleteMethod; HZIncentivizedAd.Show(); } }
public void RewardVideo() { Main.Instance.PlayButtonSound(); if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } }
protected override void CreateEventListeners() { #if API_ADS_HEYZAP HZBannerAd.SetDisplayListener(OnBannerStateUpdate); HZInterstitialAd.SetDisplayListener(OnInterstitialStateUpdate); HZVideoAd.SetDisplayListener(OnInterstitialStateUpdate); HZIncentivizedAd.SetDisplayListener(OnIncentivizedStateUpdate); #endif }
public void showVideoAd() { if (HZIncentivizedAd.isAvailable()) { HZIncentivizedAd.show(); HZIncentivizedAd.setDisplayListener(listener); } }
protected override void RemoveEventListeners() { #if API_ADS_HEYZAP HZBannerAd.SetDisplayListener(null); HZInterstitialAd.SetDisplayListener(null); HZVideoAd.SetDisplayListener(null); HZIncentivizedAd.SetDisplayListener(null); #endif }
// void queryInventorySucceededEvent( List<GooglePurchase> purchases, List<GoogleSkuInfo> skus ) // { // Debug.Log( string.Format( "queryInventorySucceededEvent. total purchases: {0}, total skus: {1}", purchases.Count, skus.Count ) ); // Prime31.Utils.logObject( purchases ); // Prime31.Utils.logObject( skus ); // for(int i = 0; i < purchases.Count; i++) // { // Debug.Log("Order id = " + purchases[i].productId +" State = "+ purchases[i].purchaseState); // if(purchases[i].purchaseState == GooglePurchase.GooglePurchaseState.Purchased) // { // //Can Restore purchse // Debug.Log("Can Restore purchse"); // canRestored = true; // } // } // // } // // // void queryInventoryFailedEvent( string error ) // { // Debug.Log( "queryInventoryFailedEvent: " + error ); // } // // void purchaseSucceededEvent( GooglePurchase purchase ) // { // Debug.Log( "purchaseSucceededEvent: " + purchase ); // if(purchase.productId == Constants.PRODUCT_ID) // { // Debug.Log("No ads purchased"); // HZBannerAd.hide(); // Main.Instance.isNoAdsPurchased = true; // PlayerPrefs.SetBool(Constants.KEY_NOADS, Main.Instance.isNoAdsPurchased); // PlayerPrefs.Flush(); // // // if(isRestoring) // { // #if UNITY_ANDROID // EtceteraAndroid.showAlert("Purchase Restored", "Ads removed", "Ok"); // #elif UNITY_IPHONE // CreateAlertForRestore("Purchase Restored","Ads removed", "Ok"); // #endif // // } // // if(Main.Instance.isNoAdsPurchased) // { // if(noAddButtonHome != null) // { // noAddButtonHome.interactable = false; // } // } // // if(Main.Instance.isNoAdsPurchased) // { // if(noAddButtonGameOver != null) // { // noAddButtonGameOver.interactable = false; // } // } // } // // // } #endif #endregion #region Reward Video public void ShowRewardVideo() { if (HZIncentivizedAd.isAvailable()) { GameData.isFreeGift = true; Main.Instance.MuteSounds(); HZIncentivizedAd.show(); } }
public static void initReceiver() { if (_instance == null) { GameObject receiverObject = new GameObject("HZIncentivizedAd"); DontDestroyOnLoad(receiverObject); _instance = receiverObject.AddComponent <HZIncentivizedAd>(); } }
public void GetShards() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); PlayerPrefs.SetInt("currentShards", PlayerPrefs.GetInt("currentShards") + 5); MoreShards.SetActive(false); MapPanel.SetActive(true); } }
public void ShowRewardedVideo(string tag) { #if API_ADS_HEYZAP HZIncentivizedShowOptions options = new HZIncentivizedShowOptions(); options.Tag = tag; HZIncentivizedAd.ShowWithOptions(options); HZIncentivizedAd.Fetch(tag); #endif }
// Use this for initialization void Start() { HeyzapAds.Start("f62dff4e4bbf49a67e29252338b6d0d7", HeyzapAds.FLAG_NO_OPTIONS); HZIncentivizedAd.Fetch(); fpsPlayerRef.GetComponent <FPSPlayer>(); fpsPlayerTransform = fpsPlayerRef.GetComponent <Transform>(); originalPosition = fpsPlayerTransform.position; originalRotation = fpsPlayerTransform.rotation; weapons.GetComponent <PlayerWeapons> (); }
private static bool PlayHeyzapIncentivizedAd() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); HZIncentivizedAd.Fetch(); return(true); } return(false); }
void Start() { mapButtonClicked = false; bestTimeVariable = "bestTimeLevel9"; currentShardsForLevelVariable = "currentShardsForLevel9"; currentMapVariable = "mapLevel9"; currentLevel = 9; HeyzapAds.Start("3a045a04722e168baefdd3eeff198305", HeyzapAds.FLAG_NO_OPTIONS); HZVideoAd.Fetch(); HZIncentivizedAd.Fetch(); map = new int[6, 6] { { 4, 2, 2, 3, 2, 4 }, { 2, 2, 3, 2, 1, 2 }, { 3, 2, 1, 4, 2, 2 }, { 2, 1, 2, 3, 2, 3 }, { 4, 3, 2, 3, 2, 3 }, { 2, 2, 2, 4, 2, 2 } }; rotations = new int[6, 6] { { 1, 1, 0, 0, 1, 2 }, { 0, 2, 1, 0, 3, 2 }, { 1, 0, 2, 0, 0, 1 }, { 3, 2, 3, 0, 2, 1 }, { 2, 1, 0, 0, 1, 1 }, { 3, 2, 3, 3, 3, 2 } }; MazeGenerator.instance.mazeGenerator(map, rotations, 6); Ball.transform.position = start; Ball.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); Ball.SetActive(true); Instantiate(FinishParticleSystem, finish, Quaternion.identity); if (!PlayerPrefs.HasKey(currentShardsForLevelVariable)) { PlayerPrefs.SetInt(currentShardsForLevelVariable, 0); } currentSpawnsLeft = 3 - PlayerPrefs.GetInt(currentShardsForLevelVariable); while (currentSpawnsLeft > 0) { int randX = Random.Range(0, 6); int randZ = Random.Range(0, 6); float Shardx = (float)randX + 0.05f; float Shardy = (float)randZ + 0.05f; if (Shardx != start.x && Shardx != finish.x && Shardy != start.z && Shardy != finish.z) { Instantiate(Shard, new Vector3((float)randX, 0.15f, (float)randZ), Quaternion.identity); currentSpawnsLeft--; } } if (!PlayerPrefs.HasKey(bestTimeVariable)) { bestTimeScore.text = "00:00"; } else { bestTimeScore.text = ((int)(PlayerPrefs.GetFloat(bestTimeVariable) / 60f)).ToString("00") + ":" + ((int)(PlayerPrefs.GetFloat(bestTimeVariable) % 60f)).ToString("00"); } currentTime = 0f; shardsText.text = PlayerPrefs.GetInt("currentShards").ToString(); currentTimeText.text = ""; currentTimeScore.text = ""; bestTimeScore.text = ""; timeString = ""; gameOver = false; }
public void ContinueYES() { isReviveBreaked = true; CancelInvoke("CntDown"); StopCoroutine(Timer()); Main.Instance.PlayButtonClickSound(); if (HZIncentivizedAd.isAvailable()) { HZIncentivizedAd.Show(); } }
public void Die() { if (!isRevived && HZIncentivizedAd.isAvailable()) { // Debug.Log("Set revive"); SetState(BirdState.WaitForRevive); } else { SetState(BirdState.Died); } }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ protected override void InternalLoadRewardedAd(AdPlacement placement) { #if EM_HEYZAP if (placement == AdPlacement.Default) { HZIncentivizedAd.Fetch(); } else { HZIncentivizedAd.Fetch(ToHeyzapAdTag(placement)); } #endif }