示例#1
0
    void Start()
    {
        (GameObject.Find("LoadInterstitial").GetComponent <Button>()).onClick.AddListener(load_interstitial);
        (GameObject.Find("Info").GetComponent <Button> ()).onClick.AddListener(load_info);

        /* inactivate ShowCustom btn until the Custom Ad is loaded */
        showCustomAdBtn = GameObject.Find("ShowCustom");
        (showCustomAdBtn.GetComponent <Button> ()).onClick.AddListener(show_custom_Ad);
        showCustomAdBtn.SetActive(false);

        GameObject closeCustomAdBtn = GameObject.Find("CloseCustomAd");

        (closeCustomAdBtn.GetComponent <Button> ()).onClick.AddListener(close_custom_Ad);

        /* Get references of GameObject that will display Native Ad */
        adImage       = GameObject.Find("AdImage");
        adCTA         = GameObject.Find("AdCTAButton");
        adTitle       = GameObject.Find("AdTitle");
        adDescription = GameObject.Find("AdDescription");

        avocarrot = new Avocarrot("8d4f9962ea5997eb921a5f1130d7fc84f593a756", "d8775ad6710f9a0cf08a7739e8f0cc3ef78bde6f");
        avocarrot.setImage(adImage);
        avocarrot.setCtaBtn(adCTA);
        avocarrot.setTitle(adTitle);
        avocarrot.setDescription(adDescription);
        avocarrot.setSandbox(true);
        avocarrot.setLogger(true);
        avocarrot.onAdLoadedEvent     += onCustomAdLoaded;
        avocarrot.onAdClickedEvent    += onCustomAdClicked;
        avocarrot.onAdImpressionEvent += onCustomAdImpression;
        avocarrot.onAdErrorEvent      += onCustomAdError;
        avocarrot.loadAd();

        customAdContainer = GameObject.Find("CustomAds");
        customAdContainer.SetActive(false);
    }
示例#2
0
 public void setAvocarrot(Avocarrot avocarrot)
 {
     this.avocarrot = avocarrot;
 }