private void OnAuthHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
    {
        Debug.Log("OnAuthHandler state : " + state);
        Debug.Log("OnAuthHandler reqID : " + reqID + " type : " + type);
        Debug.Log("OnAuthHandler data : " + data.toJson());

        if (state == ResponseState.Success)
        {
            if (type == PlatformType.QQ)
            {
                Hashtable datatemp = mShareSDK.GetAuthInfo(type);
                Debug.Log("OnAuthHandler qqdata : " + datatemp.toJson());

                QQData qqdata = JsonUtility.FromJson<QQData>(datatemp.toJson());
                StartCoroutine(QQWebAuth(qqdata));
            }
            else if (type == PlatformType.WeChat)
            {
#if UNITY_ANDROID
                Hashtable datatemp = mShareSDK.GetAuthInfo(type);
                Debug.Log("OnAuthHandler wechatdata : " + datatemp.toJson());

                WechatData wechatdata = JsonUtility.FromJson<WechatData>(datatemp.toJson());
                string token = wechatdata.token;
                string openid = wechatdata.openID;
                string unionid = wechatdata.unionID;
                
                // <<<< clark_add_20190902
                string userId = wechatdata.userID;
                string userName = wechatdata.userName;
                string userIcon = wechatdata.userIcon;
                string userGender = wechatdata.userGender;
                if (userGender == "m")
                    userGender = "Male";
                else
                    userGender = "Female";
                // >>>>
           
                //Debug.Log("OnAuthHandler wechatdata token : " + token + " openid : " + openid + " unionid : " + unionid);

                // <<<< clark_add_20190902
                statusText.GetComponentInChildren<Text>().text = "Login success!!!";
                responseInfo.GetComponentInChildren<Text>().text = " userID : " + userId + "\n\n userName : "******"\n\n Gender : " + userGender + "\n\n PhotoURL : " + userIcon;
                StartCoroutine(setImage(userIcon));
                //responseInfo.GetComponentInChildren<Text>().text = datatemp.toJson();
                // >>>>
#endif

#if UNITY_IPHONE
				PhoneWechatData wechatdata = JsonUtility.FromJson<PhoneWechatData>(data.toJson());
				string token = wechatdata.access_token;
				string openid = wechatdata.openid;
				string unionid = wechatdata.unionid;
				Debug.Log("OnAuthHandler wechatdata token : " + token + " openid : " + openid + " unionid : " + unionid);
#endif
            }
        }
    }
예제 #2
0
    private void OnAuthHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
    {
        Debug.Log("OnAuthHandler state : " + state);
        Debug.Log("OnAuthHandler reqID : " + reqID + " type : " + type);
        Debug.Log("OnAuthHandler data : " + data.toJson());

        if (state == ResponseState.Success)
        {
            if (type == PlatformType.QQ)
            {
                Hashtable datatemp = mShareSDK.GetAuthInfo(type);
                Debug.Log("OnAuthHandler qqdata : " + datatemp.toJson());

                QQData qqdata = JsonUtility.FromJson <QQData>(datatemp.toJson());
                StartCoroutine(QQWebAuth(qqdata));
            }
            else if (type == PlatformType.WeChat)
            {
#if UNITY_ANDROID
                Hashtable datatemp = mShareSDK.GetAuthInfo(type);
                Debug.Log("OnAuthHandler wechatdata : " + datatemp.toJson());

                WechatData wechatdata = JsonUtility.FromJson <WechatData>(datatemp.toJson());
                string     token      = wechatdata.token;
                string     openid     = wechatdata.openID;
                string     unionid    = wechatdata.unionID;
                Debug.Log("OnAuthHandler wechatdata token : " + token + " openid : " + openid + " unionid : " + unionid);
#endif

#if UNITY_IPHONE
                PhoneWechatData wechatdata = JsonUtility.FromJson <PhoneWechatData>(data.toJson());
                string          token      = wechatdata.access_token;
                string          openid     = wechatdata.openid;
                string          unionid    = wechatdata.unionid;
                Debug.Log("OnAuthHandler wechatdata token : " + token + " openid : " + openid + " unionid : " + unionid);
#endif
            }
        }
    }