EmpireLifeModeFacilityUI.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class EmpireLifeModeFacilityUI : MonoBehaviour
  5. {
  6. public void ShowFacilityList()
  7. {
  8. int facilityCountMax = GameMain.Instance.FacilityMgr.FacilityCountMax;
  9. this.m_FacilityListViewer.CreateFacilityDetailsList<EmpireLifeModeFacilityUI.FacilityLifeModeViewer>(facilityCountMax, delegate(int index, EmpireLifeModeFacilityUI.FacilityLifeModeViewer info)
  10. {
  11. info.SetFacilityInfoOfIndex(index);
  12. });
  13. }
  14. public List<EmpireLifeModeFacilityUI.FacilityLifeModeViewer> GetAllItem()
  15. {
  16. return this.m_FacilityListViewer.GetAllItem<EmpireLifeModeFacilityUI.FacilityLifeModeViewer>();
  17. }
  18. [SerializeField]
  19. private FacilityDetailsListViewer m_FacilityListViewer;
  20. public class FacilityLifeModeViewer : FacilityDetailsListViewer.FacilityDetailsUI
  21. {
  22. private GameObject changeImage
  23. {
  24. get
  25. {
  26. GameObject result;
  27. if ((result = this.m_ChangeImage) == null)
  28. {
  29. result = (this.m_ChangeImage = base.transform.Find("Image Change").gameObject);
  30. }
  31. return result;
  32. }
  33. }
  34. private GameObject deleteImage
  35. {
  36. get
  37. {
  38. GameObject result;
  39. if ((result = this.m_DeleteImage) == null)
  40. {
  41. result = (this.m_DeleteImage = base.transform.Find("Image Delete").gameObject);
  42. }
  43. return result;
  44. }
  45. }
  46. public uGUIListViewer listViewerParentMaidIcon
  47. {
  48. get
  49. {
  50. uGUIListViewer result;
  51. if ((result = this.m_ListViewerParentMaidIcon) == null)
  52. {
  53. result = (this.m_ListViewerParentMaidIcon = base.transform.Find("parent window").GetComponent<uGUIListViewer>());
  54. }
  55. return result;
  56. }
  57. }
  58. private void Start()
  59. {
  60. NDebug.Assert(base.facilityInfoUI != null, "[FacilityDetailsListViewer.cs]\n施設の詳細表示UIクラスで、コンポーネント「FacilityInfoUI」の取得に失敗しました");
  61. NDebug.Assert(this.changeImage != null, "[FacilityDetailsListViewer.cs]\n施設の詳細表示UIクラスで、UI「Image Change」の取得に失敗しました");
  62. NDebug.Assert(this.deleteImage != null, "[FacilityDetailsListViewer.cs]\n施設の詳細表示UIクラスで、UI「Image Delete」の取得に失敗しました");
  63. }
  64. public Facility GetNowShowingFacility()
  65. {
  66. return this.m_NowShowingFacility;
  67. }
  68. private void SetFacilityInfo(Facility nowFacility, Facility nextDayFacility, bool isExistNextDayData)
  69. {
  70. if (isExistNextDayData)
  71. {
  72. if (nextDayFacility == null)
  73. {
  74. this.m_NowShowingFacility = nowFacility;
  75. base.facilityInfoUI.SetFacilityInfo(nowFacility, true);
  76. this.changeImage.SetActive(false);
  77. this.deleteImage.SetActive(false);
  78. this.SetInfoImageVisible(nowFacility != null);
  79. }
  80. else
  81. {
  82. this.m_NowShowingFacility = nowFacility;
  83. base.facilityInfoUI.SetFacilityInfo(nowFacility, true);
  84. this.changeImage.SetActive(false);
  85. this.deleteImage.SetActive(false);
  86. this.SetInfoImageVisible(nowFacility != null);
  87. }
  88. }
  89. else
  90. {
  91. this.m_NowShowingFacility = nowFacility;
  92. base.facilityInfoUI.SetFacilityInfo(nowFacility, true);
  93. this.changeImage.SetActive(false);
  94. this.deleteImage.SetActive(false);
  95. this.SetInfoImageVisible(nowFacility != null);
  96. }
  97. }
  98. public void SetFacilityInfoOfIndex(int index)
  99. {
  100. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  101. Facility facility = facilityMgr.GetFacility(index);
  102. Facility nextDayFacility = null;
  103. bool nextDayFacilityExist;
  104. if (nextDayFacilityExist = facilityMgr.GetNextDayFacilityExist(index))
  105. {
  106. nextDayFacility = facilityMgr.GetNextDayFacility(index);
  107. }
  108. this.SetFacilityInfo(facility, nextDayFacility, nextDayFacilityExist);
  109. }
  110. private void SetInfoImageVisible(bool isViewImage)
  111. {
  112. if (!isViewImage)
  113. {
  114. base.facilityInfoUI.imageFacilityThumbnail.color = new Color(0f, 0f, 0f, 0.25f);
  115. }
  116. else
  117. {
  118. base.facilityInfoUI.imageFacilityThumbnail.color = new Color(1f, 1f, 1f, 1f);
  119. }
  120. }
  121. private GameObject m_ChangeImage;
  122. private GameObject m_DeleteImage;
  123. private uGUIListViewer m_ListViewerParentMaidIcon;
  124. private Facility m_NowShowingFacility;
  125. }
  126. }