OvertakingLegend/Assets/Script/Tool/SDKManager.cs

44 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BX;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using static BX.BXSdk;
public class SDKManager:SingletonManager<SDKManager>
{
/// <summary>
/// 播放插屏
/// </summary>
public void ShowInterstitial(string iv, IVADType type)
{
// 展示插屏广告
BXSdk.Instance.ShowInterstitial(iv, () =>
{
Debug.Log("插屏关闭了");
}, type);
}
/// <summary>
/// 激励视频
/// </summary>
public bool ShowReward(string rv,UnityAction callBack)
{
// 激励视频广告是否准备好true准备好了false没准备好
var rewardReady = BXSdk.Instance.IsReadyReward();
if (rewardReady)
{
//展示激励视频广告
BXSdk.Instance.ShowReward(rv, (result) =>
{
if (result)
{
callBack?.Invoke();
}
Debug.Log("激励视频广告关闭了,是否获得奖励:" + result);
});
}
return rewardReady;
}
}