public void testLogin(string uin) { LoginVO lvo = new LoginVO(); try { lvo.openId = "" + uin; lvo.nickName = "" + uin; lvo.headIcon = ""; lvo.unionid = "" + uin; lvo.province = "广东省"; lvo.city = "深圳"; lvo.sex = 1; lvo.IP = GameManager.getInstance().getIpAddress(); String msg = JsonMapper.ToJson(lvo); GameManager.getInstance().Server.requset(APIS.LOGIN_REQUEST, msg); AvatarVO avo = new AvatarVO(); avo.account = new Account(); avo.account.city = lvo.city; avo.account.openid = lvo.openId; avo.account.nickname = lvo.nickName; avo.account.headicon = lvo.headIcon; avo.account.unionid = lvo.city; avo.account.sex = lvo.sex; avo.IP = lvo.IP; GlobalData.getInstance().myAvatarVO = avo; } catch (Exception e) { Debug.Log(e.ToString()); TipsManager.getInstance().setTips("请先打开你的微信客户端"); return; } //GameManager.getInstance().Server.requset(new LoginRequest(null)); }
/** * 获取微信个人信息成功回调,登录 * */ public void getUserInforCallback(int reqID, ResponseState state, PlatformType type, Hashtable data) { //TipsManagerScript.getInstance ().setTips ("获取个人信息成功"); if (data != null) { MyDebug.Log(data.toJson()); LoginVO lvo = new LoginVO(); try { lvo.openId = (string)data ["openid"]; lvo.nickName = (string)data ["nickname"]; lvo.headIcon = (string)data ["headimgurl"]; lvo.unionid = (string)data ["unionid"]; lvo.province = (string)data ["province"]; lvo.city = (string)data ["city"]; string sex = data ["sex"].ToString(); lvo.sex = int.Parse(sex); lvo.IP = GameManager.getInstance().getIpAddress(); String msg = JsonMapper.ToJson(lvo); GameManager.getInstance().Server.requset(APIS.LOGIN_REQUEST, msg); AvatarVO avo = new AvatarVO(); avo.account = new Account(); avo.account.city = lvo.city; avo.account.openid = lvo.openId; avo.account.nickname = lvo.nickName; avo.account.headicon = lvo.headIcon; avo.account.unionid = lvo.city; avo.account.sex = lvo.sex; avo.IP = lvo.IP; GlobalData.getInstance().myAvatarVO = avo; MyDebug.Log(" loginvo.nickName:" + lvo.nickName); } catch (Exception e) { MyDebug.Log("微信接口有变动!" + e.Message); TipsManager.getInstance().setTips("请先打开你的微信客户端"); return; } } else { TipsManager.getInstance().setTips("微信登录失败"); } }