public void onCustomClick(AndroidJavaObject ad, string assetName) { CustomNativeTemplateAd nativeAd = new CustomNativeTemplateAd( new CustomNativeTemplateClient(ad)); this.CustomNativeTemplateCallbacks[nativeAd.GetCustomTemplateId()](nativeAd, assetName); }
private void HandleCustomNativeAdLoaded(object sender, CustomNativeEventArgs args) { this.nativeAdLoaded = true; this.nativeAd = args.nativeAd; this.nativeAd.RecordImpression(); Debug.Log("HandleCustomNativeAdLoaded"); }
void Update() { Transform camera = Camera.main.transform; Ray ray = new Ray(camera.position, camera.rotation * Vector3.forward); RaycastHit hit; CustomNativeTemplateAd nativeAd = adsHandler.getNativeAd(); if (Physics.Raycast(ray, out hit) && hit.transform.gameObject.tag == "AdsCube" && nativeAd != null) { this.adsText.text = nativeAd.GetText("DisplayText"); adsTextCanvas.GetComponent <Canvas> ().enabled = true; this.hitAds = hit.transform.parent.gameObject; countDown -= Time.deltaTime; if (countDown < 0.0f) { SceneManager.LoadScene(nativeAd.GetText("NextScene")); countDown = timeToSelect; } RectTransform rectTransform = progress.GetComponent <RectTransform> (); rectTransform.sizeDelta = new Vector2(640.0f * (1 - countDown / timeToSelect), rectTransform.sizeDelta.y); } else { adsTextCanvas.GetComponent <Canvas> ().enabled = false; countDown = timeToSelect; RectTransform rectTransform = progress.GetComponent <RectTransform> (); rectTransform.sizeDelta = new Vector2(0, rectTransform.sizeDelta.y); this.hitAds = null; } }
public void onCustomClick(AndroidJavaObject ad, string assetName) { CustomNativeTemplateAd nativeAd = new CustomNativeTemplateAd( new CustomNativeTemplateClient(ad)); MobileAdsEventExecutor.executeInUpdate(() => this.CustomNativeTemplateCallbacks[nativeAd.GetCustomTemplateId()](nativeAd, assetName)); }
private static void NativeCustomTemplateDidReceiveClickCallback( IntPtr nativeCustomAd, string assetName) { CustomNativeTemplateClient client = IntPtrToAdLoaderClient(nativeCustomAd); CustomNativeTemplateAd nativeAd = new CustomNativeTemplateAd(client); client.clickHandler(nativeAd, assetName); }
private static void NativeCustomTemplateDidReceiveClickCallback( IntPtr nativeCustomAd, string assetName) { CustomNativeTemplateClient client = IntPtrToAdLoaderClient(nativeCustomAd); if (client.clickHandler != null) { CustomNativeTemplateAd nativeAd = new CustomNativeTemplateAd(client); MobileAdsEventExecutor.executeInUpdate(() => client.clickHandler(nativeAd, assetName)); } }
void Start() { this.nativeAd = null; this.nativeAdLoaded = false; }
/// <summary> /// Handles the ad event corresponding to a CustomNativeTemplateAd succesfully loading. /// </summary> /// <param name="sender">Sender.</param> /// <param name="args">EventArgs wrapper for CustomNativeTemplateAd that loaded.</param> private void HandleCustomNativeAdLoaded(object sender, CustomNativeEventArgs args) { this.nativeAd = args.nativeAd; this.nativeAdLoaded = true; }