public void CacheRewardedVideo(string tag) { #if API_ADS_HEYZAP //Debug.Log("CacheRewardedVideo: " + tag); HZIncentivizedAd.Fetch(tag); #endif }
// 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 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); // } }
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() { 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(); }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ public void LoadRewardedAd(AdLocation location) { #if EM_HEYZAP HZIncentivizedAd.Fetch(); #else Debug.LogError(NO_SDK_MESSAGE); #endif }
public void ShowRewardedVideo(string tag) { #if API_ADS_HEYZAP HZIncentivizedShowOptions options = new HZIncentivizedShowOptions(); options.Tag = tag; HZIncentivizedAd.ShowWithOptions(options); HZIncentivizedAd.Fetch(tag); #endif }
private static bool PlayHeyzapIncentivizedAd() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); HZIncentivizedAd.Fetch(); return(true); } return(false); }
// 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> (); }
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; }
//------------------------------------------------------------ // Rewarded Ads. //------------------------------------------------------------ protected override void InternalLoadRewardedAd(AdPlacement placement) { #if EM_HEYZAP if (placement == AdPlacement.Default) { HZIncentivizedAd.Fetch(); } else { HZIncentivizedAd.Fetch(ToHeyzapAdTag(placement)); } #endif }
public void ShowIncentivezedAds() { if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); ShowIncentiveAds(); } else { HZIncentivizedAd.Fetch(); UnityAdsController.instance.ShowUnityRewardedAd(); } }
// Use this for initialization void Start() { // Your Publisher ID is: 7e4482c1be37901e95ec6b42c8e14e21 HeyzapAds.Start("7e4482c1be37901e95ec6b42c8e14e21", HeyzapAds.FLAG_NO_OPTIONS); HeyzapAds.ShowDebugLogs(); HeyzapAds.ShowThirdPartyDebugLogs(); HZVideoAd.Fetch(); HZIncentivizedAd.Fetch(); bannerShowing = false; }
/// <summary> /// Initializing Heyzap /// </summary> /// <param name="consent">user consent -> if true show personalized ads</param> /// <param name="platformSettings">contains all required settings for this publisher</param> public void InitializeAds(GDPRConsent consent, List <PlatformSettings> platformSettings) { debug = Advertisements.Instance.debug; //get settings #if UNITY_ANDROID PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.Android); #endif #if UNITY_IOS PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.iOS); #endif //apply settings publisherId = settings.appId.id; //verify settings if (debug) { Debug.Log(this + " Initialization Started"); ScreenWriter.Write(this + " Initialization Started"); Debug.Log(this + " Publisher ID: " + publisherId); ScreenWriter.Write(this + " Publisher ID: " + publisherId); } AdListeners(); //preparing Heyzap SDK for initialization if (consent == GDPRConsent.Accept || consent == GDPRConsent.Unset) { HeyzapAds.SetGdprConsent(true); } else { HeyzapAds.SetGdprConsent(false); } if (settings.directedForChildren == true) { HeyzapAds.Start(publisherId, HeyzapAds.FLAG_CHILD_DIRECTED_ADS); } else { HeyzapAds.Start(publisherId, HeyzapAds.FLAG_NO_OPTIONS); } //start loading ads HZInterstitialAd.Fetch(); HZIncentivizedAd.Fetch(); //HeyzapAds.ShowMediationTestSuite(); }
// Use this for initialization void Start() { IsRewardedVideoReady = false; VideoAdCointer = 0; HeyzapAds.Start("70d6db5109295d28b9ab83165d3fa95c", HeyzapAds.FLAG_NO_OPTIONS); // HeyzapAds.ShowMediationTestSuite(); // Interstitial ads are automatically fetched HZInterstitialAd.Fetch("app-launch"); HZVideoAd.Fetch("video"); HZIncentivizedAd.Fetch("rewarded"); 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. GameEvents.Send(GiveReward); } if (adState.Equals("incentivized_result_incomplete")) { // The user did not watch the entire video and should not be given a reward. } if (adState.Equals("hide")) { // Sent when an ad has been removed from view. // This is a good place to unpause your app, if applicable. Defs.MuteSounds(false); } if (adState.Equals("available")) { IsRewardedVideoReady = true; // Sent when an ad has been loaded and is ready to be displayed, // either because we autofetched an ad or because you called // `Fetch`. } }; HZIncentivizedAd.SetDisplayListener(listener); HZVideoAd.AdDisplayListener listenerVideo = delegate(string adState, string adTag){ if (adState.Equals("hide")) { // Sent when an ad has been removed from view. // This is a good place to unpause your app, if applicable. Defs.MuteSounds(false); } }; HZVideoAd.SetDisplayListener(listenerVideo); }
public void ShowIncentivezedAd() { if (HZIncentivizedAd.IsAvailable() && AdChecker) { AdChecker = false; HZIncentivizedAd.Show(); } else if (AdChecker) { AdChecker = false; HZIncentivizedAd.Fetch(); UnityAdsController.instance.ShowUnityRewardedAd(); } ShowIncentiveAds(); }
void GameStarted() { HZIncentivizedAd.Fetch(); // if(!Main.Instance.isNoads) // { // HZBannerShowOptions showOptions = new HZBannerShowOptions(); // showOptions.Position = HZBannerShowOptions.POSITION_TOP; // HZBannerAd.ShowWithOptions(showOptions); // } homePanel.gameObject.SetActive(false); gameOverPanel.gameObject.SetActive(false); gameHintPanel.gameObject.SetActive(true); tutorialPanel.gameObject.SetActive(false); inGamePanel.gameObject.SetActive(true); Invoke("RemoveHints", 1.5f); }
void Start() { HeyzapAds.Start("3a045a04722e168baefdd3eeff198305", HeyzapAds.FLAG_NO_OPTIONS); HZVideoAd.Fetch(); HZIncentivizedAd.Fetch(); HZIncentivizedAd.AdDisplayListener listener = delegate(string adState, string adTag) { if (adState.Equals("incentivized_result_complete")) { PlayerPrefs.SetInt("currentShards", PlayerPrefs.GetInt("currentShards") + 10); } if (adState.Equals("incentivized_result_incomplete")) { //Don give him/her shards } }; HZIncentivizedAd.SetDisplayListener(listener); }
public void RewardedWepSlot(int slot) { #if UNITY_EDITOR saveData.AwardSlot(slot); #endif #if UNITY_ANDROID if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); Analytics.CustomEvent("SlotVideo"); saveData.AwardSlot(slot); } HZIncentivizedAd.Fetch(); #endif }
public void FetchButton() { string tag = this.adTag(); this.console.Append("Fetching " + this.SelectedAdType.ToString() + " with tag: " + tag); switch (this.SelectedAdType) { case AdType.Interstitial: HZInterstitialAd.Fetch(tag); break; case AdType.Video: HZVideoAd.Fetch(tag); break; case AdType.Incentivized: HZIncentivizedAd.Fetch(tag); break; } }
public void showHZAdVideos() { googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("game_action") .SetEventAction("heyzap_advideos") .SetEventLabel("video")); if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } HZIncentivizedAd.Fetch(); // // Later, such as after a level is completed // if (HZVideoAd.IsAvailable()) { // HZVideoAd.Show(); // HZVideoAd.Fetch(); // } }
public void RewardedAmmo() { #if UNITY_EDITOR weapons.giveAmmo(weapons.weaponToAddAmmo); pause.DeactivateAmmoCanvas(); fpsPlayerRef.ActivateADShield(3.0f); #endif #if UNITY_ANDROID if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); weapons.giveAmmo(weapons.weaponToAddAmmo); Analytics.CustomEvent("AmmoVideo"); pause.DeactivateAmmoCanvas(); fpsPlayerRef.ActivateADShield(3.0f); HZIncentivizedAd.Fetch(); } #endif }
public void Rewarded() { #if UNITY_EDITOR fpsPlayerRef.hitPoints = fpsPlayerRef.maximumHitPoints; fpsPlayerRef.UpdateHPBar(); fpsPlayerRef.invulnerable = true; if (resetPositionInDeath) { fpsPlayerTransform.position = originalPosition; fpsPlayerTransform.rotation = originalRotation; resetPositionInDeath = false; } pause.DeactivateDeathCanvas(); fpsPlayerRef.RemoveInvulnerability(); fpsPlayerRef.ActivateADShield(5.0f); #endif #if UNITY_ANDROID if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); fpsPlayerRef.invulnerable = true; fpsPlayerRef.hitPoints = fpsPlayerRef.maximumHitPoints; fpsPlayerRef.UpdateHPBar(); Analytics.CustomEvent("DeathVideo"); if (resetPositionInDeath) { fpsPlayerTransform.position = originalPosition; fpsPlayerTransform.rotation = originalRotation; resetPositionInDeath = false; } pause.DeactivateDeathCanvas(); fpsPlayerRef.RemoveInvulnerability(); fpsPlayerRef.ActivateADShield(5.0f); HZIncentivizedAd.Fetch(); } #endif }
private void ShowIncentiveAds() { HZIncentivizedAd.AdDisplayListener listener = delegate(string adState, string adTag) { if (adState.Equals("fetch_failed")) { //TELL USER TO CHECK CONNECTION HZIncentivizedAd.Fetch(); } if (adState.Equals("incentivized_result_complete")) { // Give reward to the player RewardToPlayer(); HZIncentivizedAd.Fetch(); } if (adState.Equals("incentivized_result_incomplete")) { // The user did not watch the entire video and should not be given a reward. HZIncentivizedAd.Fetch(); } }; HZIncentivizedAd.SetDisplayListener(listener); }
public override void FetchAds(AdsElement type) { if (!AdsController.NoAds) { switch (type.type) { case AdsType.Banner: break; case AdsType.Interstitial: HZInterstitialAd.Fetch(type.name); break; case AdsType.Video: HZVideoAd.Fetch(type.name); break; case AdsType.RewardedVideo: HZIncentivizedAd.Fetch(type.name); break; } } }
public void FetchRewardedAd() { HZIncentivizedAd.Fetch(); }
// Use this for initialization void Start() { HZIncentivizedAd.Fetch(); }
/// <summary> /// Ads all Heyzap SDK listeners /// </summary> private void AdListeners() { if (debug) { Debug.Log(this + " add listeners"); ScreenWriter.Write(this + " add listeners"); } HZInterstitialAd.AdDisplayListener listener = delegate(string adState, string adTag) { if (adState.Equals("show")) { if (debug) { Debug.Log(this + " show event triggered"); ScreenWriter.Write(this + " show event triggered interstitial"); } } if (adState.Equals("hide")) { if (debug) { Debug.Log(this + " hide event triggered"); ScreenWriter.Write(this + " hide event triggered interstitial"); } if (OnInterstitialClosed != null) { OnInterstitialClosed(); OnInterstitialClosed = null; } if (OnInterstitialClosedWithAdvertiser != null) { OnInterstitialClosedWithAdvertiser(SupportedAdvertisers.Heyzap.ToString()); OnInterstitialClosedWithAdvertiser = null; } HZInterstitialAd.Fetch(); } if (adState.Equals("failed")) { if (debug) { Debug.Log(this + " failed event triggered"); ScreenWriter.Write(this + " failed event triggered interstitial"); } } if (adState.Equals("available")) { if (debug) { Debug.Log(this + " available event triggered"); ScreenWriter.Write(this + " available event triggered interstitial"); } } if (adState.Equals("fetch_failed")) { if (debug) { Debug.Log(this + " fetch_failed event triggered"); ScreenWriter.Write(this + " fetch_failed event triggered interstitial"); } } }; HZIncentivizedAd.AdDisplayListener listenerRewarded = delegate(string adState, string adTag) { if (adState.Equals("show")) { if (debug) { Debug.Log(this + " show event triggered rewarded"); ScreenWriter.Write(this + " show event triggered rewarded"); } } if (adState.Equals("hide")) { if (debug) { Debug.Log(this + " hide event triggered rewarded"); ScreenWriter.Write(this + " hide event triggered rewarded"); } HZIncentivizedAd.Fetch(); } if (adState.Equals("failed")) { if (debug) { Debug.Log(this + " failed event triggered rewarded"); ScreenWriter.Write(this + " failed event triggered rewarded"); } } if (adState.Equals("available")) { if (debug) { Debug.Log(this + " available event triggered rewarded"); ScreenWriter.Write(this + " available event triggered rewarded"); } } if (adState.Equals("fetch_failed")) { if (debug) { Debug.Log(this + " fetch_failed event triggered rewarded"); ScreenWriter.Write(this + " fetch_failed event triggered rewarded"); } } if (adState.Equals("incentivized_result_complete")) { if (OnCompleteMethod != null) { OnCompleteMethod(true); OnCompleteMethod = null; } if (OnCompleteMethodWithAdvertiser != null) { OnCompleteMethodWithAdvertiser(true, SupportedAdvertisers.Heyzap.ToString()); OnCompleteMethodWithAdvertiser = null; } } if (adState.Equals("incentivized_result_incomplete")) { if (OnCompleteMethod != null) { OnCompleteMethod(false); OnCompleteMethod = null; } if (OnCompleteMethodWithAdvertiser != null) { OnCompleteMethodWithAdvertiser(false, SupportedAdvertisers.Heyzap.ToString()); OnCompleteMethodWithAdvertiser = null; } } }; HZBannerAd.AdDisplayListener listenerBanner = delegate(string adState, string adTag) { if (debug) { Debug.Log(this + " " + adState + " " + adTag); ScreenWriter.Write(this + " " + adState + " " + adTag); } if (adState == "loaded") { if (debug) { Debug.Log(this + " loaded event triggered banner"); ScreenWriter.Write(this + " loaded event triggered banner"); } if (DisplayResult != null) { DisplayResult(true, position, bannerType); DisplayResult = null; } } if (adState == "error") { if (debug) { Debug.Log(this + " error event triggered banner"); ScreenWriter.Write(this + " error event triggered banner"); } if (DisplayResult != null) { DisplayResult(false, position, bannerType); DisplayResult = null; } } if (adState == "click") { if (debug) { Debug.Log(this + " click event triggered banner"); ScreenWriter.Write(this + " click event triggered banner"); } } }; HZInterstitialAd.SetDisplayListener(listener); HZIncentivizedAd.SetDisplayListener(listenerRewarded); HZBannerAd.SetDisplayListener(listenerBanner); }
// Use this for initialization void Start() { HeyzapAds.Start("ecef46611330f64b1c88df6f89c05b63", HeyzapAds.FLAG_NO_OPTIONS); HZVideoAd.Fetch(); HZIncentivizedAd.Fetch(); }