WorkResultScene.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using BackupParamAccessor;
  3. using PlayerStatus;
  4. using TextureBank;
  5. namespace Schedule
  6. {
  7. public class WorkResultScene
  8. {
  9. public void Calc(WorkResultSceneMode mode = WorkResultSceneMode.Noon, bool intervene = true)
  10. {
  11. if (this.textureBank == null)
  12. {
  13. this.textureBank = new TextureBank();
  14. }
  15. if (this.slot == null)
  16. {
  17. this.slot = new WorkResultSlot[40];
  18. for (int i = 0; i < this.slot.Length; i++)
  19. {
  20. this.slot[i] = new WorkResultSlot(this, i);
  21. }
  22. }
  23. bool flag = false;
  24. if (intervene)
  25. {
  26. string flagName = string.Empty;
  27. if (mode == WorkResultSceneMode.Noon)
  28. {
  29. flagName = "_Schedule_Noon_Resulted";
  30. }
  31. if (mode == WorkResultSceneMode.Night)
  32. {
  33. flagName = "_Schedule_Night_Resulted";
  34. }
  35. if (GameMain.Instance.CharacterMgr.status.GetFlag(flagName) > 0)
  36. {
  37. flag = true;
  38. }
  39. else
  40. {
  41. GameMain.Instance.CharacterMgr.status.SetFlag(flagName, 1);
  42. }
  43. }
  44. this.mode = mode;
  45. this.intervene = intervene;
  46. if (!flag)
  47. {
  48. ScheduleCalcAPI.log.LogClear();
  49. for (int j = 0; j < 40; j++)
  50. {
  51. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  52. if (!(scheduleSlot == null))
  53. {
  54. int num = 0;
  55. SCENE_ID scene_ID = SCENE_ID.Start;
  56. if (mode == WorkResultSceneMode.Noon)
  57. {
  58. num = scheduleSlot.status.noonWorkId;
  59. scene_ID = SCENE_ID.Noon;
  60. }
  61. else if (mode == WorkResultSceneMode.Night)
  62. {
  63. num = scheduleSlot.status.nightWorkId;
  64. scene_ID = SCENE_ID.Night;
  65. }
  66. SCENE_ID sceneId_f = scene_ID + 1;
  67. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  68. ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[j];
  69. ScheduleTaskCtrl.TaskType type = scheduleBase.type;
  70. if (type != ScheduleTaskCtrl.TaskType.Work && type != ScheduleTaskCtrl.TaskType.Training)
  71. {
  72. if (type == ScheduleTaskCtrl.TaskType.Yotogi)
  73. {
  74. ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
  75. if (BackupParamAccessor.YotogiPlayed(j, scene_ID))
  76. {
  77. scheduleSlot.status.SetFlag("_YotogiPlayed", 1);
  78. }
  79. else
  80. {
  81. scheduleSlot.status.SetFlag("_YotogiPlayed", 0);
  82. }
  83. ScheduleAPI.YotogiResultSimulateParam param = ScheduleAPI.YotogiResultSimulate(scheduleSlot, num);
  84. ScheduleAPI.AddYotogiWorkResultParam(yotogi, scheduleSlot, param);
  85. BackupParamAccessor.BackupParam(new int?(j), sceneId_f);
  86. if (DailyMgr.IsLegacy)
  87. {
  88. scheduleSlot.status.OldStatus.SetFlag("_PlayedNightWorkId" + scheduleSlot.status.nightWorkId.ToString(), 1);
  89. }
  90. else
  91. {
  92. scheduleSlot.status.SetFlag("_PlayedNightWorkId" + scheduleSlot.status.nightWorkId.ToString(), 1);
  93. }
  94. ScheduleCSVData.YotogiType yotogiType = yotogi.yotogiType;
  95. if (yotogiType == ScheduleCSVData.YotogiType.Vip || yotogiType == ScheduleCSVData.YotogiType.VipCall)
  96. {
  97. if (DailyMgr.IsLegacy)
  98. {
  99. scheduleSlot.status.OldStatus.SetFlag("_PlayedNightWorkVip", 1);
  100. }
  101. else
  102. {
  103. scheduleSlot.status.SetFlag("_PlayedNightWorkVip", 1);
  104. }
  105. }
  106. ScheduleCSVData.YotogiType yotogiType2 = yotogi.yotogiType;
  107. if (yotogiType2 == ScheduleCSVData.YotogiType.Vip || yotogiType2 == ScheduleCSVData.YotogiType.VipCall)
  108. {
  109. if (GameMain.Instance.CharacterMgr.status.night_works_state_dic.ContainsKey(num))
  110. {
  111. GameMain.Instance.CharacterMgr.status.night_works_state_dic[num].finish = true;
  112. }
  113. }
  114. }
  115. }
  116. else
  117. {
  118. ScheduleData.WorkSuccessLv workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
  119. bool flag2 = false;
  120. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  121. if (mode == WorkResultSceneMode.Noon)
  122. {
  123. scheduleData.noon_communication = scheduleSlot.status.noonCommu;
  124. flag2 = scheduleData.noon_communication;
  125. ScheduleAPI.DecideSuccess(WorkResultSceneMode.Noon, j, flag2);
  126. workSuccessLv = scheduleData.noon_success_level;
  127. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  128. }
  129. else if (mode == WorkResultSceneMode.Night)
  130. {
  131. scheduleData.night_communication = scheduleSlot.status.nightCommu;
  132. flag2 = scheduleData.night_communication;
  133. ScheduleAPI.DecideSuccess(WorkResultSceneMode.Night, j, flag2);
  134. workSuccessLv = scheduleData.night_success_level;
  135. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  136. }
  137. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime);
  138. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training)
  139. {
  140. ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
  141. if (ScheduleCSVData.TrainingData.ContainsKey(training.id))
  142. {
  143. ScheduleCSVData.TrainingType trainingType = training.trainingType;
  144. if (trainingType == ScheduleCSVData.TrainingType.Trainer || trainingType == ScheduleCSVData.TrainingType.Trainee || trainingType == ScheduleCSVData.TrainingType.Travel)
  145. {
  146. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  147. }
  148. }
  149. }
  150. if (mode == WorkResultSceneMode.Noon)
  151. {
  152. scheduleData.noon_success_level = workSuccessLv;
  153. scheduleData.noon_communication = flag2;
  154. }
  155. else if (mode == WorkResultSceneMode.Night)
  156. {
  157. scheduleData.night_success_level = workSuccessLv;
  158. scheduleData.night_communication = flag2;
  159. }
  160. scheduleSlot.status.SetFlag("_communication", Convert.ToInt32(flag2));
  161. if (workSuccessLv != ScheduleData.WorkSuccessLv.Unexecuted)
  162. {
  163. scheduleSlot.status.AddWorkDataPlayCount(num, 1);
  164. int level = ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(scheduleSlot, num));
  165. scheduleSlot.status.SetWorkDataLevel(num, level);
  166. }
  167. ScheduleCalcAPI.ResultSimulateParam param2 = ScheduleCalcAPI.SimulateMaidStatusResult(scheduleSlot, num, workSuccessLv, flag2);
  168. ScheduleCalcAPI.AddResultParam(scheduleSlot, param2);
  169. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work && maidAssignedFacility != null)
  170. {
  171. param2 = ScheduleCalcAPI.SimulateIncomeResult(scheduleSlot, num, maidAssignedFacility, scheduleTime, workSuccessLv, flag2);
  172. ScheduleCalcAPI.AddResultParam(scheduleSlot, param2);
  173. GameMain.Instance.CharacterMgr.status.clubGauge += WorkResultScene.GetAddClubGaugeValue(maidAssignedFacility.defaultData.businessType);
  174. }
  175. BackupParamAccessor.BackupParam(new int?(j), scene_ID);
  176. if (maidAssignedFacility != null)
  177. {
  178. SimpleExperienceSystem expSystem = maidAssignedFacility.expSystem;
  179. int num2 = maidAssignedFacility.facilityExperienceValue;
  180. Facility.FacilityParameter facilityParameter = maidAssignedFacility.CalcRecipeParameter();
  181. if (facilityParameter != null)
  182. {
  183. num2 += facilityParameter.experienceValue;
  184. }
  185. expSystem.AddExp(num2);
  186. }
  187. BackupParamAccessor.BackupParam(new int?(j), sceneId_f);
  188. }
  189. }
  190. }
  191. }
  192. for (int k = 0; k < this.slot.Length; k++)
  193. {
  194. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  195. if (!(scheduleSlot2 == null))
  196. {
  197. this.slot[k].InitResultWork(mode);
  198. }
  199. }
  200. }
  201. public void Update()
  202. {
  203. for (int i = 0; i < this.slot.Length; i++)
  204. {
  205. this.slot[i].Update();
  206. }
  207. }
  208. public void Dispace()
  209. {
  210. if (this.textureBank != null)
  211. {
  212. this.textureBank.Dispace();
  213. }
  214. }
  215. public static ScheduleCSVData.ScheduleBase GetWorkResultSceneMode(WorkResultSceneMode mode, Maid maid)
  216. {
  217. int key = 0;
  218. if (mode == WorkResultSceneMode.Noon)
  219. {
  220. key = maid.status.noonWorkId;
  221. }
  222. else if (mode == WorkResultSceneMode.Night)
  223. {
  224. key = maid.status.nightWorkId;
  225. }
  226. return ScheduleCSVData.AllData[key];
  227. }
  228. public static int GetAddClubGaugeValue(FacilityDataTable.BusinessType type)
  229. {
  230. if (type == FacilityDataTable.BusinessType.接待系)
  231. {
  232. return 1;
  233. }
  234. if (type == FacilityDataTable.BusinessType.営業系)
  235. {
  236. return 2;
  237. }
  238. if (type == FacilityDataTable.BusinessType.アイドル系)
  239. {
  240. return 3;
  241. }
  242. return 0;
  243. }
  244. public WorkResultSceneMode mode;
  245. public bool intervene = true;
  246. public WorkResultSlot[] slot;
  247. public TextureBank textureBank;
  248. }
  249. }