You've already forked Commercialization.topon
update core
This commit is contained in:
52
Assets/Topon_Adapter/Runtime/Scripts/ToponAdController.cs
Normal file
52
Assets/Topon_Adapter/Runtime/Scripts/ToponAdController.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
// ATSdkUtil.
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user