Пример #1
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);
            }
        }
Пример #2
0
        public void CacheInterstitial(string tag)
        {
                        #if API_ADS_HEYZAP
//			Debug.Log("CacheInterstitial: " + tag);
            HZInterstitialAd.Fetch(tag);
                        #endif
        }
Пример #3
0
        //------------------------------------------------------------
        // Interstitial Ads.
        //------------------------------------------------------------

        public void LoadInterstitialAd(AdLocation location)
        {
            #if EM_HEYZAP
            HZInterstitialAd.Fetch();
            #else
            Debug.LogError(NO_SDK_MESSAGE);
            #endif
        }
 public void heyzapShow()
 {
     if (PlayerPrefs.GetInt("Removeads", 0) == 0)
     {
             #if !UNITY_EDITOR
         HZInterstitialAd.Show();
         HZInterstitialAd.Fetch();
             #endif
     }
 }
    //heyzap

    public void InitHeyzap()
    {
        if (PlayerPrefs.GetInt("Removeads", 0) == 0)
        {
                #if !UNITY_EDITOR
            HeyzapAds.Start(heyzapAD, HeyzapAds.FLAG_NO_OPTIONS);
            HZInterstitialAd.Fetch();
                #endif
        }
    }
Пример #6
0
        public void ShowIntersitital(string tag)
        {
                        #if API_ADS_HEYZAP
            HZShowOptions options = new HZShowOptions();
            options.Tag = tag;

            HZInterstitialAd.ShowWithOptions(options);
            HZInterstitialAd.Fetch(tag);                // TODO: do we really need this?
                        #endif
        }
Пример #7
0
    IEnumerator AdCache(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        HZInterstitialAd.Fetch();
        if (Random.Range(0, 10) >= 2)
        {
            HZVideoAd.Fetch();
        }
    }
Пример #8
0
        //------------------------------------------------------------
        // Interstitial Ads.
        //------------------------------------------------------------

        protected override void InternalLoadInterstitialAd(AdPlacement placement)
        {
            #if EM_HEYZAP
            if (placement == AdPlacement.Default)
            {
                HZInterstitialAd.Fetch();
            }
            else
            {
                HZInterstitialAd.Fetch(ToHeyzapAdTag(placement));
            }
            #endif
        }
Пример #9
0
        /// <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);
    }
Пример #11
0
    void Start()
    {
        Application.targetFrameRate = 60;

        Time.timeScale       = 1;
        AudioListener.volume = 1;

        HeyzapAds.Start("e75a46b975f6cb4a120ac6c5fe89e2c6", HeyzapAds.FLAG_DISABLE_AUTOMATIC_FETCHING);
        HZInterstitialAd.Fetch();

        if (Random.Range(0, 10) >= 2)
        {
            HZVideoAd.Fetch();
        }
    }
Пример #12
0
    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;
        }
    }
Пример #13
0
    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;
            }
        }
    }
Пример #14
0
        /// <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);
        }
Пример #15
0
 void FetchAdMainMenu()
 {
     HZInterstitialAd.Fetch("MainMenu");
 }
Пример #16
0
 void FetchAdGameOver()
 {
     HZInterstitialAd.Fetch("GameOver");
 }