Beispiel #1
0
    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);
    }
Beispiel #2
0
    public void ShowButton()
    {
        string tag = this.adTag();

        HZShowOptions showOptions = new HZShowOptions();

        showOptions.Tag = tag;

        HZIncentivizedShowOptions incentivizedOptions = new HZIncentivizedShowOptions();

        incentivizedOptions.Tag = tag;
        incentivizedOptions.IncentivizedInfo = "test app incentivized info!";

        HZBannerShowOptions bannerOptions = new HZBannerShowOptions();

        bannerOptions.Tag      = tag;
        bannerOptions.Position = this.bannerPosition;

        HZOfferWallShowOptions offerwallOptions = new HZOfferWallShowOptions();

        offerwallOptions.ShouldCloseAfterFirstClick = offerwallCloseOnFirstClickToggle.isOn;
        offerwallOptions.Tag = tag;

        this.console.Append("Showing " + this.SelectedAdType.ToString() + " with tag: " + tag);
        switch (this.SelectedAdType)
        {
        case AdType.Interstitial:
            HZInterstitialAd.ShowWithOptions(showOptions);
            break;

        case AdType.Video:
            HZVideoAd.ShowWithOptions(showOptions);
            break;

        case AdType.Incentivized:
            HZIncentivizedAd.ShowWithOptions(incentivizedOptions);
            break;

        case AdType.Banner:
            HZBannerAd.ShowWithOptions(bannerOptions);
            break;

        case AdType.Offerwall:
            HZOfferWallAd.ShowWithOptions(offerwallOptions);
            break;
        }
    }
Beispiel #3
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;

        case AdType.Offerwall:
            HZOfferWallAd.Fetch(tag);
            break;
        }
    }
Beispiel #4
0
    void Start()
    {
        HeyzapAds.NetworkCallbackListener networkCallbackListener = delegate(string network, string callback) {
            this.console.Append("[" + network + "]: " + callback);
        };

        // HZDemographics.SetUserGender(HZDemographics.Gender.MALE);
        // HZDemographics.SetUserPostalCode("94103");
        // HZDemographics.SetUserHouseholdIncome(100000);
        // HZDemographics.SetUserMaritalStatus(HZDemographics.MaritalStatus.SINGLE);
        // HZDemographics.SetUserEducationLevel(HZDemographics.EducationLevel.BACHELORS_DEGREE);
        // HZDemographics.SetUserBirthDate("1990-08-05");

        // UnityEngine.Debug.Log ("calling loc service");
        // TestLocationService locServ = new TestLocationService();
        // locServ.Start(this.console);

        HeyzapAds.SetNetworkCallbackListener(networkCallbackListener);
        HeyzapAds.ShowDebugLogs();
        HeyzapAds.Start("ENTER_YOUR_PUBLISHER_ID_HERE", HeyzapAds.FLAG_NO_OPTIONS);

        HZBannerAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("BANNER: " + adState + " Tag : " + adTag);
            if (adState == "loaded")
            {
                Rect dimensions = new Rect();
                HZBannerAd.GetCurrentBannerDimensions(out dimensions);
                this.console.Append(string.Format("    (x,y): ({0},{1}) - WxH: {2}x{3}", dimensions.x, dimensions.y, dimensions.width, dimensions.height));
            }
        });

        HZInterstitialAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("INTERSTITIAL: " + adState + " Tag : " + adTag);
        });

        HZIncentivizedAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("INCENTIVIZED: " + adState + " Tag : " + adTag);
        });

        HZVideoAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("VIDEO: " + adState + " Tag : " + adTag);
        });

        HZOfferWallAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("OFFERWALL: " + adState + " Tag : " + adTag);
        });

        HZOfferWallAd.SetVirtualCurrencyResponseListener(delegate(VirtualCurrencyResponse response) {
            this.console.Append("OFFERWALL VCS Response: id:" + response.CurrencyID + " name: '" + response.CurrencyName + "' amount : " + response.DeltaOfCurrency + " trans: " + response.LatestTransactionID);
        });

        HZOfferWallAd.SetVirtualCurrencyErrorListener(delegate(string errorMsg) {
            this.console.Append("OFFERWALL VCS Error: " + errorMsg);
        });

        // UI defaults
        this.bannerPosition = HZBannerShowOptions.POSITION_TOP;
        this.SelectedAdType = AdType.Interstitial;

        this.ShowAdTypeControls();
    }
Beispiel #5
0
 public void VCSRequestButton()
 {
     HZOfferWallAd.RequestDeltaOfCurrency(this.currencyId());
 }