using AX.NetworkSystem; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class DisasterItem : MonoBehaviour { public DisasterInfo msg = new DisasterInfo(); private GameObject selectedImg; private Text disasterName; private Text disasterTime; private Button del; public void OnEnable() { GetComponent().onValueChanged.AddListener(OnValueChanged); } public void OnDisable() { GetComponent().onValueChanged.RemoveListener(OnValueChanged); } public void OnDestroy() { GetComponent().onValueChanged.RemoveListener(OnValueChanged); del.onClick.RemoveListener(Delete); } public void OnValueChanged(bool value) { //selectedImg.SetActive(value); if (value) { disasterName.color = Color.cyan; disasterTime.color = Color.cyan; UpdateManager.Instance.selectedMsg = this.msg; } else { disasterName.color = Color.white; disasterTime.color = Color.white; } } // Use this for initialization void Awake () { GetComponent().group = transform.parent.GetComponent(); selectedImg = transform.Find("Selected").gameObject; selectedImg.SetActive(false); disasterName = transform.Find("DisasterName").GetComponent(); disasterTime = transform.Find("DisasterTime").GetComponent(); del = transform.Find("Delete").GetComponent