using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using static Manager; public class ShuJuYuanItem : MonoBehaviour { public Text t1; public Text t2; public Text t3; public Text t4; public Text t5; public Toggle tg1; public Toggle tg2; public GameObject go; public Text numtext; public void init(Detail d) { t1.text = d.name; t2.text = d.update_rate_display; switch (d.current_data_source) { case 1: t3.text = "云能智维实时数据"; t3.color = Color.green; break; default: t3.text = "云能智维备份数据"; t3.color = new Color(277, 115, 24, 255); break; } t4.text = d.check_time; t5.text = d.real_data_status == 1 ? "正常" : "不正常"; t5.color = d.real_data_status == 1 ?Color.green : Color.red; tg1.isOn = d.update_rate_type == 2 ? false : true; tg2.isOn = d.update_rate_type != 2 ? false : true; num = d.update_Rate_value; if (num <= 1) { removeb.interactable = false; } else { removeb.interactable = true; } if (num >= 24) { addb.interactable = false; } else { addb.interactable = true; } numtext.text = num.ToString(); go.SetActive(tg2.isOn); tg2.onValueChanged.RemoveAllListeners(); tg2.onValueChanged.AddListener((b)=> { go.SetActive(b); }); } int num = 1; public Button addb; public Button removeb; public void changenum(int i) { num += i; if(num <=1) { removeb.interactable = false; } else { removeb.interactable = true; } if (num >= 24) { addb.interactable = false; } else { addb.interactable = true; } numtext.text = num.ToString(); } }