1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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);
- }
- }
|