123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System.Collections;
- using System.Collections.Generic;
- using LitJson;
- using UnityEngine;
- using UnityEngine.UI;
- using static Manager;
- public class UserInfoCheck : MonoBehaviour
- {
- public GameObject savesuccess;
- public GameObject savefail;
- public Text tacc;
- public InputField iname;
- public InputField ibumen;
- public InputField izhiwu;
- public InputField ibeizhu;
- UserInfo uinfo ;
- private void OnEnable()
- {
- if (DataManager.Instance)
- {
- DataManager.Instance.getuserinfo((msg) => {
- uinfo =msg;
- Invoke("updatedata",0.5f);
- });
- }
-
- }
- void updatedata()
- {
- tacc.text = uinfo.count;
- iname.text = uinfo.name;
- ibumen.text = uinfo.position;
- izhiwu.text = uinfo.dept;
- ibeizhu.text = uinfo.notes;
- }
- public void changeInfo()
- {
- UserInfo uinfo =new UserInfo();
- uinfo.name = iname.text;
- uinfo.dept = izhiwu.text;
- uinfo.position = ibumen.text;
- uinfo.notes = ibeizhu.text;
- DataManager.Instance.setuserinfo(uinfo,(msg) => {
- JsonData d = JsonMapper.ToObject(msg);
- try{
- if(d["data"]==null)
- {
- savefail.GetComponentInChildren<Text>().text = d["message"].ToString();
- savefail.SetActive(true);
- }
- else
- {
- savesuccess.SetActive(true);
- Invoke("savecloes",2f);
-
- }
- }
- catch{
- savefail.GetComponentInChildren<Text>().text = "失败";
- savefail.SetActive(true);
- }
- });
- }
- void savecloes()
- {
- savesuccess.SetActive(false);
- MainCenterManager.Instance.showMain();
- }
- }
|