0

我正在尝试在我的 unity3d 游戏中添加一些广告。好吧,这就是我默认的。

是的,默认情况下我有一些底部来激活横幅。

一切都在 C# 中,这是示例代码和原始代码,我只想知道如何摆脱困境并在那里展示广告。

 using UnityEngine;
using System.Collections;
using System;


public class CallAirpush : MonoBehaviour {
    private IntPtr  JavaClass;
    private int     BtnMyAppWall;
    private int     BtnMyIcon;
    private int     BtnBannerAd;
        private int             BtnBanner360;
    IntPtr obj_Activity;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    void noAdAvailableListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }

    void onAdCached(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }

    void onAdError(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }

    void onSDKIntegrationError(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }

    void onSmartWallAdClosed(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }

    void onSmartWallAdShowing(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }


    void onAdClickListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }
    void onAdExpandedListner(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }
    void onAdLoadedListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }
    void onAdLoadingListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }
    void onCloseListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }
    void onErrorListener(string arg){
    Debug.Log("Publisher Call back called:"+arg);
    }




    void OnGUI ()
    {
        if (GUI.Button(new Rect (100, 200, 300, 120), "Banner 360 Ads"))
        {
            //new Rect(
        //  For ads on top of your screen();

            //AirScript.StartAirBanner360Ad ();

        /// For Banner 360 ads on your screen();
            AirScript.StartAirBanner360Ad();


        }
        if (GUI.Button(new Rect (100, 350, 300, 120), "Bottom Banner Ads"))
        {
            //new Rect(
        //  For ads on top of your screen();

            //AirScript.startAirBannerAdTop();

        /// For ads on bottom of your screen();
            AirScript.startAirBannerAdBottom(true);
            AirScript.startAirBannerAdTop(false);


        }

        if (GUI.Button(new Rect (100,500, 300, 120), "Cache smartwall"))
        {
            AirScript.cacheAirSmartWallAd();

        }
        if (GUI.Button(new Rect (100, 650, 300, 120), "Show Cached smartwall"))
        {
            AirScript.showCachedAirSmartWallAd();

        }
        if (GUI.Button(new Rect (100, 800, 300, 120), "disableSDK"))
        {
        //If you want to immediately remove banner ad from screen and want to prevent other ads to load then call below method in conjunction with stopAirBannerAdBottom/stopAirBannerAdTop

            AirScript.setSDKStatus("Disable");

        }if (GUI.Button(new Rect (100, 950, 300, 120), "Stop Banner Bottom Ad"))
        {
            AirScript.stopAirBannerAdBottom();

        }
        if (GUI.Button(new Rect (100, 1100, 300, 120), "EnableSDK"))
        {
        //If you again want to enable SDK

            AirScript.setSDKStatus("EnableSDK");

        }

        if (GUI.Button(new Rect (100, 1250, 300, 120), "Change GameObject"))
        {
        //If you want to change GameObject

            AirScript.setGameObject("ExampleObject");

        }


    }
}
4

1 回答 1

0

以下解决方案写在Airpush 集成文档上:请参考。“如果您已将 callairpush.cs 文件添加到主摄像头,则在运行应用程序后,您会看到屏幕上添加了几帧。点击这些帧时将加载广告。callairpush.cs 文件用于演示目的,它正在调用下面提到的函数单击帧。您可以在单击所需按钮时从自己的脚本中调用这些函数。现在您可以从主摄像机中删除我们的演示文件并使用您的项目文件。

于 2015-02-06T06:03:16.437 回答