예제 #1
0
    public void onButtonClick()
    {
        //TextEditor text = GameObject.Find ("CallText").GetComponent<TextEditor>();


        if (!inited)
        {
            UPSDK.UPSDKInitFinishedCallback      = new System.Action <bool, string>(actionForSdkInitFinish);
            UPSDK.UPInterstitialDidClickCallback = new System.Action <string, string>(actionForInterstitialDidClick);
            UPSDK.UPInterstitialDidCloseCallback = new System.Action <string, string>(actionForInterstitialDidClose);
            UPSDK.UPInterstitialDidShowCallback  = new System.Action <string, string>(actionForInterstitialDidShow);

            UPSDK.UPBannerDidShowCallback   = new System.Action <string, string>(actionForSdkBannerDidShow);
            UPSDK.UPBannerDidClickCallback  = new System.Action <string, string>(actionForSdkBannerDidClick);
            UPSDK.UPBannerDidRemoveCallback = new System.Action <string, string>(actionForSdkBannerRemove);

            UPSDK.UPRewardDidOpenCallback    = new System.Action <string, string>(actionForSdkRewardDidOpen);
            UPSDK.UPRewardDidClickCallback   = new System.Action <string, string>(actionForSdkRewardDidClick);
            UPSDK.UPRewardDidCloseCallback   = new System.Action <string, string>(actionForSdkRewardDidClose);
            UPSDK.UPRewardDidGivenCallback   = new System.Action <string, string>(actionForSdkRewardDidGiven);
            UPSDK.UPRewardDidAbandonCallback = new System.Action <string, string>(actionForSdkRewardDidAbandon);

                        #if UNITY_ANDROID && !UNITY_EDITOR
            UPSDK.UPExitAdDidShowCallback      = new System.Action <string> (actionForSdkExitAdDidShow);
            UPSDK.UPExitAdDidClickCallback     = new System.Action <string> (actionForSdkExitAdDidClick);
            UPSDK.UPExitAdDidClickMoreCallback = new System.Action <string> (actionForSdkExitAdDidClickMore);
            UPSDK.UPExitAdOnExitCallback       = new System.Action <string> (actionForSdkExitAdOnExit);
            UPSDK.UPExitAdOnCancelCallback     = new System.Action <string> (actionForSdkExitAdOnExit);
                        #endif
        }

        if (TEST_AD)
        {
            inited = true;


            Text text = GameObject.Find("CallText").GetComponent <Text> ();

            //text.text = PolyADSDK.testCall ();

            //**注意**
            //请在init方法之前调用此方法,并传入androidid,详细信息请 参考http://docs.upltv.com/zh/master/Unity/unity05_1_sample_init.html 中的setcustomID
            PolyADSDK.setCustomerIdForAndroid(GetAndroidID());
            string tt = PolyADSDK.initPolyAdSDK(UPConstant.SDKZONE_CHINA);
            UPSDK.runCallbackAfterAppFocus(true);
            Debug.Log("initPolyAdSDK ====> " + tt);
            if (tt != null)
            {
                text.text = tt;
            }
        }
    }
예제 #2
0
 public override void Init()
 {
     // init
     PolyADSDK.AvidlySDKInitFinishedCallback = _OnInitFinished;
     // reward video
     PolyADSDK.setRewardVideoLoadCallback(_OnRewardVideoLoadSucceeded, _OnRewardVideoLoadFailed);
     PolyADSDK.AvidlyRewardDidOpenCallback    = _OnRewardVideoShow;
     PolyADSDK.AvidlyRewardDidCloseCallback   = _OnRewardVideoClose;
     PolyADSDK.AvidlyRewardDidClickCallback   = _OnRewardVideoClick;
     PolyADSDK.AvidlyRewardDidGivenCallback   = _OnRewardVideoReward;
     PolyADSDK.AvidlyRewardDidAbandonCallback = _OnRewardVideoAbandon;
     // interstitial
     PolyADSDK.AvidlyInterstitialDidShowCallback  = _OnInterstitialShow;
     PolyADSDK.AvidlyInterstitialDidCloseCallback = _OnInterstitialClose;
     PolyADSDK.AvidlyInterstitialDidClickCallback = _OnInterstitialClick;
     // banner
     PolyADSDK.AvidlyBannerDidShowCallback   = _OnBannerShow;
     PolyADSDK.AvidlyBannerDidRemoveCallback = _OnBannerRemove;
     PolyADSDK.AvidlyBannerDidClickCallback  = _OnBannerClick;
     // init
     PolyADSDK.setManifestPackageName(Application.identifier);
     PolyADSDK.initPolyAdSDK(PolyADSDK.SDKZONE_AUTO);
 }