using System; using UnityEngine; using UnityEngine.UI; public class FacilityUIList : MonoBehaviour { private FacilityManager FacilityMgr { get { if (this.m_FacilityMgr == null) { this.m_FacilityMgr = GameMain.Instance.FacilityMgr; } return this.m_FacilityMgr; } } public void Show() { this.SetupFacilityListButton(); } private void SetupFacilityListButton() { Facility[] facilityArray = this.FacilityMgr.GetFacilityArray(); this.m_uGUIListViewer.Show(facilityArray.Length, delegate(int i, Transform trans) { Facility facility = facilityArray[i]; if (!facility) { UnityEngine.Object.Destroy(trans.gameObject); return; } Facility.FacilityStatus param = facility.param; int typeID = param.typeID; string name = param.name; Text componentInChildren = trans.GetComponentInChildren(); Toggle componentInChildren2 = trans.GetComponentInChildren(); componentInChildren.text = name; componentInChildren2.onValueChanged.RemoveAllListeners(); componentInChildren2.onValueChanged.AddListener(delegate(bool isOn) { if (!isOn) { return; } c__AnonStorey.m_Manager.OpenFacilityUIPowerUpList(facility); c__AnonStorey.m_Manager.UpdateFacilityInfo(facility); }); }); } [SerializeField] private FacilityPowerUpManager m_Manager; [SerializeField] private uGUIListViewer m_uGUIListViewer; private FacilityManager m_FacilityMgr; }