ScheduleMaidStatusUnit.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. using System;
  2. using PlayerStatus;
  3. using UnityEngine;
  4. public class ScheduleMaidStatusUnit : MonoBehaviour
  5. {
  6. public void Init(ResultWorkMgr resultWorkMgr, int slotNo)
  7. {
  8. this.slotNo = slotNo;
  9. this.resultWorkMgr = resultWorkMgr;
  10. GameObject childObject = UTY.GetChildObject(base.gameObject, "Frame", false);
  11. childObject.SetActive(true);
  12. this.basicPanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelBasicParam", false));
  13. this.subPanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelSubParam", false));
  14. this.traineePanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelTraineeParam", false));
  15. this.facilityPanel = UTY.GetChildObject(base.gameObject, "PanelFacilityParam", false);
  16. GameObject childObject2 = UTY.GetChildObject(base.gameObject, "LabelWaring", false);
  17. this.wariningLabel = childObject2.GetComponent<UILabel>();
  18. this.facilityPanelBasic = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelFacilityParam/Panel_Basic", false));
  19. this.facilityPanelAdd = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelFacilityParam/Panel_Add", false));
  20. this.basicPanel.SetActive(false);
  21. this.subPanel.SetActive(false);
  22. this.traineePanel.SetActive(false);
  23. this.facilityPanel.SetActive(false);
  24. this.wariningLabel.gameObject.SetActive(false);
  25. this.successLv = this.GetMaidWorkSuccessLv(slotNo);
  26. }
  27. public void SetViewer(ScheduleMaidStatusUnit.DataType type)
  28. {
  29. bool flag = true;
  30. if (this.successLv == ScheduleData.WorkSuccessLv.Unexecuted)
  31. {
  32. this.Warinig(type);
  33. return;
  34. }
  35. switch (type)
  36. {
  37. case ScheduleMaidStatusUnit.DataType.Yotogi:
  38. if (this.successLv == ScheduleData.WorkSuccessLv.Miss)
  39. {
  40. this.Warinig(type);
  41. return;
  42. }
  43. this.SetViewer_Yotogi();
  44. break;
  45. case ScheduleMaidStatusUnit.DataType.Work:
  46. this.SetViewer_Work();
  47. break;
  48. case ScheduleMaidStatusUnit.DataType.Training:
  49. this.SetViewer_Training();
  50. break;
  51. case ScheduleMaidStatusUnit.DataType.Facility:
  52. flag = this.SetViewer_Facility();
  53. break;
  54. case ScheduleMaidStatusUnit.DataType.Trainee:
  55. this.SetViewer_Trainee();
  56. break;
  57. case ScheduleMaidStatusUnit.DataType.Trainer:
  58. this.Warinig(type);
  59. return;
  60. }
  61. if (!flag)
  62. {
  63. return;
  64. }
  65. if (type == ScheduleMaidStatusUnit.DataType.Facility)
  66. {
  67. this.facilityPanel.SetActive(true);
  68. this.facilityPanelBasic.SetActive(true);
  69. this.facilityPanelAdd.SetActive(true);
  70. this.facilityPanelBasic.Repostion();
  71. this.facilityPanelAdd.Repostion();
  72. }
  73. else if (type == ScheduleMaidStatusUnit.DataType.Trainee)
  74. {
  75. this.traineePanel.SetActive(true);
  76. this.traineePanel.Repostion();
  77. }
  78. else
  79. {
  80. this.basicPanel.SetActive(true);
  81. this.subPanel.SetActive(true);
  82. this.basicPanel.Repostion();
  83. this.subPanel.Repostion();
  84. }
  85. }
  86. private void Warinig(ScheduleMaidStatusUnit.DataType type)
  87. {
  88. string text = string.Empty;
  89. switch (type)
  90. {
  91. case ScheduleMaidStatusUnit.DataType.Yotogi:
  92. text = "夜伽がキャンセルされました";
  93. break;
  94. case ScheduleMaidStatusUnit.DataType.Work:
  95. {
  96. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotNo);
  97. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  98. if (this.resultWorkMgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Daytime)
  99. {
  100. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  101. }
  102. else if (this.resultWorkMgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Night)
  103. {
  104. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  105. }
  106. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime);
  107. if (maidAssignedFacility != null)
  108. {
  109. text = string.Concat(new string[]
  110. {
  111. "ROOM ",
  112. GameMain.Instance.FacilityMgr.GetFacilityIndex(maidAssignedFacility).ToString().PadLeft(2, '0'),
  113. " 「",
  114. maidAssignedFacility.facilityName,
  115. "」"
  116. });
  117. text += "\n稼動に必要なメイドが足りません";
  118. string text2 = text;
  119. text = string.Concat(new object[]
  120. {
  121. text2,
  122. "\nあと",
  123. maidAssignedFacility.minMaidCount - maidAssignedFacility.NowMaidCount(scheduleTime),
  124. "人必要です"
  125. });
  126. }
  127. break;
  128. }
  129. case ScheduleMaidStatusUnit.DataType.Facility:
  130. text = "施設の強化がキャンセルされました";
  131. break;
  132. case ScheduleMaidStatusUnit.DataType.Trainer:
  133. text = "メイド研修を実施しました";
  134. break;
  135. }
  136. if (text != string.Empty)
  137. {
  138. this.wariningLabel.text = text;
  139. this.wariningLabel.gameObject.SetActive(true);
  140. }
  141. }
  142. private void SetViewer_Training()
  143. {
  144. ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo);
  145. this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false);
  146. this.basicPanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false);
  147. this.basicPanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false);
  148. this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false);
  149. this.basicPanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false);
  150. this.basicPanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false);
  151. this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false);
  152. this.basicPanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false);
  153. this.basicPanel.AddParam("ダンス", maidStatusBySlotNo.dance, false);
  154. this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.income, false);
  155. this.subPanel.AddParam("ジョブメイド経験値", maidStatusBySlotNo.maidClassExp, false);
  156. }
  157. private void SetViewer_Trainee()
  158. {
  159. ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo);
  160. this.traineePanel.AddParam("お世話", maidStatusBySlotNo.care, false);
  161. this.traineePanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false);
  162. this.traineePanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false);
  163. this.traineePanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false);
  164. this.traineePanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false);
  165. this.traineePanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false);
  166. this.traineePanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false);
  167. this.traineePanel.AddParam("ダンス", maidStatusBySlotNo.dance, false);
  168. this.traineePanel.AddParam("淫欲", maidStatusBySlotNo.inyoku, false);
  169. this.traineePanel.AddParam("M性", maidStatusBySlotNo.m_value, false);
  170. this.traineePanel.AddParam("奉仕", maidStatusBySlotNo.housi, false);
  171. this.traineePanel.AddParam("変態", maidStatusBySlotNo.hentai, false);
  172. }
  173. private void SetViewer_Work()
  174. {
  175. ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo);
  176. this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false);
  177. this.basicPanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false);
  178. this.basicPanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false);
  179. this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false);
  180. this.basicPanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false);
  181. this.basicPanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false);
  182. this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false);
  183. this.basicPanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false);
  184. this.basicPanel.AddParam("ダンス", maidStatusBySlotNo.dance, false);
  185. this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.workingFunds, true);
  186. this.subPanel.AddParam("取得客評価", maidStatusBySlotNo.evaluation, false);
  187. this.subPanel.AddParam("接客回数", maidStatusBySlotNo.othersPlayCount, false);
  188. this.subPanel.AddParam("ジョブメイド経験値", maidStatusBySlotNo.maidClassExp, false);
  189. }
  190. private void SetViewer_Yotogi()
  191. {
  192. ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo);
  193. this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false);
  194. this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false);
  195. this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false);
  196. this.basicPanel.AddParam("淫\u3000欲", maidStatusBySlotNo.inyoku, false);
  197. this.basicPanel.AddParam("M\u3000性", maidStatusBySlotNo.m_value, false);
  198. this.basicPanel.AddParam("変\u3000態", maidStatusBySlotNo.hentai, false);
  199. this.basicPanel.AddParam("奉\u3000仕", maidStatusBySlotNo.housi, false);
  200. this.subPanel.AddParam("夜伽回数", maidStatusBySlotNo.yotogiPlayCount, false);
  201. this.subPanel.AddParam("習得率", maidStatusBySlotNo.studyRate, false);
  202. this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.workingFunds, true);
  203. this.subPanel.AddParam("取得客評価", maidStatusBySlotNo.evaluation, false);
  204. this.subPanel.AddParam("接客回数", maidStatusBySlotNo.othersPlayCount, false);
  205. }
  206. private bool SetViewer_Facility()
  207. {
  208. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  209. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  210. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotNo);
  211. if (scheduleSlot == null)
  212. {
  213. return false;
  214. }
  215. Facility facility;
  216. Facility.RecipeData recipeData;
  217. if (!facilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData))
  218. {
  219. return false;
  220. }
  221. UILabel label = this.GetLabel(this.facilityPanel, "RoomNo");
  222. label.text = "ROOM " + (facilityMgr.GetFacilityIndex(facility) + 1).ToString().PadLeft(2, '0');
  223. UILabel label2 = this.GetLabel(this.facilityPanel, "InfoParent/RoomName");
  224. label2.text = facility.facilityName;
  225. UILabel label3 = this.GetLabel(this.facilityPanel, "InfoParent/RecipeNo");
  226. string str = string.Format("{0:D4}", recipeData.id);
  227. label3.text = "RECIPE " + str;
  228. UILabel label4 = this.GetLabel(this.facilityPanel, "InfoParent/Recipe");
  229. label4.text = recipeData.name;
  230. GameObject childObject = UTY.GetChildObject(this.facilityPanel, "Thumbnail", false);
  231. UITexture component = childObject.GetComponent<UITexture>();
  232. Sprite facilityThumbnail = FacilityDataTable.GetFacilityThumbnail(facility.defaultData.ID, true);
  233. if (facilityThumbnail != null)
  234. {
  235. component.mainTexture = facilityThumbnail.texture;
  236. }
  237. Facility.FacilityParameter facilityParameter = recipeData.defaultParameter;
  238. for (int i = 0; i < facilityParameter.Length; i++)
  239. {
  240. string parameterName = facilityParameter.GetParameterName(i);
  241. int value = facilityParameter[i];
  242. this.facilityPanelBasic.AddParam(parameterName, value, false);
  243. }
  244. facilityParameter = recipeData.additionalParameter;
  245. for (int j = 0; j < facilityParameter.Length; j++)
  246. {
  247. string parameterName2 = facilityParameter.GetParameterName(j);
  248. int value2 = facilityParameter[j];
  249. this.facilityPanelAdd.AddParam(parameterName2, value2, false);
  250. }
  251. return true;
  252. }
  253. private UILabel GetLabel(GameObject parent, string path)
  254. {
  255. GameObject childObject = UTY.GetChildObject(parent, path, false);
  256. return childObject.GetComponent<UILabel>();
  257. }
  258. protected ResultWorkCtrl.UpperMaidStatus GetMaidStatusBySlotNo(int slotNo)
  259. {
  260. ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.resultWorkMgr.Ctrl.GetResultWorkBySlotNo(slotNo);
  261. if (resultWorkBySlotNo.upperMaidStatus != null)
  262. {
  263. return resultWorkBySlotNo.upperMaidStatus;
  264. }
  265. return null;
  266. }
  267. protected ScheduleData.WorkSuccessLv GetMaidWorkSuccessLv(int slotNo)
  268. {
  269. ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.resultWorkMgr.Ctrl.GetResultWorkBySlotNo(slotNo);
  270. if (resultWorkBySlotNo != null)
  271. {
  272. return resultWorkBySlotNo.successLv;
  273. }
  274. return ScheduleData.WorkSuccessLv.Unexecuted;
  275. }
  276. private ResultWorkMgr resultWorkMgr;
  277. private int slotNo;
  278. private ScheduleData.WorkSuccessLv successLv;
  279. private ScheduleMaidStatusUnit.Panel basicPanel;
  280. private ScheduleMaidStatusUnit.Panel subPanel;
  281. private ScheduleMaidStatusUnit.Panel traineePanel;
  282. private GameObject facilityPanel;
  283. private ScheduleMaidStatusUnit.Panel facilityPanelBasic;
  284. private ScheduleMaidStatusUnit.Panel facilityPanelAdd;
  285. private UILabel wariningLabel;
  286. public enum DataType
  287. {
  288. Yotogi,
  289. Work,
  290. Training,
  291. Facility,
  292. Trainee,
  293. Trainer
  294. }
  295. private enum PanelType
  296. {
  297. Basic,
  298. Sub,
  299. Facility
  300. }
  301. public class Panel
  302. {
  303. public Panel(GameObject panelObj)
  304. {
  305. this.baseObj = panelObj;
  306. this.paramParent = UTY.GetChildObject(panelObj, "ParamParent", false);
  307. this.paramObj = UTY.GetChildObject(panelObj, "Param", false);
  308. this.grid = this.paramParent.GetComponent<UIGrid>();
  309. this.paramObj.SetActive(false);
  310. }
  311. public void AddParam(string name, int value, bool money = false)
  312. {
  313. if (value <= 0)
  314. {
  315. return;
  316. }
  317. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.paramObj);
  318. gameObject.SetActive(true);
  319. gameObject.transform.parent = this.paramParent.transform;
  320. gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
  321. gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
  322. UILabel component = gameObject.GetComponent<UILabel>();
  323. UILabel component2 = UTY.GetChildObject(gameObject, "Value", false).GetComponent<UILabel>();
  324. component.text = name;
  325. if (money)
  326. {
  327. component2.text = "+ " + this.ValueToMoney(value);
  328. }
  329. else
  330. {
  331. component2.text = "+ " + value.ToString();
  332. }
  333. }
  334. public void Repostion()
  335. {
  336. BaseCreateViewerCtrl.Reposition(this.paramParent);
  337. }
  338. public void SetActive(bool active)
  339. {
  340. this.baseObj.SetActive(active);
  341. }
  342. private string ValueToMoney(int value)
  343. {
  344. return string.Format("{0:#,0}", value);
  345. }
  346. public GameObject baseObj;
  347. public GameObject paramParent;
  348. public GameObject paramObj;
  349. public UIGrid grid;
  350. }
  351. }