diff --git a/Assets/Runtime/ADAggregator/ADManager.cs b/Assets/Runtime/ADAggregator/ADManager.cs
index afe22df..7ef55a6 100644
--- a/Assets/Runtime/ADAggregator/ADManager.cs
+++ b/Assets/Runtime/ADAggregator/ADManager.cs
@@ -51,6 +51,11 @@ namespace Runtime.ADAggregator
private string _userId;
+ ///
+ /// 全局任意视频广告播放结束后事件, bool 表示是否完成奖励
+ ///
+ public event Action GLOBAL_ShowAwardVideoComplete;
+
public string UserId => _userId;
#pragma warning disable CS0414
@@ -136,6 +141,10 @@ namespace Runtime.ADAggregator
public void AsyncPlayAD(AD_Type adType, string adScene, Action callback)
{
#if UNITY_EDITOR
+ if (adType == AD_Type.AwardVideo)
+ {
+ this.OnVideoComplete(true);
+ }
callback?.Invoke(true);
return;
#endif
@@ -174,7 +183,9 @@ namespace Runtime.ADAggregator
return null;
}
#pragma warning disable CS0162
- return _adController.CreateAdPlayer(type);
+ var adPlayer = _adController.CreateAdPlayer(type);
+ adPlayer.ADType = type;
+ return adPlayer;
#pragma warning restore CS0162
}
@@ -296,5 +307,10 @@ namespace Runtime.ADAggregator
{
_adController.SetMask(true);
}
+
+ internal void OnVideoComplete(bool isComplete)
+ {
+ GLOBAL_ShowAwardVideoComplete?.Invoke(isComplete);
+ }
}
}
\ No newline at end of file
diff --git a/Assets/Runtime/ADAggregator/ADPlayer.cs b/Assets/Runtime/ADAggregator/ADPlayer.cs
index 1c59cba..1545fa8 100644
--- a/Assets/Runtime/ADAggregator/ADPlayer.cs
+++ b/Assets/Runtime/ADAggregator/ADPlayer.cs
@@ -13,6 +13,8 @@ namespace Runtime.ADAggregator
protected ADListener adListener;
public Action OnErrorAction;
+ public AD_Type ADType { get; internal set; }
+
public int State => curState;
public ADPlayer Init(string key)
diff --git a/Assets/Runtime/ADAggregator/AsyncAdPlayer.cs b/Assets/Runtime/ADAggregator/AsyncAdPlayer.cs
index d5f660e..79de66a 100644
--- a/Assets/Runtime/ADAggregator/AsyncAdPlayer.cs
+++ b/Assets/Runtime/ADAggregator/AsyncAdPlayer.cs
@@ -58,10 +58,12 @@ namespace Runtime.ADAggregator
if (!isUpdate)
return;
_outTime += Time.deltaTime;
+ var callback = _callback;
if (this._outTime >= 15)
{
- _callback?.Invoke(false);
+ callback?.Invoke(false);
Kill();
+ return;
}
if (_adPlayer.IsReadly())
{
@@ -69,7 +71,10 @@ namespace Runtime.ADAggregator
Debug.LogError("开始播放广告: " + this._adPlayer.Key);
#endif
_adPlayer.ShowAD(OnCloseAD, OnComplete);
- ADManager.Instance.CloseMask();
+ if (_adPlayer.ADType != AD_Type.AwardVideo)
+ {
+ ADManager.Instance.CloseMask();
+ }
isUpdate = false;
ADManager.Instance.RemoveUpdater(DoUpdate);
}
@@ -86,7 +91,7 @@ namespace Runtime.ADAggregator
}
else
{
- _callback?.Invoke(false);
+ callback?.Invoke(false);
Kill();
}
}
@@ -112,6 +117,7 @@ namespace Runtime.ADAggregator
this.overHandler?.Kill();
this.overHandler = ADManager.Instance.CreateTimer(0.05f, () =>
{
+ ADManager.Instance.OnVideoComplete(obj);
_callback?.Invoke(obj);
Clear();
});
@@ -122,13 +128,13 @@ namespace Runtime.ADAggregator
{
if (isKill)
return;
- ADManager.Instance.CloseMask();
ADManager.Instance.RemoveUpdater(DoUpdate);
Clear();
}
private void Clear()
{
+ ADManager.Instance.CloseMask();
isKill = true;
_callback = null;
_adPlayer = null;
diff --git a/Assets/Sample.meta b/Assets/Sample.meta
deleted file mode 100644
index 5b22d15..0000000
--- a/Assets/Sample.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 094f67b7dbe0a8d4bb32d358c57004c6
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/package.json b/Assets/package.json
index 3a74934..9e24d78 100644
--- a/Assets/package.json
+++ b/Assets/package.json
@@ -2,7 +2,7 @@
"name": "com.foldcc.cc-framework.commercialization",
"displayName": "CC-Framework.commercialization",
"description": "商业化sdk通用组件,包含广告、内购、用户统计、归因统计等",
- "version": "1.0.5",
+ "version": "1.0.7",
"unity": "2021.1",
"license": "MIT",
"repository": {