You've already forked CC-Framework.Commercialization
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 377a279ac3 | |||
| b53846c98f | |||
| 89f5f66322 |
@@ -7,8 +7,8 @@ namespace Runtime.ADAggregator
|
|||||||
public class ADManager : MonoBehaviour
|
public class ADManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
private static ADManager _instance;
|
private static ADManager _instance;
|
||||||
private static bool mIsCreate = false;
|
private static bool mIsCreate = false;
|
||||||
private static bool mIsGMModel = false;
|
private static bool mIsGMModel = false;
|
||||||
|
|
||||||
public static ADManager Instance
|
public static ADManager Instance
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ namespace Runtime.ADAggregator
|
|||||||
Destroy(objs[i]);
|
Destroy(objs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_instance = new GameObject().AddComponent<ADManager>();
|
_instance = new GameObject().AddComponent<ADManager>();
|
||||||
_instance.name = "[GameUpdater] <color=yellow>NoInit<color>";
|
_instance.name = "[GameUpdater] <color=yellow>NoInit<color>";
|
||||||
DontDestroyOnLoad(_instance);
|
DontDestroyOnLoad(_instance);
|
||||||
_instance.InitTimeSystem();
|
_instance.InitTimeSystem();
|
||||||
@@ -56,19 +56,24 @@ namespace Runtime.ADAggregator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<bool> GLOBAL_ShowAwardVideoComplete;
|
public event Action<bool> GLOBAL_ShowAwardVideoComplete;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全局任意视频广告玩家点击播放时
|
||||||
|
/// </summary>
|
||||||
|
public event Action<string , string> GLOBAL_ShowAwardVideoBefore;
|
||||||
|
|
||||||
public string UserId => _userId;
|
public string UserId => _userId;
|
||||||
|
|
||||||
#pragma warning disable CS0414
|
#pragma warning disable CS0414
|
||||||
private bool _isInit = false;
|
private bool _isInit = false;
|
||||||
#pragma warning restore CS0414
|
#pragma warning restore CS0414
|
||||||
|
|
||||||
public void Init(Action onCallback, string userId, ADConfig adConfig, IAdController controller,
|
public void Init(Action onCallback, string userId, ADConfig adConfig, IAdController controller,
|
||||||
params object[] args)
|
params object[] args)
|
||||||
{
|
{
|
||||||
_isInit = true;
|
_isInit = true;
|
||||||
_instance.name = "[GameUpdater] <color=green>Init<color>";
|
_instance.name = "[GameUpdater] <color=green>Init<color>";
|
||||||
AD_Dicts = new Dictionary<AD_Type, ADPlayer>();
|
AD_Dicts = new Dictionary<AD_Type, ADPlayer>();
|
||||||
_userId = userId;
|
_userId = userId;
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
onCallback?.Invoke();
|
onCallback?.Invoke();
|
||||||
#else
|
#else
|
||||||
@@ -140,11 +145,13 @@ namespace Runtime.ADAggregator
|
|||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
public void AsyncPlayAD(AD_Type adType, string adScene, Action<bool> callback)
|
public void AsyncPlayAD(AD_Type adType, string adScene, Action<bool> callback)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (adType == AD_Type.AwardVideo)
|
if (adType == AD_Type.AwardVideo)
|
||||||
{
|
{
|
||||||
this.OnVideoComplete(true);
|
this.OnVideoComplete(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback?.Invoke(true);
|
callback?.Invoke(true);
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@@ -153,6 +160,7 @@ namespace Runtime.ADAggregator
|
|||||||
callback?.Invoke(true);
|
callback?.Invoke(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_adController.EventLog("adScene", adScene);
|
_adController.EventLog("adScene", adScene);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -163,7 +171,9 @@ namespace Runtime.ADAggregator
|
|||||||
}
|
}
|
||||||
|
|
||||||
var player = AD_Dicts[adType];
|
var player = AD_Dicts[adType];
|
||||||
_curAsyncPlayer = new AsyncAdPlayer(player, callback);
|
if (adType == AD_Type.AwardVideo)
|
||||||
|
GLOBAL_ShowAwardVideoBefore?.Invoke(player.Key , adScene);
|
||||||
|
_curAsyncPlayer = new AsyncAdPlayer(player, adScene, callback);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -212,13 +222,13 @@ namespace Runtime.ADAggregator
|
|||||||
|
|
||||||
#region TimeSystem
|
#region TimeSystem
|
||||||
|
|
||||||
private List<Action> _updateList;
|
private List<Action> _updateList;
|
||||||
private const int DefaultLength = 1024;
|
private const int DefaultLength = 1024;
|
||||||
private List<AdTimeHandler> _timeHandlers;
|
private List<AdTimeHandler> _timeHandlers;
|
||||||
|
|
||||||
private void InitTimeSystem()
|
private void InitTimeSystem()
|
||||||
{
|
{
|
||||||
this._updateList = new List<Action>(DefaultLength);
|
this._updateList = new List<Action>(DefaultLength);
|
||||||
this._timeHandlers = new List<AdTimeHandler>();
|
this._timeHandlers = new List<AdTimeHandler>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Runtime.ADAggregator
|
|||||||
protected int curState;
|
protected int curState;
|
||||||
|
|
||||||
public string Key;
|
public string Key;
|
||||||
|
public string AdScene;
|
||||||
protected ADListener adListener;
|
protected ADListener adListener;
|
||||||
public Action OnErrorAction;
|
public Action OnErrorAction;
|
||||||
|
|
||||||
|
|||||||
@@ -5,21 +5,23 @@ namespace Runtime.ADAggregator
|
|||||||
{
|
{
|
||||||
public class AsyncAdPlayer
|
public class AsyncAdPlayer
|
||||||
{
|
{
|
||||||
private Action<bool> _callback;
|
private Action<bool> _callback;
|
||||||
private ADPlayer _adPlayer;
|
private ADPlayer _adPlayer;
|
||||||
private bool firstLoad;
|
private bool firstLoad;
|
||||||
private bool isKill;
|
private bool isKill;
|
||||||
private bool isUpdate;
|
private bool isUpdate;
|
||||||
private AdTimeHandler overHandler;
|
private AdTimeHandler overHandler;
|
||||||
|
private string _Ad_scene;
|
||||||
|
|
||||||
private float _outTime;
|
private float _outTime;
|
||||||
|
|
||||||
public AsyncAdPlayer(ADPlayer player , Action<bool> callback)
|
public AsyncAdPlayer(ADPlayer player , string adScene, Action<bool> callback)
|
||||||
{
|
{
|
||||||
|
|
||||||
this._outTime = 0;
|
this._Ad_scene = adScene;
|
||||||
|
this._outTime = 0;
|
||||||
this._callback = callback;
|
this._callback = callback;
|
||||||
this.isKill = false;
|
this.isKill = false;
|
||||||
this.firstLoad = true;
|
this.firstLoad = true;
|
||||||
this._adPlayer = player;
|
this._adPlayer = player;
|
||||||
if (_adPlayer == null)
|
if (_adPlayer == null)
|
||||||
@@ -33,7 +35,8 @@ namespace Runtime.ADAggregator
|
|||||||
}
|
}
|
||||||
ADManager.Instance.OpenMask();
|
ADManager.Instance.OpenMask();
|
||||||
_adPlayer.OnErrorAction = OnError;
|
_adPlayer.OnErrorAction = OnError;
|
||||||
isUpdate = true;
|
_adPlayer.AdScene = this._Ad_scene;
|
||||||
|
isUpdate = true;
|
||||||
ADManager.Instance.AddUpdater(DoUpdate);
|
ADManager.Instance.AddUpdater(DoUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.foldcc.cc-framework.commercialization",
|
"name": "com.foldcc.cc-framework.commercialization",
|
||||||
"displayName": "CC-Framework.commercialization",
|
"displayName": "CC-Framework.commercialization",
|
||||||
"description": "商业化sdk通用组件,包含广告、内购、用户统计、归因统计等",
|
"description": "商业化sdk通用组件,包含广告、内购、用户统计、归因统计等",
|
||||||
"version": "1.0.7",
|
"version": "1.0.11",
|
||||||
"unity": "2021.1",
|
"unity": "2021.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user