/// <summary> /// 授权回调 /// </summary> /// <param name="reqID">Req identifier.</param> /// <param name="state">State.</param> /// <param name="type">Type.</param> /// <param name="result">Result.</param> void OnAuthResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result) { if (state == ResponseState.Success) { RequestOther requestOther = new RequestOther(); #if UNITY_ANDROID requestOther.uid = result["openid"].ToString(); requestOther.loginType = 1; requestOther.headImg = result["icon"].ToString(); requestOther.userName = result["nickname"].ToString(); requestOther.equitment = SystemInfo.deviceUniqueIdentifier; #elif UNITY_IOS requestOther.uid = result["openid"].ToString(); requestOther.loginType = 1; requestOther.headImg = result["headimgurl"].ToString(); requestOther.userName = result["nickname"].ToString(); requestOther.equitment = SystemInfo.deviceUniqueIdentifier; #endif if (authWechat != null) { authWechat(requestOther); authWechat = null; } //if (result != null && result.Count > 0) //{ // print("authorize success !" + "Platform :" + type + "result:" + MiniJSON.jsonEncode(result)); //} //else //{ // print("authorize success !" + "Platform :" + type); //} } else if (state == ResponseState.Fail) { #if UNITY_ANDROID print("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]); #elif UNITY_IPHONE print("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]); #endif } else if (state == ResponseState.Cancel) { print("cancel !"); } }
public void AuthWechat(Callback <RequestOther> callback) { #if UNITY_EDITOR RequestOther requestOther = new RequestOther(); requestOther.uid = "o0ray0iVuIB4CDxi_l_BgerD5Kw8"; requestOther.loginType = 1; requestOther.headImg = "http://thirdwx.qlogo.cn/mmopen/vi_32/9RU5gXnwDosiaTn2VgyviajNpYalYoOEuUs3JJbtFjYbJWaT4Nq2j9Qw193FSwFVwePyuLWBGSSxfLf1E2HjSOdQ/132"; requestOther.userName = "******"; requestOther.equitment = SystemInfo.deviceUniqueIdentifier; if (callback != null) { callback(requestOther); } #else authWechat = callback; shareSDK.Authorize(PlatformType.WeChat); #endif }