2026-06-04 17:16:17 +08:00
|
|
|
using System;
|
2026-06-17 15:40:25 +08:00
|
|
|
using System.Collections.Generic;
|
2026-06-04 17:16:17 +08:00
|
|
|
using Runtime.ADAggregator;
|
|
|
|
|
|
|
|
|
|
public static class TapadnCommercialization
|
|
|
|
|
{
|
|
|
|
|
public static TapadnAdController CreateController()
|
|
|
|
|
{
|
|
|
|
|
return new TapadnAdController();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void InitADManager(Action onCallback, string userId, ADConfig adConfig, params object[] args)
|
|
|
|
|
{
|
|
|
|
|
ADManager.Instance.Init(onCallback, userId, adConfig, CreateController(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ADConfig CreateConfig(
|
|
|
|
|
string mediaId,
|
|
|
|
|
string mediaKey,
|
|
|
|
|
string mediaName,
|
|
|
|
|
string rewardSlotId,
|
|
|
|
|
string interstitialSlotId = null,
|
|
|
|
|
string splashSlotId = null)
|
|
|
|
|
{
|
|
|
|
|
var config = UnityEngine.ScriptableObject.CreateInstance<ADConfig>();
|
|
|
|
|
config.ConfigName = "TapADN";
|
|
|
|
|
config.Id = mediaId;
|
|
|
|
|
config.Key = mediaKey;
|
|
|
|
|
config.Key2 = mediaName;
|
|
|
|
|
config.BaseAwardAdKeyValue = new AdKeyValue { key = "reward", value = rewardSlotId };
|
|
|
|
|
config.BaseInteractionAdKeyValue = new AdKeyValue { key = "interaction", value = interstitialSlotId };
|
|
|
|
|
config.BaseSplashAdKeyValue = new AdKeyValue { key = "splash", value = splashSlotId };
|
|
|
|
|
return config;
|
|
|
|
|
}
|
2026-06-17 15:40:25 +08:00
|
|
|
|
|
|
|
|
public static void SetRewardedSceneSlots(ADConfig config, IDictionary<string, string> sceneSlotIds)
|
|
|
|
|
{
|
|
|
|
|
if (config == null || sceneSlotIds == null || sceneSlotIds.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.CommonKeyValues == null)
|
|
|
|
|
{
|
|
|
|
|
config.CommonKeyValues = new List<AdKeyValue>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var entry in sceneSlotIds)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entry.Key) || string.IsNullOrWhiteSpace(entry.Value))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config.CommonKeyValues.Add(new AdKeyValue
|
|
|
|
|
{
|
|
|
|
|
key = TapadnControllerOptions.RewardedSceneSlotPrefix + entry.Key.Trim(),
|
|
|
|
|
value = entry.Value.Trim()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-06-04 17:16:17 +08:00
|
|
|
}
|