2023-01-29 12:44:57 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using AnyThinkAds.Api;
|
|
|
|
|
|
using Runtime.ADAggregator;
|
|
|
|
|
|
|
|
|
|
|
|
public class ToponAdController : IAdController
|
|
|
|
|
|
{
|
|
|
|
|
|
private Action<bool> _maskAction;
|
|
|
|
|
|
private Action<string, string> _logEventAction;
|
|
|
|
|
|
|
|
|
|
|
|
private ADConfig _adConfig;
|
|
|
|
|
|
|
|
|
|
|
|
public void Init(ADConfig adConfig, object[] args)
|
|
|
|
|
|
{
|
|
|
|
|
|
_adConfig = adConfig;
|
2023-09-04 16:57:46 +08:00
|
|
|
|
// ATSdkUtil.
|
2023-01-29 12:44:57 +08:00
|
|
|
|
ATSDKAPI.setChannel(args[0].ToString());
|
|
|
|
|
|
ATSDKAPI.setLogDebug(args.Length > 1 && (bool)args[1]);
|
|
|
|
|
|
ATSDKAPI.initSDK(adConfig.Id , adConfig.Key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetListener(Action<bool> adMaskAction ,Action<string, string> logEventAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
_maskAction = adMaskAction;
|
|
|
|
|
|
_logEventAction = logEventAction;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ADPlayer CreateAdPlayer(AD_Type type)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case AD_Type.AwardVideo:
|
|
|
|
|
|
var awardVideoPlayer = new AwardVideoPlayer();
|
|
|
|
|
|
return awardVideoPlayer.Init(_adConfig.BaseAwardAdKeyValue.value);
|
|
|
|
|
|
case AD_Type.Splash:
|
|
|
|
|
|
break;
|
|
|
|
|
|
case AD_Type.Interaction:
|
|
|
|
|
|
var interactionPlayer = new InteractionPlayer();
|
|
|
|
|
|
return interactionPlayer.Init(_adConfig.BaseInteractionAdKeyValue.value);
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void EventLog(string eventTable, string eventValue, string eventMessage = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_logEventAction?.Invoke(eventTable , eventValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetMask(bool isOpen)
|
|
|
|
|
|
{
|
|
|
|
|
|
_maskAction?.Invoke(isOpen);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|