コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }