Cute_demon_attacks/meng_yao/Assets/script/scene_Main/ReviseName.cs

69 lines
2.5 KiB
C#
Raw Normal View History

2024-12-17 22:23:25 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ReviseName : mount
{
public Button ReviseBtn;
2024-12-18 20:32:37 +08:00
public Text NameText;
public Text IdText;
public Text island;
2024-12-18 21:04:28 +08:00
public GameObject headTanchuang;
2024-12-17 22:23:25 +08:00
// Start is called before the first frame update
void Start()
{
ReviseBtn.onClick.AddListener(ReviseClick);
}
public void ReviseClick()
{
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "verification_code", textName = " <20>޸<EFBFBD><DEB8>dz<EFBFBD>:", prompt = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵ<DEB8><C4B5>dz<EFBFBD>", Type = 0, is_required = true });
boxTypes.Add(new BoxType { Name = "submit", textName = " ȡ<><C8A1>ȷ<EFBFBD><C8B7> ", prompt = <><C8A1>", Type = 2 });
GameObject gameObject = add_pop_up(true);//<2F><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ĸ<EFBFBD><C4B8>
RectTransform rect = gameObject.GetComponent<RectTransform>();
rect.transform.position = new Vector3(Screen.width/2,Screen.height/2,0);
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "<22>޸<EFBFBD><DEB8>dz<EFBFBD>");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//<2F><>¼ȷ<C2BC><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
{
if (type == 0)//ȡ<><C8A1>
{
gameObject.GetComponent<input_box_pop_up_window>().destroy();
}
else if (type == 1)//<2F>
{
Debug.Log(boxTypes[0].content);
UpdatePlayerInfoResponse issuccefful = await Scene_main_jiekou.instance.UpdatePlayerInfos("nickname", boxTypes[0].content);
if (issuccefful.code ==200)
{
Promptmgr.Instance.PromptBubble("<22>޸<EFBFBD><DEB8>dzƳɹ<C6B3>");
2024-12-18 20:32:37 +08:00
NameText.text = issuccefful.data.nickname;
//IdText.text = issuccefful.data.nickname;
2024-12-18 21:04:28 +08:00
headTanchuang.GetComponent<HeadTanchuang>().UpdateShow();
2024-12-17 22:23:25 +08:00
gameObject.GetComponent<input_box_pop_up_window>().destroy();
}
else
{
Promptmgr.Instance.PromptBubble(issuccefful.message);
}
}
});
}
2024-12-18 21:04:28 +08:00
public async void UpdateShow()
2024-12-17 22:23:25 +08:00
{
2024-12-18 20:32:37 +08:00
PlayerInfoData info = await Scene_main_jiekou.instance.PlayerInfos();
this.NameText.text = info.nickname.ToString();
this.IdText.text = info.uid.ToString();
island.text = "<22><><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>"+info.island_name;
2024-12-18 21:04:28 +08:00
this.gameObject.SetActive(true);
2024-12-17 22:23:25 +08:00
}
}