using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ReviseName : mount { public Button ReviseBtn; public Text RevisrText; public Text MainnameText; // Start is called before the first frame update void Start() { ReviseBtn.onClick.AddListener(ReviseClick); } public void ReviseClick() { List boxTypes = new List(); boxTypes.Add(new BoxType { Name = "verification_code", textName = " 修改昵称:", prompt = "请输入修改的昵称", Type = 0, is_required = true }); boxTypes.Add(new BoxType { Name = "submit", textName = " 取消确定 ", prompt = "取消", Type = 2 }); GameObject gameObject = add_pop_up(true);//生成弹窗母体 RectTransform rect = gameObject.GetComponent(); rect.transform.position = new Vector3(Screen.width/2,Screen.height/2,0); List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "修改昵称");//测试输入框回调处理 gameObjects[1].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 { if (type == 0)//取消 { gameObject.GetComponent().destroy(); } else if (type == 1)//提交 { Debug.Log(boxTypes[0].content); UpdatePlayerInfoResponse issuccefful = await Scene_main_jiekou.instance.UpdatePlayerInfos("nickname", boxTypes[0].content); if (issuccefful.code ==200) { Promptmgr.Instance.PromptBubble("修改昵称成功"); RevisrText.text = issuccefful.data.nickname; MainnameText.text = issuccefful.data.nickname; gameObject.GetComponent().destroy(); } else { Promptmgr.Instance.PromptBubble(issuccefful.message); } } }); } // Update is called once per frame void Update() { } }