1 Commits
1.0.6 ... 1.0.7

Author SHA1 Message Date
acff3d126b update core 2023-07-31 09:57:20 +08:00
5 changed files with 30 additions and 14 deletions

View File

@@ -51,6 +51,11 @@ namespace Runtime.ADAggregator
private string _userId; private string _userId;
/// <summary>
/// 全局任意视频广告播放结束后事件, bool 表示是否完成奖励
/// </summary>
public event Action<bool> GLOBAL_ShowAwardVideoComplete;
public string UserId => _userId; public string UserId => _userId;
#pragma warning disable CS0414 #pragma warning disable CS0414
@@ -136,6 +141,10 @@ namespace Runtime.ADAggregator
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)
{
this.OnVideoComplete(true);
}
callback?.Invoke(true); callback?.Invoke(true);
return; return;
#endif #endif
@@ -174,7 +183,9 @@ namespace Runtime.ADAggregator
return null; return null;
} }
#pragma warning disable CS0162 #pragma warning disable CS0162
return _adController.CreateAdPlayer(type); var adPlayer = _adController.CreateAdPlayer(type);
adPlayer.ADType = type;
return adPlayer;
#pragma warning restore CS0162 #pragma warning restore CS0162
} }
@@ -296,5 +307,10 @@ namespace Runtime.ADAggregator
{ {
_adController.SetMask(true); _adController.SetMask(true);
} }
internal void OnVideoComplete(bool isComplete)
{
GLOBAL_ShowAwardVideoComplete?.Invoke(isComplete);
}
} }
} }

View File

@@ -13,6 +13,8 @@ namespace Runtime.ADAggregator
protected ADListener adListener; protected ADListener adListener;
public Action OnErrorAction; public Action OnErrorAction;
public AD_Type ADType { get; internal set; }
public int State => curState; public int State => curState;
public ADPlayer Init(string key) public ADPlayer Init(string key)

View File

@@ -58,10 +58,12 @@ namespace Runtime.ADAggregator
if (!isUpdate) if (!isUpdate)
return; return;
_outTime += Time.deltaTime; _outTime += Time.deltaTime;
var callback = _callback;
if (this._outTime >= 15) if (this._outTime >= 15)
{ {
_callback?.Invoke(false); callback?.Invoke(false);
Kill(); Kill();
return;
} }
if (_adPlayer.IsReadly()) if (_adPlayer.IsReadly())
{ {
@@ -69,7 +71,10 @@ namespace Runtime.ADAggregator
Debug.LogError("开始播放广告: " + this._adPlayer.Key); Debug.LogError("开始播放广告: " + this._adPlayer.Key);
#endif #endif
_adPlayer.ShowAD(OnCloseAD, OnComplete); _adPlayer.ShowAD(OnCloseAD, OnComplete);
ADManager.Instance.CloseMask(); if (_adPlayer.ADType != AD_Type.AwardVideo)
{
ADManager.Instance.CloseMask();
}
isUpdate = false; isUpdate = false;
ADManager.Instance.RemoveUpdater(DoUpdate); ADManager.Instance.RemoveUpdater(DoUpdate);
} }
@@ -86,7 +91,7 @@ namespace Runtime.ADAggregator
} }
else else
{ {
_callback?.Invoke(false); callback?.Invoke(false);
Kill(); Kill();
} }
} }
@@ -112,6 +117,7 @@ namespace Runtime.ADAggregator
this.overHandler?.Kill(); this.overHandler?.Kill();
this.overHandler = ADManager.Instance.CreateTimer(0.05f, () => this.overHandler = ADManager.Instance.CreateTimer(0.05f, () =>
{ {
ADManager.Instance.OnVideoComplete(obj);
_callback?.Invoke(obj); _callback?.Invoke(obj);
Clear(); Clear();
}); });
@@ -122,13 +128,13 @@ namespace Runtime.ADAggregator
{ {
if (isKill) if (isKill)
return; return;
ADManager.Instance.CloseMask();
ADManager.Instance.RemoveUpdater(DoUpdate); ADManager.Instance.RemoveUpdater(DoUpdate);
Clear(); Clear();
} }
private void Clear() private void Clear()
{ {
ADManager.Instance.CloseMask();
isKill = true; isKill = true;
_callback = null; _callback = null;
_adPlayer = null; _adPlayer = null;

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 094f67b7dbe0a8d4bb32d358c57004c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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.5", "version": "1.0.7",
"unity": "2021.1", "unity": "2021.1",
"license": "MIT", "license": "MIT",
"repository": { "repository": {