DescScheduleWork.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Schedule;
  5. using TextureBank;
  6. using UnityEngine;
  7. public class DescScheduleWork : DescScheduleTraining
  8. {
  9. public ScheduleMgr ScheduleMgr
  10. {
  11. set
  12. {
  13. this.scheduleMgr = value;
  14. }
  15. }
  16. public WorkTaskUnit TaskUnit
  17. {
  18. set
  19. {
  20. this.taskUnit = value;
  21. }
  22. }
  23. public override void Init(ScheduleTaskCtrl taskCtrl)
  24. {
  25. if (taskCtrl == null)
  26. {
  27. return;
  28. }
  29. base.Init(taskCtrl);
  30. this.m_FacillityPanel.TaskViewr = taskCtrl.TaskViewer;
  31. this.m_goTitleOfSalonParameter = UTY.GetChildObject(base.gameObject, "SalonParameter/Title", false);
  32. this.m_heightOfSalonParameterTitle = this.m_goTitleOfSalonParameter.GetComponent<UISprite>().height;
  33. this.m_goSalonParameter = UTY.GetChildObject(base.gameObject, "SalonParameter", false);
  34. this.m_goSalonParameterParent = UTY.GetChildObject(base.gameObject, "SalonParameter/ParameterParent", false);
  35. this.m_lIncome = new DescScheduleBase.ParamSet(this.m_goSalonParameterParent, "Income", false);
  36. this.m_listClubParameter = new List<ScheduleCtrl.VariableItem>
  37. {
  38. this.m_lIncome.GetVariableItem()
  39. };
  40. this.m_goFacilityMiniPanel = UTY.GetChildObject(base.gameObject, "FacilityMiniPanel", false);
  41. GameObject childObject = UTY.GetChildObject(this.m_goFacilityMiniPanel, "Grid_Value/FacilityLevel", false);
  42. this.m_lFacilityLevel = childObject.GetComponent<UILabel>();
  43. GameObject childObject2 = UTY.GetChildObject(this.m_goFacilityMiniPanel, "Sprite_Thumbnail", false);
  44. this.m_lFacilitThumbnaily = childObject2.GetComponent<UITexture>();
  45. GameObject childObject3 = UTY.GetChildObject(this.m_goFacilityMiniPanel, "TitleBar/Title_Name", false);
  46. this.m_lFacilityTitleName = childObject3.GetComponent<UILabel>();
  47. this.m_lFacilityRankStarParent = UTY.GetChildObject(this.m_goFacilityMiniPanel, "Grid_Value/Parent_Rank/Grid_Star", false);
  48. GameObject childObject4 = UTY.GetChildObject(base.gameObject, "Btn_Start", false);
  49. this.m_lFacilityButton = childObject4.GetComponent<UIButton>();
  50. }
  51. public void EnableFacillityPanel_Button()
  52. {
  53. TaskUnit selectedTaskUnit = this.taskCtrl.TaskViewer.GetSelectedTaskUnit();
  54. if (selectedTaskUnit.taskType == ScheduleTaskCtrl.TaskType.Work)
  55. {
  56. this.taskUnit = (WorkTaskUnit)selectedTaskUnit;
  57. }
  58. this.EnableFacillityPanel();
  59. }
  60. public void EnableFacillityPanel()
  61. {
  62. this.m_FacillityPanel.TaskUnit = this.taskUnit;
  63. this.m_FacillityPanel.WorkData = this.work_data;
  64. this.m_FacillityPanel.SelectMaid = this.taskCtrl.ScheduleCtrl.SelectedMaid;
  65. this.m_FacillityPanel.ScheduleTime = ScheduleTaskViewer.ScheduleTime;
  66. this.m_FacillityPanel.Active(true);
  67. }
  68. public void DisableFacillityPanel()
  69. {
  70. this.m_FacillityPanel.Active(false);
  71. }
  72. public void AddFacillity(FacilityInfoUI info)
  73. {
  74. int facilityCountMax = GameMain.Instance.FacilityMgr.FacilityCountMax;
  75. info.SetFacilityInfo(info.facility, true);
  76. }
  77. protected override void UpdateView(ScheduleCSVData.ScheduleBase work_data)
  78. {
  79. this.work_data = (ScheduleCSVData.Work)work_data;
  80. if (this.work_data.workTyp == ScheduleCSVData.WorkType.Basic)
  81. {
  82. this.UpdateFacilityMiniPanel();
  83. this.UpdateCurentValue();
  84. MaidParams addValue_Work = this.GetAddValue_Work();
  85. this.UpdateAddValue(addValue_Work);
  86. this.m_lIncome.AddValueText = "0";
  87. this.m_goMaidParameter.SetActive(true);
  88. this.m_goFacilityMiniPanel.SetActive(true);
  89. this.m_goSalonParameter.SetActive(true);
  90. this.m_lFacilityButton.gameObject.SetActive(true);
  91. this.ExamineDisplayItem();
  92. Slot slot = this.taskCtrl.ScheduleMgr.GetScheduleApi().slot[this.taskCtrl.CurrentActiveSlotNo];
  93. Maid maid = slot.maid;
  94. ScheduleCSVData.ScheduleBase schedule = ScheduleAPI.GetSchedule(maid, ScheduleTaskViewer.ScheduleTime);
  95. this.m_lFacilityButton.gameObject.SetActive(schedule == work_data);
  96. }
  97. else if (this.work_data.workTyp == ScheduleCSVData.WorkType.PowerUp)
  98. {
  99. this.m_goMaidParameter.SetActive(false);
  100. this.m_goFacilityMiniPanel.SetActive(false);
  101. this.m_goSalonParameter.SetActive(false);
  102. this.m_lFacilityButton.gameObject.SetActive(false);
  103. }
  104. }
  105. private void UpdateFacilityMiniPanel()
  106. {
  107. this.m_lFacilityTitleName.text = this.work_data.name;
  108. Sprite facilityThumbnail = FacilityDataTable.GetFacilityThumbnail(this.work_data.facility.ID, true);
  109. if (facilityThumbnail != null)
  110. {
  111. this.m_lFacilitThumbnaily.mainTexture = facilityThumbnail.texture;
  112. }
  113. this.m_lFacilitThumbnaily.gameObject.SetActive(facilityThumbnail != null);
  114. int facilityLevel = GameMain.Instance.FacilityMgr.GetFacilityLevel(this.work_data.facility.ID);
  115. this.m_lFacilityLevel.text = "Lv." + facilityLevel.ToString();
  116. int rank = this.work_data.facility.rank;
  117. Transform transform = this.m_lFacilityRankStarParent.transform;
  118. for (int i = 0; i < transform.childCount; i++)
  119. {
  120. Transform child = transform.GetChild(i);
  121. child.gameObject.SetActive(i < rank);
  122. }
  123. }
  124. private MaidParams GetAddValue_Work()
  125. {
  126. foreach (ScheduleBase scheduleBase in this.taskCtrl.GetWorksData(ScheduleTaskCtrl.TaskType.Work))
  127. {
  128. if (scheduleBase.workType == ScheduleType.Work)
  129. {
  130. ScheduleWork scheduleWork = (ScheduleWork)scheduleBase;
  131. if (scheduleWork.id == this.intTaskInd)
  132. {
  133. MaidParams simulateeMaidParams = scheduleWork.simulateeMaidParams;
  134. SalonParams simulateeSalonMaidParams = scheduleWork.simulateeSalonMaidParams;
  135. return simulateeMaidParams;
  136. }
  137. }
  138. }
  139. return null;
  140. }
  141. private new void ExamineDisplayItem()
  142. {
  143. int num = ScheduleCtrl.SetActiveExceptForNothing(this.m_listMaidItem, "0");
  144. bool flag = num > 0;
  145. this.m_goTitleOfMaidParameter.SetActive(flag);
  146. int num2 = ScheduleCtrl.SetActiveExceptForNothing(this.m_listClubParameter, "0");
  147. bool flag2 = num2 > 0;
  148. this.m_goTitleOfSalonParameter.SetActive(flag2);
  149. if (!flag && !flag2)
  150. {
  151. base.Active(false);
  152. return;
  153. }
  154. base.Active(true);
  155. DescScheduleBase.Reposition(this.m_goMaidParameterParent);
  156. DescScheduleBase.Reposition(this.m_goSalonParameterParent);
  157. this.AdjustParameterViewer(num, num2);
  158. }
  159. private void AdjustParameterViewer(int displayMaidParameterCount, int displaySalonParameterCount)
  160. {
  161. float num = 15f;
  162. float num2 = 25f;
  163. float num3 = 0f;
  164. if (displayMaidParameterCount > 0)
  165. {
  166. num3 += (float)this.m_heightOfMaidParameterTitle + num;
  167. float y = this.m_goMaidParameterParent.GetComponent<UITable>().padding.y;
  168. IEnumerator enumerator = this.m_goMaidParameterParent.transform.GetEnumerator();
  169. try
  170. {
  171. while (enumerator.MoveNext())
  172. {
  173. object obj = enumerator.Current;
  174. Transform transform = (Transform)obj;
  175. if (transform.gameObject.activeSelf)
  176. {
  177. UILabel component = transform.GetComponent<UILabel>();
  178. num3 += (float)component.height + y * 2f;
  179. }
  180. }
  181. }
  182. finally
  183. {
  184. IDisposable disposable;
  185. if ((disposable = (enumerator as IDisposable)) != null)
  186. {
  187. disposable.Dispose();
  188. }
  189. }
  190. num3 += num2;
  191. }
  192. float num4 = 0f;
  193. if (displaySalonParameterCount > 0)
  194. {
  195. num4 += (float)this.m_heightOfSalonParameterTitle + num;
  196. float y = this.m_goSalonParameterParent.GetComponent<UITable>().padding.y;
  197. IEnumerator enumerator2 = this.m_goSalonParameterParent.transform.GetEnumerator();
  198. try
  199. {
  200. while (enumerator2.MoveNext())
  201. {
  202. object obj2 = enumerator2.Current;
  203. Transform transform2 = (Transform)obj2;
  204. if (transform2.gameObject.activeSelf)
  205. {
  206. UILabel component2 = transform2.GetComponent<UILabel>();
  207. num4 += (float)component2.height + y * 2f;
  208. }
  209. }
  210. }
  211. finally
  212. {
  213. IDisposable disposable2;
  214. if ((disposable2 = (enumerator2 as IDisposable)) != null)
  215. {
  216. disposable2.Dispose();
  217. }
  218. }
  219. num4 += num2;
  220. }
  221. if (num3 + num4 > 0f)
  222. {
  223. this.m_spBGOfParameterViewer.height = (int)(num3 + num4);
  224. float num5 = (num3 <= 0f) ? (-(num3 + num * 2f)) : (-(num3 + num));
  225. num5 -= 125f;
  226. this.m_goSalonParameter.transform.localPosition = new Vector3(this.m_goSalonParameter.transform.localPosition.x, num5, 0f);
  227. }
  228. }
  229. private ScheduleMgr scheduleMgr;
  230. private UIButton roomSettingStartBtn;
  231. private GameObject m_goTitleOfSalonParameter;
  232. private int m_heightOfSalonParameterTitle;
  233. private UIPanel currentRoomPanel;
  234. private UITexture spriteThumbnail;
  235. protected List<ScheduleCtrl.VariableItem> m_listClubParameter;
  236. private GameObject m_goSalonParameter;
  237. private GameObject m_goSalonParameterParent;
  238. private WorkTaskUnit taskUnit;
  239. private ScheduleCSVData.Work work_data;
  240. private DescScheduleBase.ParamSet m_lIncome;
  241. private GameObject m_goFacilityMiniPanel;
  242. private UILabel m_lFacilityLevel;
  243. private UITexture m_lFacilitThumbnaily;
  244. private UILabel m_lFacilityTitleName;
  245. private UIButton m_lFacilityButton;
  246. private GameObject m_lFacilityRankStarParent;
  247. public TextureBank textureBank;
  248. [SerializeField]
  249. private ScheduleFacillityPanelCtrl m_FacillityPanel;
  250. }