2015-02-03 1 views
0

나는 나의 unity3d 게임에 광고를 추가하려고합니다. 글쎄, 이건 내가 가진거야 default.몇 가지 광고를 추가하는 조언

기본적으로 배너를 활성화하기 위해 약간의 바닥이 있습니다.

모든 것이 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"); 

     } 


    } 
} 
+0

하단? 버튼을 말하는거야? – LearnCocos2D

+0

네, 죄송합니다. 버튼 !! –

답변

0

아래 해결책은 Airpush integration document에 기재되어 있습니다. 참조하십시오. "callairpush.cs 파일을 기본 카메라에 추가 한 후 응용 프로그램을 실행하면 화면에 몇 개의 프레임이 추가 된 것을 볼 수 있습니다.이 프레임을 클릭하면 광고가로드됩니다. callairpush.cs 파일은 아래에 언급 된 데모 목적을위한 파일입니다 버튼을 클릭하면 자신의 스크립트에서 이러한 기능을 호출 할 수 있습니다. 이제 maincamera에서 데모 파일을 제거하고 프로젝트 파일을 사용할 수 있습니다. "