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; private void OnEnable() { if (DataManager.Instance) { DataManager.Instance.getuserinfo((msg) => { tacc.text = msg.count; iname.text = msg.name; ibumen.text = msg.dept; izhiwu.text = msg.position; ibeizhu.text = msg.notes; }); } } public void changeInfo() { UserInfo uinfo =new UserInfo(); uinfo.name = iname.text; uinfo.dept = ibumen.text; uinfo.position = izhiwu.text; uinfo.notes = ibeizhu.text; DataManager.Instance.setuserinfo(uinfo,(msg) => { try{ JsonData d = JsonMapper.ToObject(msg); if(d["data"]==null) { savefail.SetActive(true); Invoke("savefailcloes",2f); } else { savesuccess.SetActive(true); Invoke("savecloes",2f); } } catch{ savefail.SetActive(true); Invoke("savefailcloes",2f); } }); } void savecloes() { savesuccess.SetActive(false); MainCenterManager.Instance.showMain(); } void savefailcloes() { savefail.SetActive(false); } }