/***初始化SDK*/privatestaticvoidinitSDK(Stringappid,Stringappkey){ProxySelectordefaultProxySelector=ProxySelector.getDefault();Proxyproxy=null;ListproxyList=null;try{proxyList=defaultProxySelector.select(newURI("http://www.google.it"));}catch(URISyntaxExceptione){e.printStackTrace();}if(proxyList!=null&&proxyList.size()>0){proxy=proxyList.get(0);Log.d(TAG,"CurrentProxyConfiguration:"+proxy.toString());}AppInfoappInfo=newAppInfo();appInfo.setAppId(appid);//应用IDappInfo.setAppKey(appkey);//应用KeyappInfo.setCtx(ctx);/**VersionCheckLevelNormal版本检查失败可以继续进行游戏VersionCheckLevelStrict*版本检查失败则不能进入游戏默认取值为VersionCheckLevelStrict*/appInfo.setVersionCheckStatus(AppInfo.VERSION_CHECK_LEVEL_STRICT);//初始化SDKCommplatform.getInstance().Init(0,appInfo,newCallbackListener(){@Overridepublicvoidcallback(finalintparamInt,IntegerparamT){ctx.runOnUiThread(newRunnable(){@Overridepublicvoidrun(){Log.i(TAG,"InitparamInt="+paramInt);//ok.setEnabled(true);LogUtil.send("初始化:"+paramInt);}});}});}/***用户登录**/publicstaticvoidloginEx(Contextcontext){Bundlebundle=newBundle();bundle.putString("nounce",UUID.randomUUID().toString().replace("-",""));Commplatform.getInstance().LoginEx(context,bundle,newCallbackListener(){@Overridepublicvoidcallback(intresultCode,Bundlebundle){if(resultCode==ErrorCode.COM_PLATFORM_SUCCESS){//完成参数验签//处理登录成功逻辑//HomeActivity.show(ctx);//Stringuin=bundle.getString("uin");LogUtil.send("登录成功:");//Stringuin=bundle.get("nounce").toString();Stringuin=Commplatform.getInstance().getLoginUin();LogUtil.send("登录成功uin:"+uin);UnityPlayer
1