FacilityUIList.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class FacilityUIList : MonoBehaviour
  5. {
  6. private FacilityManager FacilityMgr
  7. {
  8. get
  9. {
  10. if (this.m_FacilityMgr == null)
  11. {
  12. this.m_FacilityMgr = GameMain.Instance.FacilityMgr;
  13. }
  14. return this.m_FacilityMgr;
  15. }
  16. }
  17. public void Show()
  18. {
  19. this.SetupFacilityListButton();
  20. }
  21. private void SetupFacilityListButton()
  22. {
  23. Facility[] facilityArray = this.FacilityMgr.GetFacilityArray();
  24. this.m_uGUIListViewer.Show<Transform>(facilityArray.Length, delegate(int i, Transform trans)
  25. {
  26. Facility facility = facilityArray[i];
  27. if (!facility)
  28. {
  29. UnityEngine.Object.Destroy(trans.gameObject);
  30. return;
  31. }
  32. Facility.FacilityStatus param = facility.param;
  33. int typeID = param.typeID;
  34. string name = param.name;
  35. Text componentInChildren = trans.GetComponentInChildren<Text>();
  36. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  37. componentInChildren.text = name;
  38. componentInChildren2.onValueChanged.RemoveAllListeners();
  39. componentInChildren2.onValueChanged.AddListener(delegate(bool isOn)
  40. {
  41. if (!isOn)
  42. {
  43. return;
  44. }
  45. <SetupFacilityListButton>c__AnonStorey.m_Manager.OpenFacilityUIPowerUpList(facility);
  46. <SetupFacilityListButton>c__AnonStorey.m_Manager.UpdateFacilityInfo(facility);
  47. });
  48. });
  49. }
  50. [SerializeField]
  51. private FacilityPowerUpManager m_Manager;
  52. [SerializeField]
  53. private uGUIListViewer m_uGUIListViewer;
  54. private FacilityManager m_FacilityMgr;
  55. }