SDK_UnityMoney/Assets/Script/SDKManager/AdsSDKManager/AdsSDKManager.cs

50 lines
957 B
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 System;
using UnityEngine;
public class AdsSDKManager : MonoBehaviour
{
public static AdsSDKManager instance;
/// <summary>
/// 看完广告的回调
/// </summary>
private Action<double> AdRewardCallback;
/// <summary>
/// 广告竞价开关激励、插屏、全屏Native广告竞价
/// </summary>
public bool IsMoreAdsBidding = false;
private void Awake()
{
instance = this;
InitSDK();
}
private void InitSDK()
{
KwaiAdsManager.Init();
}
/// <summary>
/// 展示激励广告
/// </summary>
/// <param name="callback"></param>
private void ShowRewardAd(Action<double> callback)
{
AdRewardCallback = callback;
}
/// <summary>
/// 广告看完回调
/// </summary>
public void OnRewardAdCallback(double price)
{
AdRewardCallback?.Invoke(price);
AdRewardCallback = null;
}
}