跳到主要内容

网络诊断回调处理(DetectNetWortResultObserver)[仅限 Player Network SDK]

注册网络诊断的回调,游戏需要注册回调函数进行处理。更多关于回调数据结构,可以查看 GUADetectNetWortResult

注意

强烈建议游戏在应用启动函数中进行注册 [仅限 Player Network SDK]

函数定义

回调事件用于处理的方法列表

回调事件Common[仅限 Player Network SDK][仅限 MSD]
DetectNetWortResultEvents-网络诊断(StartDetectNetwork)-
event OnResultHandler<GUADetectNetworkResult> DetectNetWortResultEvents;

代码示例

UnionAdapterAPI.GetToolsService().DetectNetWortResultEvents += OnDetectNetWortResultEvents;

UnionAdapterAPI.GetToolsService().DetectNetWortResultEvents -= OnDetectNetWortResultEvents;

private void OnDetectNetWortResultEvents(GUADetectNetworkResult result)
{
string methodTag = "";
if (result.MethodId == (int)GUAMethodID.GUA_TOOLS_DETECT_NETWORK)
{
methodTag = "OnDetectNetworkResult";
}
Debug.Log(methodTag + result.ToString());
}