47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using System;
|
||
using NetEase;
|
||
using UnityEngine;
|
||
|
||
public class YiDunHtpCallback : HTPCallback
|
||
{
|
||
//
|
||
private readonly Action<int,string> _onRecvAction;
|
||
public YiDunHtpCallback(Action<int,string> action)
|
||
{
|
||
// throw new NotImplementedException();
|
||
_onRecvAction += action;
|
||
}
|
||
public void onReceive(int code, string msg)
|
||
{
|
||
Debug.Log("Call InitCallBack");
|
||
Debug.Log("code = " + code + " msg = " + msg);
|
||
// 如果code == 200,说明反外挂一切正常
|
||
// 如果code == 400,请将 msg 发送到贵方服务端,由贵方服务端通过[getConfig接口](https://support.dun.163.com/documents/761315885761396736?docId=771983453572567040)转发给易盾服务端,由易盾服务端响应
|
||
// 易盾服务端返回结果,再将结果通过 通用查询接口(Cmd_SetConfigData) 反馈给反外挂sdk
|
||
NetSecProtect.ioctl(RequestCmdID.Cmd_SetConfigData, msg); // responseData为易盾服务端返回的数据
|
||
_onRecvAction.Invoke(code,msg);
|
||
}
|
||
}
|
||
|
||
public class YiDunGetTokenCallback : GetTokenCallback
|
||
{
|
||
private readonly Action<int,string> _onRecvAction;
|
||
public YiDunGetTokenCallback(Action<int,string> action)
|
||
{
|
||
_onRecvAction += action;
|
||
}
|
||
public void onResult(AntiCheatResult antiCheatResult)
|
||
{
|
||
if (antiCheatResult.code == AntiCheatResult.OK)
|
||
{
|
||
var token = antiCheatResult.token;
|
||
Debug.Log("token:" + token);
|
||
_onRecvAction.Invoke(antiCheatResult.code, token);
|
||
}
|
||
else
|
||
{
|
||
// 请根据错误码,检测相关代码
|
||
_onRecvAction.Invoke(antiCheatResult.code,antiCheatResult.codeStr);
|
||
}
|
||
}
|
||
} |