You've already forked CC-Framework.Commercialization
update core
This commit is contained in:
@@ -51,6 +51,11 @@ namespace Runtime.ADAggregator
|
||||
|
||||
private string _userId;
|
||||
|
||||
/// <summary>
|
||||
/// 全局任意视频广告播放结束后事件, bool 表示是否完成奖励
|
||||
/// </summary>
|
||||
public event Action<bool> 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<bool> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 094f67b7dbe0a8d4bb32d358c57004c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user