/// <summary> /// 异步获取机型分档 /// </summary> /// <param name="domainName">配置域名</param> /// <param name="handler">回调handler</param> public static void CheckDeviceClassAsync(string domainName, GPMDeviceLevelEventHandle handler) { #if UNITY_IOS && !UNITY_EDITOR System.Threading.Thread thr = new System.Threading.Thread( delegate() { string path = Application.streamingAssetsPath; int quality = gpm_checkDCLSByQccSync(path, domainName); handler(quality); } ); thr.Start(); #elif UNITY_ANDROID && !UNITY_EDITOR string vendor = SystemInfo.graphicsDeviceVendor; string renderer = SystemInfo.graphicsDeviceName; if (sGPMObj == null) { return; } System.Threading.Thread thr = new System.Threading.Thread( delegate() { //HawkLogMsg("thread try to attach to jni environment"); int ret = AndroidJNI.AttachCurrentThread(); if (ret < 0) { //HawkLogError("thread attach to jni enviromnet failed"); return; } //HawkLogMsg("begin check dcls async " + vendor + " " + renderer); //int quality = _checkdclsByQccSync(configureDomainName, vendor, renderer); int quality = sGPMObj.Call <int>("checkDCLSByQccSync", new object[] { domainName, vendor, renderer }); // HawkLogMsg("recv quality, exec callback"); handler(quality); AndroidJNI.DetachCurrentThread(); // HawkLogMsg("thread detach to jni environment"); } ); thr.Start(); #endif }
void IGPMService.CheckDeviceClassAsync(string domainName, GPMDeviceLevelEventHandle handler) { GPMAgent.CheckDeviceClassAsync(domainName, handler); }