Ejemplo n.º 1
0
 //针对整个广告位加载的结果做一个状态的返回
 //当isLoadedSucces为false,重新加载广告
 public void OnInterstitialAllLoaded(bool isLoadedSucces, string adUnitId)
 {
     if (!isLoadedSucces)
     {
         TradPlus.RequestInterstitialAd(adUnitId);
     }
 }
Ejemplo n.º 2
0
    private void CreateInterstitialsSection()
    {
        GUILayout.Space(_sectionMarginSize);
        GUILayout.Label("Interstitials");


        GUILayout.BeginHorizontal();

        GUI.enabled = true;
        if (GUILayout.Button(CreateRequestButtonLabel(_interstitialAdUnits)))
        {
            Debug.Log("requesting interstitial with AdUnit: " + _interstitialAdUnits);
            UpdateStatusLabel("Requesting " + _interstitialAdUnits);
            //请求插屏广告

            /*
             * 参数2:自动reload,设置true,TradPlus SDK会在两个地方自动加载广告,无需调用load
             *           (1)调用obj.show()没有广告的时候,此时说明该广告位下没有广告加载成功;
             *           (2)当广告关闭,onInterstitialDismissed回调中
             *
             *   不传默认false,需要在上述2个地方手动调用obj.load()方法以保证有广告的填充。
             */
            TradPlus.RequestInterstitialAd(_interstitialAdUnits, true);

            //进入场景时调用
            TradPlus.ShowInterstitialConfirmUWSAd(_interstitialAdUnits);
        }

        GUI.enabled = true;
        if (GUILayout.Button("Show"))
        {
            ClearStatusLabel();

            //设置自动reload为true,无可用广告会自动加载;有广告时直接展示
            TradPlus.ShowInterstitialAd(_interstitialAdUnits);

            //不设置自动reload为true
            //if (TradPlus.IsInterstialReady(_interstitialAdUnits))
            //{
            //    TradPlus.ShowInterstitialAd(_interstitialAdUnits);
            //}
            //else
            //{
            //   TradPlus.RequestInterstitialAd(_interstitialAdUnits);
            //}
        }

        GUI.enabled = true;
        GUILayout.EndHorizontal();
    }