Beispiel #1
0
 //针对整个广告位加载的结果做一个状态的返回
 //当isLoadedSucces为false,重新加载广告
 public void OnRewardedVideoAllLoaded(bool isLoadedSucces, string adUnitId)
 {
     if (!isLoadedSucces)
     {
         TradPlus.RequestRewardedVideo(adUnitId);
     }
 }
Beispiel #2
0
    private void CreateRewardedVideosSection()
    {
        GUILayout.Space(_sectionMarginSize);
        GUILayout.Label("Rewarded Videos");

        GUILayout.BeginHorizontal();

        GUI.enabled = true;
        if (GUILayout.Button(CreateRequestButtonLabel(_rewardedVideoAdUnits)))
        {
            Debug.Log("requesting rewarded video with AdUnit: " + _rewardedVideoAdUnits);
            UpdateStatusLabel("Requesting " + _rewardedVideoAdUnits);
            //请求激励视频

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

            //进入场景时调用
            TradPlus.ShowRewardedVideoConfirmUWSAd(_rewardedVideoAdUnits);
        }

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

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

            //不设置自动reload为true
            //if(TradPlus.HasRewardedVideo(_rewardedVideoAdUnits))
            //{
            //    TradPlus.ShowRewardedVideo(_rewardedVideoAdUnits);
            //}else
            //{
            //    TradPlus.RequestRewardedVideo(_rewardedVideoAdUnits);
            //}
        }

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