예제 #1
0
 internal void OnLoadAd(INativeAd ad)
 {
     m_LoadedNativeAd = ad;
     if (renderWhenLoaded)
     {
         RenderAd();
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
 /// <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);
     }
 }
예제 #4
0
 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);
             });
         }
     }
 }
예제 #5
0
 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)
 {
 }
예제 #9
0
 public NativeAdReadyEventArgs(INativeAd nativeAd)
 {
     NativeAd = nativeAd;
 }
예제 #10
0
 internal void RenderAd(INativeAd ad)
 {
     m_LoadedNativeAd = ad;
     RenderAd();
 }
예제 #11
0
 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");
 }
예제 #14
0
		public void OnNativeShown(INativeAd nativeAd) { Log.Debug(LOG_TAG, " OnNativeShown"); }
예제 #15
0
		public void OnNativeClicked(INativeAd nativeAd) { Log.Debug(LOG_TAG, " OnNativeClicked"); }
예제 #16
0
        private void onResponse(AndroidJavaObject ad, int code, string message)
        {
            INativeAd nativeAd = null != ad ? new AndroidNativeAd(ad) : null;

            DeliverResponseOnMainThread(nativeAd, code, message);
        }