using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using static Manager; public class ShuJuYuanGuanLi : MonoBehaviour { public Toggle xst; public Toggle yct; public Toggle yt; public Toggle zt; public Toggle dt; public Text dqsj; public Toggle bzt; public Toggle bst; public Toggle szt; public Toggle sst; public GameObject go; public List golist; private void Awake() { yt.onValueChanged.AddListener((b) => { if(b&& ainfo!=null) { refinfo(ainfo.yunneng_option); } }); zt.onValueChanged.AddListener((b) => { if (b && ainfo != null) { refinfo(ainfo.zongji_ption); } }); dt.onValueChanged.AddListener((b) => { if (b && ainfo != null) { refinfo(ainfo.donghuan_option); } }); } private void OnDestroy() { yt.onValueChanged.RemoveAllListeners(); zt.onValueChanged.RemoveAllListeners(); dt.onValueChanged.RemoveAllListeners(); } public void refinfo(Toption t) { for (int i = 0; i < golist.Count; i++) { Destroy(golist[i]); } switch(t.current_data_source) { case 1: dqsj.text = "云能智维实时数据"; dqsj.color = Color.green; break; default: dqsj.text = "云能智维备份数据"; dqsj.color = new Color(277,115,24,255); break; } bzt.isOn = t.backup_data_switch_type == 1 ? true : false; bst.isOn = t.backup_data_switch_type != 1 ? true : false; szt.isOn = t.data_recover_type == 1 ? true : false; sst.isOn = t.data_recover_type != 1 ? true : false; for (int i = 0; i ().init(t.details[i]); golist.Add(ngo); } } AdminsystemInfo ainfo; private void OnEnable() { if(DataManager.Instance) { DataManager.Instance.getInfo((msg) => { ainfo = msg; xst.isOn = msg.general_option.update_time_display_switch; yct.isOn = !msg.general_option.update_time_display_switch; yt.isOn = true; refinfo(msg.yunneng_option); }); } } }