fix: support legacy TapADN rewarded scene slots

This commit is contained in:
2026-06-17 18:15:02 +08:00
parent 9c99482b2d
commit 3f527fa94d
6 changed files with 120 additions and 7 deletions

View File

@@ -162,6 +162,7 @@ public sealed class TapadnIAAAdDebugSampleGui : MonoBehaviour
GUILayout.Label($"Last EventLog: {_lastEventLog}", _textStyle);
GUILayout.Label($"Last SDK Version: {DisplayValue(TapadnAdController.LastSdkVersion)}", _textStyle);
GUILayout.Label($"Last Init Error: {DisplayValue(TapadnAdController.LastInitError)}", _textStyle);
GUILayout.Label($"Rewarded Selected SpaceId: {GetResolvedRewardedSlotForDisplay(rewardedScenario)}", _textStyle);
}
else
{
@@ -250,6 +251,7 @@ public sealed class TapadnIAAAdDebugSampleGui : MonoBehaviour
if (EnsureInitialized(label))
{
LogRewardedResolvedSlot(adType, scenario, "Enter scenario");
ADManager.Instance.EnterAdScenario(adType, scenario);
AppendLog($"Enter scenario requested. type={adType}, scenario={scenario}");
}
@@ -278,6 +280,7 @@ public sealed class TapadnIAAAdDebugSampleGui : MonoBehaviour
if (EnsureInitialized(label))
{
LogRewardedResolvedSlot(adType, scenario, "AsyncPlayAD");
ADManager.Instance.AsyncPlayAD(adType, scenario, result =>
{
AppendLog($"{adType} callback: {result}");
@@ -424,6 +427,30 @@ public sealed class TapadnIAAAdDebugSampleGui : MonoBehaviour
}
AppendLog($"Options => mediaId={options.MediaId}, channel={options.Channel}, sub={options.SubChannel}, debug={options.Debug}, rewardAuto={options.RewardedAutoLoad}, interAuto={options.InterstitialAutoLoad}, splashAuto={options.SplashAutoLoad}");
AppendLog($"Rewarded selected slot => {GetResolvedRewardedSlotForDisplay(rewardedScenario)}, configuredSceneSlots={options.RewardedSceneSlotIds?.Count ?? 0}");
}
private void LogRewardedResolvedSlot(AD_Type adType, string scenario, string actionName)
{
if (adType != AD_Type.AwardVideo)
{
return;
}
AppendLog($"{actionName} rewarded slot => {GetResolvedRewardedSlotForDisplay(scenario)}");
}
private string GetResolvedRewardedSlotForDisplay(string scenario)
{
var defaultSlotId = adConfig?.BaseAwardAdKeyValue?.value;
var options = TapadnAdController.CurrentOptions;
if (options == null)
{
return $"{DisplayValue(defaultSlotId)} (source=default, scenario={DisplayValue(scenario)})";
}
var slotId = options.ResolveRewardedSlotId(defaultSlotId, scenario, out var mapped);
return $"{DisplayValue(slotId)} (source={(mapped ? "scene" : "default")}, scenario={DisplayValue(scenario)})";
}
private void OnRewardedBefore(string placementId, string scenario)