diff --git a/Assets/CHANGELOG.md b/Assets/CHANGELOG.md index 3a85d71..a382ad6 100644 --- a/Assets/CHANGELOG.md +++ b/Assets/CHANGELOG.md @@ -1,3 +1,9 @@ +# [1.0.16] + +### 新增 + +* `ADManager` 在 Unity Editor 模拟广告播放和进入广告场景时,会调用可选的 `IAdEditorDiagnostics` 诊断接口,便于渠道实现输出当前场景实际使用的广告位。 + # [1.0.15] ### 调整 diff --git a/Assets/Runtime/ADAggregator/ADManager.cs b/Assets/Runtime/ADAggregator/ADManager.cs index 4f33740..da63ff2 100644 --- a/Assets/Runtime/ADAggregator/ADManager.cs +++ b/Assets/Runtime/ADAggregator/ADManager.cs @@ -51,6 +51,8 @@ namespace Runtime.ADAggregator private string _userId; + private object[] _initArgs; + /// /// 全局任意视频广告播放结束后事件, bool 表示是否完成奖励 /// @@ -74,12 +76,13 @@ namespace Runtime.ADAggregator _instance.name = "[GameUpdater] Init"; AD_Dicts = new Dictionary(); _userId = userId; + _adController = controller; + _adConfig = adConfig; + _initArgs = args; #if UNITY_EDITOR onCallback?.Invoke(); #else controller.Init(adConfig , args); - _adController = controller; - _adConfig = adConfig; PrewarmConfiguredPlayers(); onCallback?.Invoke(); #endif @@ -148,6 +151,7 @@ namespace Runtime.ADAggregator { #if UNITY_EDITOR + LogEditorAdPlacement(adType, adScene, "play"); if (adType == AD_Type.AwardVideo) { this.OnVideoComplete(true); @@ -207,6 +211,7 @@ namespace Runtime.ADAggregator public void EnterAdScenario(AD_Type adType, string adScene) { #if UNITY_EDITOR + LogEditorAdPlacement(adType, adScene, "enter_scene"); return; #endif if (!_isInit || mIsGMModel) @@ -263,6 +268,18 @@ namespace Runtime.ADAggregator return string.IsNullOrWhiteSpace(scenario) ? "__default__" : scenario.Trim(); } + private void LogEditorAdPlacement(AD_Type adType, string adScene, string action) + { + var normalizedScene = NormalizeScenario(adScene); + if (_adController is IAdEditorDiagnostics diagnostics) + { + diagnostics.LogEditorAdPlacement(_adConfig, adType, normalizedScene, action, _initArgs); + return; + } + + Debug.Log($"[ADManager] Editor ad {action}. type={adType}, scene={normalizedScene}"); + } + public void CloseAd(AD_Type adType) { #if UNITY_EDITOR diff --git a/Assets/Runtime/ADAggregator/IAdController.cs b/Assets/Runtime/ADAggregator/IAdController.cs index 1241a55..86342ed 100644 --- a/Assets/Runtime/ADAggregator/IAdController.cs +++ b/Assets/Runtime/ADAggregator/IAdController.cs @@ -7,4 +7,9 @@ void EventLog(string eventTable, string eventValue, string eventMessage = null); void SetMask(bool isOpen); } -} \ No newline at end of file + + public interface IAdEditorDiagnostics + { + void LogEditorAdPlacement(ADConfig adConfig, AD_Type adType, string adScene, string action, object[] args); + } +} diff --git a/Assets/package.json b/Assets/package.json index e8223bc..6ecb361 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.15", + "version": "1.0.16", "unity": "2022.3", "license": "MIT", "repository": {