1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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) => {
- 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);
- }
- }
|