ScheduleMaidStatusUnit.cs 15 KB

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