using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class EditPanel : Base { public UserInfomation14 userInfomation14; public InputField UserInputField; public Text username; public PerSonalCenterPanel perSonalCenterPanel; // Start is called before the first frame update async void Start() { Dictionary head14 = new Dictionary { { "Authorization", Global.global.serverResponse.data.token } }; // 异步查询玩家信息 string response14 = await web.SendRequest(web.URL + "/snail/user/queryUserInfo", "POST", "{}", head14); Debug.Log("1.4查询玩家信息" + response14); userInfomation14 = JsonConvert.DeserializeObject(response14); username.text = "" + userInfomation14.data.nickName; } // Update is called once per frame void Update() { } public async void SetEditPanel() { Dictionary head13 = new Dictionary { { "Authorization", Global.global.serverResponse.data.token } }; ChangeDetailbody body= new ChangeDetailbody(); body.nickName = UserInputField.text; Debug.Log(UserInputField.text); body.birthday = userInfomation14.data.birthday; body.gender= userInfomation14.data.gender; body.headImg = userInfomation14.data.headImg; Debug.Log("入参"+ JsonUtility.ToJson(body)); string loginResponse = await web.SendRequest(web.URL + "/snail/user/update", "POST", JsonUtility.ToJson(body), head13); ChangeReturn response = JsonUtility.FromJson(loginResponse); if (response.code==200) { Debug.Log("1.3完善用户信息"+ loginResponse); perSonalCenterPanel.GetPlayerInfo(); Global.global.scene_Main_Jiekou.getPlayerInfo(); } else { addEventPopUp(response.message); } Debug.Log(response); transform.gameObject.SetActive(false); } } public class ChangeDetailbody//登录和注册用 { public string nickName = ""; public string headImg = ""; public int gender = 0; public string birthday = ""; } public class ChangeReturn { public int code; public string message; public bool data; }