fix: log TapADN editor ad placement

This commit is contained in:
2026-06-17 18:21:53 +08:00
parent 286799142b
commit 4089560471
3 changed files with 43 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ using Dirichlet.Mediation;
using Runtime.ADAggregator;
using UnityEngine;
public sealed class TapadnAdController : IAdController
public sealed class TapadnAdController : IAdController, IAdEditorDiagnostics
{
public static TapadnControllerOptions CurrentOptions { get; private set; }
public static string LastSdkVersion { get; private set; }
@@ -73,4 +73,38 @@ public sealed class TapadnAdController : IAdController
{
_maskAction?.Invoke(isOpen);
}
public void LogEditorAdPlacement(ADConfig adConfig, AD_Type adType, string adScene, string action, object[] args)
{
var options = TapadnControllerOptions.Resolve(adConfig, args);
var normalizedScene = string.IsNullOrWhiteSpace(adScene) ? "__default__" : adScene.Trim();
var slotSource = "default";
var slotId = ResolveEditorSlotId(adConfig, options, adType, normalizedScene, out slotSource);
Debug.Log($"[TapADN] Editor ad {action}. type={adType}, scene={normalizedScene}, slot={DisplayEditorValue(slotId)}, source={slotSource}");
}
private static string ResolveEditorSlotId(ADConfig adConfig, TapadnControllerOptions options, AD_Type adType, string adScene, out string slotSource)
{
slotSource = "default";
switch (adType)
{
case AD_Type.AwardVideo:
var defaultRewardedSlotId = adConfig?.BaseAwardAdKeyValue?.value;
var rewardedSlotId = options?.ResolveRewardedSlotId(defaultRewardedSlotId, adScene, out var mapped) ?? defaultRewardedSlotId;
slotSource = mapped ? "scene" : "default";
return rewardedSlotId;
case AD_Type.Interaction:
return adConfig?.BaseInteractionAdKeyValue?.value;
case AD_Type.Splash:
return adConfig?.BaseSplashAdKeyValue?.value;
default:
slotSource = "unsupported";
return null;
}
}
private static string DisplayEditorValue(string value)
{
return string.IsNullOrWhiteSpace(value) ? "<empty>" : value.Trim();
}
}