ScheduleMaidStatusUnit.cs 15 KB

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