DescScheduleWork.cs 8.9 KB

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