internal void OnLoadAd(INativeAd ad) { m_LoadedNativeAd = ad; if (renderWhenLoaded) { RenderAd(); } }
private static void NativeAdCallback(IntPtr client, IntPtr nativeAd, int code, string message) { GCHandle handle = (GCHandle)client; IOSNativeAdClient self = handle.Target as IOSNativeAdClient; INativeAd ad = (200 == code) ? new IOSNativeAd(nativeAd) : null; self.DeliverResponseOnMainThread(ad, code, message); handle.Free(); }
/// <summary> /// Renders the ad. /// </summary> /// <returns><c>true</c>, if ad was rendered, <c>false</c> otherwise.</returns> public bool RenderAd() { if (Loaded) { ShowingNativeAd = m_LoadedNativeAd; return(true); } else { return(false); } }
protected void DeliverResponseOnMainThread(INativeAd ad, int code, string message) { lock (m_Callbacks) { if (0 < m_Callbacks.Count) { var callback = m_Callbacks.Dequeue(); Worker.Instance.Post(() => { callback(ad, code, message); }); } } }
protected void DeliverResponseOnMainThread(INativeAd ad, int code, string message) { lock (m_Callbacks) { if (0 < m_Callbacks.Count) { if (ad != null && (IsGifImage(ad.AdImageUrl) || IsGifImage(ad.LogoImageUrl))) { ad = null; code = ERROR_CODE_UNSUPPORTED_IMAGE_FORMAT; message = ERROR_MESSAGE_UNSUPPORTED_IMAGE_FORMAT; } var callback = m_Callbacks.Dequeue(); Worker.Instance.Post(() => { callback(ad, code, message); }); } } }
protected override void OnReceive(INativeAd ad, int code, string message) { if (null != ad) { pr.text = ad.GetAdvertisingExplicitlyText(AdvertisingExplicitly.AD); var text = ad.ShortText; title.text = text.Insert(text.Length / 2, "\n"); StartCoroutine(ad.LoadAdImage((Texture2D texture) => { render.sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f)); })); ad.Activate(this.gameObject, pr.gameObject); ad.AdClicked += (sender, e) => { Debug.Log("Click AD."); }; } else { Debug.LogFormat("Failed to load ad. code = {0}, message = {1}", code, message); } }
protected override void OnReceive(INativeAd ad, int code, string message) { if (null != ad) { pr.text = ad.GetAdvertisingExplicitlyText(AdvertisingExplicitly.Sponsored); title.text = ad.ShortText; promotion.text = ad.PromotionName; actionButton.text = ad.ActionButtonText; StartCoroutine(ad.LoadAdImage((Texture2D texture) => { image.texture = texture; })); StartCoroutine(ad.LoadLogoImage((Texture2D texture) => { logo.texture = texture; })); ad.Activate(this.gameObject, pr.gameObject); ad.AdClicked += (sender, e) => { Debug.Log("Click AD."); }; } else { Debug.LogFormat("Failed to load ad. code = {0}, message = {1}", code, message); } }
protected virtual void OnReceive(INativeAd ad, int code, string message) { }
public NativeAdReadyEventArgs(INativeAd nativeAd) { NativeAd = nativeAd; }
internal void RenderAd(INativeAd ad) { m_LoadedNativeAd = ad; RenderAd(); }
void OnDestroy() { Log.D("OnDestroy: {0}", name); m_LoadedNativeAd = null; m_ShowingNativeAd = null; }
public void OnNativeShown(INativeAd nativeAd) { Log.Debug(LOG_TAG, " OnNativeShown"); }
public void OnNativeClicked(INativeAd nativeAd) { Log.Debug(LOG_TAG, " OnNativeClicked"); }
private void onResponse(AndroidJavaObject ad, int code, string message) { INativeAd nativeAd = null != ad ? new AndroidNativeAd(ad) : null; DeliverResponseOnMainThread(nativeAd, code, message); }