61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using System;
|
|
using asap.core;
|
|
using Newtonsoft.Json.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace tysdk
|
|
{
|
|
public partial class TYSdkFacade : MonoBehaviour
|
|
{
|
|
/*================================================
|
|
|
|
_ ____
|
|
/ \ | _ \
|
|
/ _ \ | | | |
|
|
/ ___ \| |_| |
|
|
/_/ \_\____/
|
|
|
|
=================================================*/
|
|
|
|
public void InitAdCallback(string jstr)
|
|
{
|
|
try{
|
|
var jobj = JObject.Parse(jstr);
|
|
if(jobj["code"].ToString() == "0")
|
|
UnityEngine.Debug.Log($"[TYSdkFacade] InitAdCallback Success");
|
|
else
|
|
UnityEngine.Debug.LogError($"[TYSdkFacade] InitAdCallback Failed ");
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
UnityEngine.Debug.LogError($"[TYSdkFacade] InitAdCallback error: {e.Message}");
|
|
}
|
|
}
|
|
|
|
public void LoadAdCallback(string jstr)
|
|
{
|
|
try
|
|
{
|
|
var adLoadinfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ADLoadInfo>(jstr);
|
|
GContext.Publish(adLoadinfo);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
UnityEngine.Debug.LogError($"[TYSdkFacade] LoadAdCallback error: {e.Message}");
|
|
}
|
|
}
|
|
|
|
public void ShowAdCallback(string jstr)
|
|
{
|
|
try
|
|
{
|
|
var adShowInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ShowADInfo>(jstr);
|
|
GContext.Publish(adShowInfo);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
UnityEngine.Debug.LogError($"[TYSdkFacade] ShowAdCallback error: {e.Message}");
|
|
}
|
|
}
|
|
}
|
|
} |