0

FBNativeAdBridgeCallback 関数の使い方を教えてください。基本的に、画像を表示できるように、画像の読み込みがいつ完了したかを知りたいです。. それ以外の場合は、Facebook が読み込みを完了するまで、値が空のネイティブ バナーが飛んでいます。そして、各画像/テキストを一度に 1 つずつ読み込むと、見栄えが悪くなります。

基本的なネイティブ広告のサンプル スクリプトです。ログインの場合と同じように IResult を使用してみましたが、赤くなります。これに関するドキュメントはインターネット上にはなく、Facebook 開発者サイトにもありません。API がまったく見つかりません。

以下のスクリプトでそれを使用する方法を誰かに説明してもらえますか?

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using AudienceNetwork;

[RequireComponent (typeof(CanvasRenderer))]
[RequireComponent (typeof(RectTransform))]
public class NativeAdTest : MonoBehaviour
{
    private NativeAd nativeAd;

    // UI elements in scene
    [Header("Text:")]
    public Text
        title;
    public Text socialContext;
    [Header("Images:")]
    public Image
        coverImage;
    public Image iconImage;
    [Header("Buttons:")]
    public Text
        callToAction;
    public Button callToActionButton;

    public GameObject hide;

    void Awake ()
    {
        // Create a native ad request with a unique placement ID (generate your own on the Facebook app settings).
        // Use different ID for each ad placement in your app.
        NativeAd nativeAd = new AudienceNetwork.NativeAd ("your placement id");
        this.nativeAd = nativeAd;

        // Wire up GameObject with the native ad; the specified buttons will be clickable.
        nativeAd.RegisterGameObjectForImpression (gameObject, new Button[] { callToActionButton });

        // Set delegates to get notified on changes or when the user interacts with the ad.
        nativeAd.NativeAdDidLoad = (delegate() {
            Debug.Log ("Native ad loaded.");
            Debug.Log ("Loading images...");
            // Use helper methods to load images from native ad URLs
            StartCoroutine (nativeAd.LoadIconImage (nativeAd.IconImageURL));
            StartCoroutine (nativeAd.LoadCoverImage (nativeAd.CoverImageURL));
            Debug.Log ("Images loaded.");
            title.text = nativeAd.Title;
            socialContext.text = nativeAd.SocialContext;
            callToAction.text = nativeAd.CallToAction;
            Debug.Log ("Native ad Luke.");
        //  hide.SetActive(false);
            //FBNativeAdBridgeCallback


        });
        nativeAd.NativeAdDidFailWithError = (delegate(string error) {
            Debug.Log ("Native ad failed to load with error: " + error);
        });
        nativeAd.NativeAdWillLogImpression = (delegate() {
            Debug.Log ("Native ad logged impression.");
        });
        nativeAd.NativeAdDidClick = (delegate() {
            Debug.Log ("Native ad clicked.");
        });



        // Initiate a request to load an ad.
        nativeAd.LoadAd ();
        //nativeAd.nat
    }

    void OnGUI ()
    {
        // Update GUI from native ad
        coverImage.sprite = nativeAd.CoverImage;
        iconImage.sprite = nativeAd.IconImage;
    }

    void OnDestroy ()
    {
        // Dispose of native ad when the scene is destroyed
        if (this.nativeAd) {
            this.nativeAd.Dispose ();
        }
        Debug.Log ("NativeAdTest was destroyed!");
    }

//  void FBNativeAdBridgeCallback(IResult result)
//  {
//      
//  }

}

前もって感謝します!

4

1 に答える 1