using System; using UnityEngine; using UnityEngine.Events; using BingoBrain.Core; using System.Collections.Generic; using AppsFlyerSDK; using DG.Tweening; namespace BingoBrain.Core { public class MaxADKit { public static void Init() { #if !UNITY_EDITOR // 注册 ab事件,0或1,0为自然量版本,1为激励版本 MYp0ZVTT2QSDKHelper.Instance.RegistIosParam((i => { BingoBea.Instance.attribution = i == 0 ? "organic" : "non_organic"; Debug.Log($"ios ab param : {i} attribution=== {BingoBea.Instance.attribution}"); NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login); })); void GameConfig(bool result, string config) { Debug.Log($"************* game config result : {result}, config : {config}"); } // SDK初始化方法 MYp0ZVTT2QSDKHelper.Instance.Init(null, null, GameConfig); #endif } public static void ShowInterstitial(string placement = "DefaultInterstitial", UnityAction onCompleted = null) { } public static UnityAction onVideoAdCompleted = null; private static string _placement = ""; private static Coroutine _waitForVideoAd = null; public static void ShowVideo(string placement = "DefaultVideo", UnityAction onCompleted = null) { onVideoAdCompleted = onCompleted; _placement = placement; #if UNITY_EDITOR onVideoAdCompleted?.Invoke(true); #else // TrackKit.SendEvent(VideoBehaviorTrack.Event, VideoBehaviorTrack.Property.watch_ad_people); // TrackKit.SendEvent(VideoBehaviorTrack.Event, VideoBehaviorTrack.Property.Rewarded_videos_trigger_number); if (CheckRewardedReady()) { MYp0ZVTT2QSDKHelper.Instance.ShowRewardVideo(_placement, b => { DOVirtual.DelayedCall(0.1f, () => { onVideoAdCompleted?.Invoke(b); }); }, ()=> { DOVirtual.DelayedCall(0.2f, () => { Debug.Log($"激励广告关闭"); if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveobject().is_get_removead && (UnityEngine.Random.Range(0, 100) < GameHelper.GetCommonModel().rewardinsertion)) { // TrackKit.SendEvent(ADEventTrack.Event, ADEventTrack.Property.afterRewardAdShow); GameHelper.ShowInterstitial("AfterReward"); } }); }); } else { onVideoAdCompleted?.Invoke(false); } #endif } } }