/// <summary> /// 初始化登录信息 /// </summary> private void InitLoginInfo() { string path = "LoginInfo.config"; string decriptStr = FileOperationUtils.FileRead(path); string jsonstr = SecurityUtils.AESDecrypt(decriptStr, key, iv); if (jsonstr != null) { SaveLoginInfo info = JsonMapper.ToObject <SaveLoginInfo>(jsonstr); loginType = (LoginType)info.loginType; if (loginType == LoginType.WX) { LoginWeiXinInit(info); } } else { //没有保存的登录信息 重新登录 login.gameObject.SetActive(true); loginType = LoginType.WX; account = null; password = null; headimg = null; username = null; } }
/// <summary> /// 微信二次登陆 /// </summary> private void LoginWeiXinInit(SaveLoginInfo info) { // 头像 LoadHeadImgUtils.Instance.LoadHeadImg(thirdLogin.GetChild(1).GetComponent <Image>(), info.headimg); account = info.account; password = info.password; loginType = (LoginType)info.loginType; headimg = info.headimg; username = info.username; // 登录类型 thirdLogin.GetChild(2).GetComponent <Image>().sprite = GameTools.Instance.GetSpite("Sprite/LoginType/" + loginType.ToString()); thirdLogin.GetChild(3).GetComponent <Text>().text = info.username; login.gameObject.SetActive(false); thirdLogin.gameObject.SetActive(true); }
private void SaveLoginInfo() { SaveLoginInfo info = new SaveLoginInfo(); info.loginType = (int)loginType; info.account = account; info.password = password; info.username = username; info.headimg = headimg; string infojson = JsonMapper.ToJson(info); string encriptStr = SecurityUtils.AESEncrypt(infojson, kv[0], kv[1]); DebugUtils.DebugerExtension.Log(this, encriptStr); FileOperationUtils.FileWrite("LoginInfo.config", encriptStr); }