private void requestNativeBannerAd(string zone) { Tapsell.requestNativeBannerAd(this, zone, (TapsellNativeBannerAd result) => { // onAdAvailable Debug.Log("Action: onNativeRequestFilled"); Test.nativeAd = result; }, (string zoneId) => { // onNoAdAvailable Debug.Log("No Ad Available"); }, (TapsellError error) => { // onError Debug.Log(error.error); }, (string zoneId) => { // onNoNetwork Debug.Log("No Network: " + zoneId); } ); }
public void Request() { Tapsell.RequestNativeBannerAd(this, ZONE_ID, (TapsellNativeBannerAd result) => { // onAdAvailable Debug.Log("on Ad Available"); nativeAd = result; }, (string zoneId) => { // onNoAdAvailable Debug.Log("no Ad Available"); }, (TapsellError error) => { // onError Debug.Log(error.message); }, (string zoneId) => { // onNoNetwork Debug.Log("no Network"); } ); }
public void GetNative() { AdButton.gameObject.SetActive(false); _nativeAd = null; Tapsell.requestNativeBannerAd(this, _zoneId, (TapsellNativeBannerAd result) => { // onRequestFilled _nativeAd = result; // store this to show the ad later OnAdReady.Invoke(); AdButton.gameObject.SetActive(true); SetAdVisual(); }, (string zoneId) => { // onNoAdAvailable }, (TapsellError error) => { // onError }, (string zoneId) => { // onNoNetwork } ); }
public void notifyNativeRequestResponse(String body) { TapsellNativeBannerAd result = new TapsellNativeBannerAd(); result = JsonUtility.FromJson <TapsellNativeBannerAd> (body); Debug.Log("notifyNativeRequestResponse:" + result.zoneId); TapsellPlus.onNativeRequestResponse(result); }
public void NotifyNativeBannerFilled(String body) { TapsellNativeBannerAd result = new TapsellNativeBannerAd(); result = JsonUtility.FromJson <TapsellNativeBannerAd> (body); Debug.Log("notifyNativeBannerFilled:" + result.zoneId + ":" + result.adId); Tapsell.OnNativeBannerFilled(result); }
public void Request() { TapsellPlus.requestNativeBanner(this, ZONE_ID, (TapsellNativeBannerAd result) => { Debug.Log("on response"); NativeBannerScene.nativeAd = result; }, (TapsellError error) => { Debug.Log("Error " + error.message); } ); }
public void SetVisual(TapsellNativeBannerAd nativeAd, Action getNative) { float range = Random.Range(0f, 1f); if (range > chance) { return; } gameObject.SetActive(true); if (Title != null) { Title.text = PersianFixer.Fix(nativeAd.getTitle(), true, true); } if (Description != null) { Description.text = PersianFixer.Fix(nativeAd.getDescription()); } if (Content != null) { Content.text = PersianFixer.Fix(nativeAd.getCallToAction()); } if (VerticalImage != null) { VerticalImage.sprite = TextureToSprite(nativeAd.getPortraitBannerImage()); } if (HorizentalImage != null) { HorizentalImage.sprite = TextureToSprite(nativeAd.getLandscapeBannerImage()); } if (Icon != null) { Icon.sprite = TextureToSprite(nativeAd.getIcon()); } gameObject.SetActive(true); nativeAd.onShown(); AdButton.onClick.RemoveAllListeners(); AdButton.onClick.AddListener(() => { getNative.Invoke(); nativeAd.onClicked(); }); }
public void NotifyNativeBannerRequestFilled(String str) { debugLog("NotifyNativeBannerRequestFilled:" + str); JSONNode node = JSON.Parse(str); TapsellNativeBannerAd result = new TapsellNativeBannerAd(); result.adId = node ["adId"].Value; result.zoneId = node ["zoneId"].Value; result.title = node ["title"].Value; result.description = node ["description"].Value; result.iconUrl = node ["iconUrl"].Value; result.callToActionText = node ["callToActionText"].Value; result.portraitStaticImageUrl = node ["portraitStaticImageUrl"].Value; result.landscapeStaticImageUrl = node ["landscapeStaticImageUrl"].Value; Tapsell.onNativeBannerRequestFilled(result); }
// Use this for initialization public void GetNative() { Action request = () => { Invoke(nameof(GetNative), 1f); }; Buttons.ForEach(b => b.gameObject.SetActive(false)); _nativeAd = null; Tapsell.requestNativeBannerAd(this, _zoneId, (result) => { // onRequestFilled if (result.landscapeBannerImage == null) { Invoke(nameof(GetNative), 1f); return; } _nativeAd = result; // store this to show the ad later OnAdReady.Invoke(); foreach (NativeAdButton button in Buttons) { button.SetVisual(_nativeAd, request); } }, (string zoneId) => { // onNoAdAvailable }, (TapsellError error) => { // onError }, (string zoneId) => { // onNoNetwork } ); }