fix:1、sdk更换。2、修复bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using DFFFQTVUv39wKIBSDK;
|
||||
// using AppsFlyerSDK;
|
||||
using DG.Tweening;
|
||||
using IgnoreOPS;
|
||||
@@ -34,52 +35,53 @@ namespace ChillConnect
|
||||
public static void Init()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
// // 注册 ab事件,0或1,0为自然量版本,1为激励版本
|
||||
// NCWWA6A0SDK_Manager.Instance.RegistIosParam(i =>
|
||||
// {
|
||||
// SuperApplication.Instance.attribution = i == 0 ? "organic" : "non_organic";
|
||||
// Debug.Log($"ios ab param : {i} attribution=== {SuperApplication.Instance.attribution}");
|
||||
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
//
|
||||
// });
|
||||
//
|
||||
// void GameConfig(bool result, string config)
|
||||
// {
|
||||
// Debug.Log($"************* game config result : {result}, config : {config}");
|
||||
// }
|
||||
// // SDK初始化方法
|
||||
// NCWWA6A0SDK_Manager.Instance.Init(null, null, GameConfig);
|
||||
|
||||
// 注册 ab事件,0或1,0为自然量版本,1为激励版本
|
||||
DFFFQTVUv39wKIBSDK_Client.Instance.RegistIosParam(i =>
|
||||
{
|
||||
SuperApplication.Instance.attribution = i == 0 ? "organic" : "non_organic";
|
||||
Debug.Log($"ios ab param : {i} attribution=== {SuperApplication.Instance.attribution}");
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
|
||||
});
|
||||
|
||||
void GameConfig(bool result, string config)
|
||||
{
|
||||
Debug.Log($"************* game config result : {result}, config : {config}");
|
||||
}
|
||||
// SDK初始化方法
|
||||
DFFFQTVUv39wKIBSDK_Client.Instance.Init(null, null, GameConfig);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// public static bool CheckInterstitialReady()
|
||||
// {
|
||||
// return NCWWA6A0SDK_Manager.Instance.IsInterReady();
|
||||
// }
|
||||
public static bool CheckInterstitialReady()
|
||||
{
|
||||
return DFFFQTVUv39wKIBSDK_Client.Instance.IsInterReady();
|
||||
}
|
||||
#region 插屏广告相关
|
||||
public static UnityAction<bool> onInterstitialAdCompleted;
|
||||
|
||||
public static void ShowInterstitial(string placement = "DefaultInterstitial",
|
||||
UnityAction<bool> onCompleted = null)
|
||||
{
|
||||
// if (CheckInterstitialReady())
|
||||
// {
|
||||
// Debug.Log($"广告已经准备好,播放");
|
||||
// NCWWA6A0SDK_Manager.Instance.ShowInter(placement, () =>
|
||||
// {
|
||||
// DOVirtual.DelayedCall(0.1f, () =>
|
||||
// {
|
||||
// onCompleted?.Invoke(true);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.Log($"广告未准备好,不播放");
|
||||
// onCompleted?.Invoke(false);
|
||||
// }
|
||||
if (CheckInterstitialReady())
|
||||
{
|
||||
Debug.Log($"广告已经准备好,播放");
|
||||
DFFFQTVUv39wKIBSDK_Client.Instance.ShowInter(placement, () =>
|
||||
{
|
||||
DOVirtual.DelayedCall(0.1f, () =>
|
||||
{
|
||||
onCompleted?.Invoke(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"广告未准备好,不播放");
|
||||
onCompleted?.Invoke(false);
|
||||
}
|
||||
}
|
||||
|
||||
static int retryAttemptInterstitial;
|
||||
@@ -90,7 +92,7 @@ namespace ChillConnect
|
||||
private static void LoadAppOpenAd()
|
||||
{
|
||||
Debug.Log("LOAD APP. AD");
|
||||
MaxSdk.LoadAppOpenAd(AppOpenAdUnitId);
|
||||
// MaxSdk.LoadAppOpenAd(AppOpenAdUnitId);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,57 +116,57 @@ namespace ChillConnect
|
||||
// }
|
||||
// #endif
|
||||
}
|
||||
public static void ShowOpenAd(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
MaxSdk.ShowAppOpenAd(AppOpenAdUnitId);
|
||||
}
|
||||
// public static void ShowOpenAd(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
// {
|
||||
// MaxSdk.ShowAppOpenAd(AppOpenAdUnitId);
|
||||
// }
|
||||
|
||||
|
||||
#region 激励视频广告相关
|
||||
|
||||
public static UnityAction<bool> onVideoAdCompleted;
|
||||
private static string _placement = "";
|
||||
// public static bool CheckRewardedReady()
|
||||
// {
|
||||
// return NCWWA6A0SDK_Manager.Instance.IsVideoReady();
|
||||
// }
|
||||
public static bool CheckRewardedReady()
|
||||
{
|
||||
return DFFFQTVUv39wKIBSDK_Client.Instance.IsVideoReady();
|
||||
}
|
||||
public static void ShowVideo(string placement = "DefaultVideo", UnityAction<bool> onCompleted = null)
|
||||
{
|
||||
onVideoAdCompleted = onCompleted;
|
||||
_placement = placement;
|
||||
#if UNITY_EDITOR || !GAME_RELEASE
|
||||
#if UNITY_EDITOR
|
||||
onVideoAdCompleted?.Invoke(true);
|
||||
#else
|
||||
TrackKit.SendEvent(Property.adEvent,Property.watch_ad_people);
|
||||
TrackKit.SendEvent(Property.adEvent,Property.Rewarded_videos_trigger_number);
|
||||
|
||||
// if (CheckRewardedReady())
|
||||
// {
|
||||
// NCWWA6A0SDK_Manager.Instance.ShowRewardVideo(_placement, b =>
|
||||
// {
|
||||
// DOVirtual.DelayedCall(0.1f, () =>
|
||||
// {
|
||||
// onVideoAdCompleted?.Invoke(b);
|
||||
// });
|
||||
// }, ()=>
|
||||
// {
|
||||
// DOVirtual.DelayedCall(0.25f, () =>
|
||||
// {
|
||||
// Debug.Log($"激励广告关闭");
|
||||
// if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveObject().is_get_removead && (UnityEngine.Random.Range(0, 100) < GameHelper.GetCommonModel().rewardinsertion))
|
||||
// {
|
||||
// TrackKit.SendEvent(Property.adEvent, Property.AfterRewardAdShow);
|
||||
//
|
||||
// GameHelper.ShowInterstitial("AfterReward");
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.Log($"广告未准备好,不播放");
|
||||
// onVideoAdCompleted?.Invoke(false);
|
||||
// }
|
||||
if (CheckRewardedReady())
|
||||
{
|
||||
DFFFQTVUv39wKIBSDK_Client.Instance.ShowRewardVideo(_placement, b =>
|
||||
{
|
||||
DOVirtual.DelayedCall(0.1f, () =>
|
||||
{
|
||||
onVideoAdCompleted?.Invoke(b);
|
||||
});
|
||||
}, ()=>
|
||||
{
|
||||
DOVirtual.DelayedCall(0.25f, () =>
|
||||
{
|
||||
Debug.Log($"激励广告关闭");
|
||||
if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveObject().is_get_removead && (UnityEngine.Random.Range(0, 100) < GameHelper.GetCommonModel().rewardinsertion))
|
||||
{
|
||||
TrackKit.SendEvent(Property.adEvent, Property.AfterRewardAdShow);
|
||||
|
||||
GameHelper.ShowInterstitial("AfterReward");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"广告未准备好,不播放");
|
||||
onVideoAdCompleted?.Invoke(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user