EmpireLifeModeManager.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using FacilityFlag;
  8. using UnityEngine;
  9. public class EmpireLifeModeManager : MonoBehaviour
  10. {
  11. public List<EmpireLifeModeManager.EventDataObject> nowEventList
  12. {
  13. get
  14. {
  15. return this.m_EventList;
  16. }
  17. }
  18. public Dictionary<Facility, List<Maid>> nowMaidAllocationDic
  19. {
  20. get
  21. {
  22. return this.m_NowMaidAllocationDic;
  23. }
  24. }
  25. public List<EmpireLifeModeManager.EventDataObject> executedEventList
  26. {
  27. get
  28. {
  29. return this.m_ExecutedEventList;
  30. }
  31. }
  32. public List<Maid> lifeModeAllMaidList
  33. {
  34. get
  35. {
  36. return this.m_LifeModeAllMaidList;
  37. }
  38. }
  39. public void SetAllMaidList(IEnumerable<Maid> maidCorrection)
  40. {
  41. this.m_LifeModeAllMaidList = new List<Maid>(maidCorrection);
  42. }
  43. public void UpdateAllMaidList()
  44. {
  45. this.m_LifeModeAllMaidList = new List<Maid>(from maid in this.m_LifeModeAllMaidList
  46. where maid != null
  47. select maid);
  48. }
  49. public List<Maid> executedMaidList
  50. {
  51. get
  52. {
  53. return this.m_ExecutedMaidList;
  54. }
  55. }
  56. private void CreateAndCacheEvent(EmpireLifeModeData.Data data, Facility targetFacility, IEnumerable<Maid> targetMaidList)
  57. {
  58. EmpireLifeModeManager.EventDataObject eventDataObject = new EmpireLifeModeManager.EventDataObject();
  59. eventDataObject.targetEvent = data;
  60. eventDataObject.targetFacility = targetFacility;
  61. eventDataObject.targetMaidList = new List<Maid>(targetMaidList);
  62. this.nowEventList.Add(eventDataObject);
  63. }
  64. public void CreateStoryEvent()
  65. {
  66. if (this.nowEventList.Exists((EmpireLifeModeManager.EventDataObject d) => d.targetEvent.dataScenarioType == EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC))
  67. {
  68. Debug.Log("既にストーリーイベントが存在していたので、ストーリーイベントの追加は行いません。");
  69. return;
  70. }
  71. if (this.executedEventList.Exists((EmpireLifeModeManager.EventDataObject d) => d.targetEvent.dataScenarioType == EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC))
  72. {
  73. Debug.Log("既にストーリーイベントは実行された後なので、ストーリーイベントの追加は行いません。");
  74. return;
  75. }
  76. List<EmpireLifeModeData.Data> datas = EmpireLifeModeData.GetDatas((EmpireLifeModeData.Data d) => EmpireLifeModeData.IsEnabled(d.ID) && d.dataScenarioType == EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC, true);
  77. if (datas == null || datas.Count <= 0)
  78. {
  79. Debug.Log("種類が「ストーリー」であるイベントは存在しなかった。");
  80. return;
  81. }
  82. foreach (EmpireLifeModeData.Data data in datas)
  83. {
  84. if (this.GetScenarioExecuteCount(data.ID) <= 0)
  85. {
  86. if (!data.IsCorrectUniqueComparisonObject())
  87. {
  88. break;
  89. }
  90. List<Facility> correctFacilityList = data.GetCorrectFacilityList();
  91. if (correctFacilityList == null || correctFacilityList.Count <= 0)
  92. {
  93. break;
  94. }
  95. List<Maid> list;
  96. if (!EmpireLifeModeManager.TryGetMaidListOfEventData(data, this.GetNotAllocatedMaidList(this.lifeModeAllMaidList), out list))
  97. {
  98. break;
  99. }
  100. Facility facility = correctFacilityList[UnityEngine.Random.Range(0, correctFacilityList.Count)];
  101. this.CreateAndCacheEvent(data, facility, list);
  102. if (!this.nowMaidAllocationDic.ContainsKey(facility))
  103. {
  104. this.nowMaidAllocationDic.Add(facility, null);
  105. }
  106. this.nowMaidAllocationDic[facility] = list;
  107. }
  108. }
  109. }
  110. public void AllMaidRandomAllocate()
  111. {
  112. Dictionary<Facility, int> dictionary = new Dictionary<Facility, int>();
  113. foreach (Facility key in EmpireLifeModeAPI.GetEnabledFacilityList())
  114. {
  115. int num = 0;
  116. if (!this.nowMaidAllocationDic.ContainsKey(key))
  117. {
  118. this.nowMaidAllocationDic.Add(key, new List<Maid>());
  119. }
  120. else if (this.nowMaidAllocationDic[key] != null)
  121. {
  122. num = this.nowMaidAllocationDic[key].Count;
  123. }
  124. else
  125. {
  126. num = 0;
  127. }
  128. if (num < 3)
  129. {
  130. if (!dictionary.ContainsKey(key))
  131. {
  132. dictionary.Add(key, num);
  133. }
  134. }
  135. }
  136. List<Maid> notAllocatedMaidList = this.GetNotAllocatedMaidList(this.lifeModeAllMaidList);
  137. from maid in notAllocatedMaidList
  138. orderby UnityEngine.Random.Range(0, 100)
  139. select maid;
  140. foreach (Maid item in notAllocatedMaidList)
  141. {
  142. List<Facility> list = new List<Facility>(dictionary.Keys);
  143. List<int> list2 = new List<int>(dictionary.Values);
  144. int index = UnityEngine.Random.Range(0, dictionary.Count);
  145. this.nowMaidAllocationDic[list[index]].Add(item);
  146. Dictionary<Facility, int> dictionary2;
  147. Facility key2;
  148. if (((dictionary2 = dictionary)[key2 = list[index]] = dictionary2[key2] + 1) >= 3)
  149. {
  150. dictionary.Remove(list[index]);
  151. if (dictionary.Count <= 0)
  152. {
  153. break;
  154. }
  155. }
  156. }
  157. }
  158. public void CreateEventListOfMaidAllocateData()
  159. {
  160. foreach (KeyValuePair<Facility, List<Maid>> keyValuePair in this.nowMaidAllocationDic)
  161. {
  162. Facility facility = keyValuePair.Key;
  163. List<Maid> list = new List<Maid>(keyValuePair.Value);
  164. List<EmpireLifeModeData.Data> datas = EmpireLifeModeData.GetDatas((EmpireLifeModeData.Data data) => data.IsCorrectUniqueComparisonObject() && data.dataScenarioType != EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC && data.IsCorrectFacility(facility.defaultName), true);
  165. IOrderedEnumerable<EmpireLifeModeData.Data> source = from d in datas
  166. orderby d.dataMaidPersonalUniqueNameAndActiveSlotDic.Count descending
  167. select d;
  168. if (EmpireLifeModeManager.<>f__mg$cache0 == null)
  169. {
  170. EmpireLifeModeManager.<>f__mg$cache0 = new Func<EmpireLifeModeData.Data, int>(EmpireLifeModeAPI.GetPriorityScenarioType);
  171. }
  172. IOrderedEnumerable<EmpireLifeModeData.Data> orderedEnumerable = source.ThenByDescending(EmpireLifeModeManager.<>f__mg$cache0);
  173. Dictionary<int, int> eventSelectCountDic = new Dictionary<int, int>();
  174. foreach (EmpireLifeModeData.Data data3 in orderedEnumerable)
  175. {
  176. eventSelectCountDic.Add(data3.ID, 0);
  177. }
  178. while (list.Count > 0)
  179. {
  180. bool flag = false;
  181. foreach (EmpireLifeModeData.Data data2 in orderedEnumerable.ThenBy((EmpireLifeModeData.Data d) => eventSelectCountDic[d.ID]).ThenBy((EmpireLifeModeData.Data d) => UnityEngine.Random.Range(0, 10)))
  182. {
  183. List<Maid> list2;
  184. if (EmpireLifeModeManager.TryGetMaidListOfEventData(data2, list, out list2))
  185. {
  186. this.CreateAndCacheEvent(data2, facility, list2);
  187. Dictionary<int, int> eventSelectCountDic2;
  188. int id;
  189. (eventSelectCountDic2 = eventSelectCountDic)[id = data2.ID] = eventSelectCountDic2[id] + 1;
  190. flag = true;
  191. foreach (Maid item in list2)
  192. {
  193. list.Remove(item);
  194. }
  195. if (list.Count == 0)
  196. {
  197. break;
  198. }
  199. }
  200. }
  201. if (!flag)
  202. {
  203. break;
  204. }
  205. }
  206. }
  207. }
  208. public void DeleteNowEventList()
  209. {
  210. this.nowEventList.Clear();
  211. this.nowMaidAllocationDic.Clear();
  212. }
  213. public void OnTimeZoneChanged()
  214. {
  215. this.nowEventList.Clear();
  216. this.nowMaidAllocationDic.Clear();
  217. this.executedEventList.Clear();
  218. this.executedMaidList.Clear();
  219. this.UpdateAllMaidList();
  220. EmpireLifeModeAPI.DestroyScenarioTypeIconDic();
  221. }
  222. public void OnNextDay()
  223. {
  224. this.nowEventList.Clear();
  225. this.nowMaidAllocationDic.Clear();
  226. this.executedEventList.Clear();
  227. this.executedMaidList.Clear();
  228. }
  229. public void SetupScenarioEvent(EmpireLifeModeManager.EventDataObject eventObj, Action OnComplete)
  230. {
  231. base.StartCoroutine(this.CoSetupScenarioEvent(eventObj, OnComplete));
  232. GameMain.Instance.ScriptMgr.EvalScript("&tf['scenario_file_name'] = '" + eventObj.targetEvent.dataScenarioFileName + "';");
  233. GameMain.Instance.ScriptMgr.EvalScript("&tf['label_name'] = '" + eventObj.targetEvent.dataScenarioFileLabel + "';");
  234. this.nowEventList.Remove(eventObj);
  235. this.executedEventList.Add(eventObj);
  236. foreach (Maid maid in eventObj.targetMaidList)
  237. {
  238. this.IncrementMaidScenarioExecuteCount(eventObj.targetEvent.ID, maid);
  239. }
  240. foreach (Maid item in eventObj.targetMaidList)
  241. {
  242. this.executedMaidList.Add(item);
  243. }
  244. }
  245. private IEnumerator CoSetupScenarioEvent(EmpireLifeModeManager.EventDataObject eventObj, Action OnComplete)
  246. {
  247. EmpireLifeModeData.Data data = eventObj.targetEvent;
  248. List<Maid> targetMaidList = new List<Maid>(eventObj.targetMaidList);
  249. foreach (KeyValuePair<int, string> maidPersonalSlotPair in data.dataMaidPersonalUniqueNameAndActiveSlotDic)
  250. {
  251. int slotNo = maidPersonalSlotPair.Key;
  252. string personalUniqueName = maidPersonalSlotPair.Value;
  253. Maid maid = targetMaidList.Find((Maid m) => m.status.personal.uniqueName == personalUniqueName);
  254. targetMaidList.Remove(maid);
  255. GameMain.Instance.CharacterMgr.SetActiveMaid(maid, slotNo);
  256. maid.Visible = true;
  257. maid.AllProcPropSeqStart();
  258. while (maid.IsBusy)
  259. {
  260. yield return null;
  261. }
  262. if (data.dataFacilityCostumeChange)
  263. {
  264. if (eventObj.targetFacility.typeCostume == Facility.CostumeType.Default)
  265. {
  266. eventObj.targetFacility.UpdateMaidCostumeToDefaultCostume(maid);
  267. }
  268. else if (eventObj.targetFacility.typeCostume == Facility.CostumeType.Edit)
  269. {
  270. eventObj.targetFacility.UpdateMaidCostumeToEditCostume(maid, false);
  271. }
  272. }
  273. maid.AllProcPropSeqStart();
  274. }
  275. for (;;)
  276. {
  277. bool isAllMaidLoadComplete = true;
  278. foreach (Maid maid2 in eventObj.targetMaidList)
  279. {
  280. if (maid2.IsBusy)
  281. {
  282. isAllMaidLoadComplete = false;
  283. break;
  284. }
  285. }
  286. if (isAllMaidLoadComplete)
  287. {
  288. break;
  289. }
  290. yield return null;
  291. }
  292. if (OnComplete != null)
  293. {
  294. OnComplete();
  295. }
  296. yield break;
  297. }
  298. private static bool TryGetMaidListOfEventData(EmpireLifeModeData.Data data, IEnumerable<Maid> maidList, out List<Maid> resultList)
  299. {
  300. resultList = new List<Maid>();
  301. List<string> list = new List<string>(data.dataMaidPersonalUniqueNameAndActiveSlotDic.Values);
  302. List<Maid> list2 = new List<Maid>(maidList);
  303. if (list.Count > list2.Count)
  304. {
  305. return false;
  306. }
  307. foreach (string b in list)
  308. {
  309. Maid maid = null;
  310. foreach (Maid maid2 in list2)
  311. {
  312. if (maid2.status.personal.uniqueName == b && data.IsCorrectMaid(maid2))
  313. {
  314. maid = maid2;
  315. break;
  316. }
  317. }
  318. if (!(maid != null))
  319. {
  320. return false;
  321. }
  322. resultList.Add(maid);
  323. if (resultList.Count == list.Count)
  324. {
  325. return true;
  326. }
  327. list2.Remove(maid);
  328. }
  329. return false;
  330. }
  331. public List<Maid> GetNotAllocatedMaidList(List<Maid> maidList)
  332. {
  333. List<Maid> list = new List<Maid>();
  334. if (maidList == null || maidList.Count <= 0)
  335. {
  336. return list;
  337. }
  338. for (int i = maidList.Count - 1; i >= 0; i--)
  339. {
  340. if (!this.executedMaidList.Contains(maidList[i]))
  341. {
  342. if (!this.IsAllocatedMaid(maidList[i]))
  343. {
  344. list.Add(maidList[i]);
  345. }
  346. }
  347. }
  348. return list;
  349. }
  350. public bool IsAllocatedMaid(Maid maid)
  351. {
  352. NDebug.Assert(maid != null, "判定するキャラクターにnullが指定されました");
  353. foreach (EmpireLifeModeManager.EventDataObject eventDataObject in this.nowEventList)
  354. {
  355. if (eventDataObject.targetMaidList != null && eventDataObject.targetMaidList.Contains(maid))
  356. {
  357. return true;
  358. }
  359. }
  360. return false;
  361. }
  362. private DataArray<int, byte> CreateMaidDataArray(Maid maid)
  363. {
  364. NDebug.AssertNull(maid);
  365. string guid = maid.status.guid;
  366. if (this.m_SaveDataMaidScenarioExecuteCountArray.ContainsKey(guid))
  367. {
  368. return this.m_SaveDataMaidScenarioExecuteCountArray[guid];
  369. }
  370. DataArray<int, byte> dataArray = new DataArray<int, byte>();
  371. this.m_SaveDataMaidScenarioExecuteCountArray.Add(guid, dataArray);
  372. Debug.LogFormat("メイド「{0}」の情報を作成しました。", new object[]
  373. {
  374. maid.status.fullNameJpStyle
  375. });
  376. return dataArray;
  377. }
  378. public int GetMaidScenarioExecuteCount(int eventID, Maid maid)
  379. {
  380. NDebug.AssertNull(maid);
  381. string guid = maid.status.guid;
  382. if (!this.m_SaveDataMaidScenarioExecuteCountArray.ContainsKey(guid))
  383. {
  384. return 0;
  385. }
  386. return (int)this.m_SaveDataMaidScenarioExecuteCountArray[guid].Get(eventID, false);
  387. }
  388. private void IncrementMaidScenarioExecuteCount(int eventID, Maid maid)
  389. {
  390. NDebug.AssertNull(maid);
  391. string guid = maid.status.guid;
  392. DataArray<int, byte> dataArray = this.CreateMaidDataArray(maid);
  393. byte b = dataArray.Get(eventID, false);
  394. if (b < 255)
  395. {
  396. b += 1;
  397. }
  398. dataArray.Add(eventID, b, true);
  399. this.m_SaveDataScenarioExecuteCountArray.Add(eventID, b, true);
  400. }
  401. public int GetScenarioExecuteCount(int eventID)
  402. {
  403. if (!this.m_SaveDataScenarioExecuteCountArray.Contains(eventID))
  404. {
  405. return 0;
  406. }
  407. return (int)this.m_SaveDataScenarioExecuteCountArray.Get(eventID, false);
  408. }
  409. public bool Serialize(BinaryWriter brWrite)
  410. {
  411. brWrite.Write("CM3D21_LIFE_MODE_MGR");
  412. brWrite.Write(1210);
  413. brWrite.Write("2");
  414. DataArray<int, byte> saveDataScenarioExecuteCountArray = this.m_SaveDataScenarioExecuteCountArray;
  415. if (EmpireLifeModeManager.<>f__mg$cache1 == null)
  416. {
  417. EmpireLifeModeManager.<>f__mg$cache1 = new Converter<int, byte[]>(Util.GetBytes);
  418. }
  419. saveDataScenarioExecuteCountArray.Serialize(brWrite, EmpireLifeModeManager.<>f__mg$cache1, (byte data) => new byte[]
  420. {
  421. data
  422. });
  423. int count = this.m_SaveDataMaidScenarioExecuteCountArray.Count;
  424. brWrite.Write(count);
  425. foreach (KeyValuePair<string, DataArray<int, byte>> keyValuePair in this.m_SaveDataMaidScenarioExecuteCountArray)
  426. {
  427. brWrite.Write(keyValuePair.Key);
  428. DataArray<int, byte> value = keyValuePair.Value;
  429. if (EmpireLifeModeManager.<>f__mg$cache2 == null)
  430. {
  431. EmpireLifeModeManager.<>f__mg$cache2 = new Converter<int, byte[]>(Util.GetBytes);
  432. }
  433. value.Serialize(brWrite, EmpireLifeModeManager.<>f__mg$cache2, (byte data) => new byte[]
  434. {
  435. data
  436. });
  437. }
  438. List<string> list = new List<string>();
  439. foreach (Maid maid in this.lifeModeAllMaidList)
  440. {
  441. if (maid != null)
  442. {
  443. list.Add(maid.status.guid);
  444. }
  445. }
  446. brWrite.Write(list.Count);
  447. foreach (string value2 in list)
  448. {
  449. brWrite.Write(value2);
  450. }
  451. return true;
  452. }
  453. public bool Deserialize(BinaryReader brRead)
  454. {
  455. this.m_SaveDataScenarioExecuteCountArray.Clear();
  456. this.m_SaveDataMaidScenarioExecuteCountArray.Clear();
  457. if (brRead.BaseStream.Length <= brRead.BaseStream.Position + 1L)
  458. {
  459. Debug.Log("LifeMode\nこれ以上は読めない");
  460. return false;
  461. }
  462. long position = brRead.BaseStream.Position;
  463. string text = brRead.ReadString();
  464. if (text != "CM3D21_LIFE_MODE_MGR")
  465. {
  466. Debug.Log("LifeMode\nヘッダー取得に失敗しました。\n" + text);
  467. brRead.BaseStream.Seek(position, SeekOrigin.Begin);
  468. return false;
  469. }
  470. int num = brRead.ReadInt32();
  471. position = brRead.BaseStream.Position;
  472. string text2 = brRead.ReadString();
  473. int num2;
  474. if (string.IsNullOrEmpty(text2))
  475. {
  476. num2 = 0;
  477. brRead.BaseStream.Seek(position, SeekOrigin.Begin);
  478. }
  479. else
  480. {
  481. int num3 = 0;
  482. if (int.TryParse(text2, out num3) && num3 > 0 && 100 > num3)
  483. {
  484. num2 = num3;
  485. }
  486. else
  487. {
  488. num2 = 0;
  489. brRead.BaseStream.Seek(position, SeekOrigin.Begin);
  490. }
  491. }
  492. if (num2 <= 1)
  493. {
  494. if (EmpireLifeModeManager.<>f__mg$cache3 == null)
  495. {
  496. EmpireLifeModeManager.<>f__mg$cache3 = new Func<BinaryReader, int>(Util.ToInt32);
  497. }
  498. Func<BinaryReader, int> func_read_key = EmpireLifeModeManager.<>f__mg$cache3;
  499. if (EmpireLifeModeManager.<>f__mg$cache4 == null)
  500. {
  501. EmpireLifeModeManager.<>f__mg$cache4 = new Func<BinaryReader, int>(Util.ToInt32);
  502. }
  503. DataArray<int, int>.Skip(brRead, func_read_key, EmpireLifeModeManager.<>f__mg$cache4);
  504. }
  505. else
  506. {
  507. DataArray<int, byte> saveDataScenarioExecuteCountArray = this.m_SaveDataScenarioExecuteCountArray;
  508. if (EmpireLifeModeManager.<>f__mg$cache5 == null)
  509. {
  510. EmpireLifeModeManager.<>f__mg$cache5 = new Func<BinaryReader, int>(Util.ToInt32);
  511. }
  512. Func<BinaryReader, int> func_read_key2 = EmpireLifeModeManager.<>f__mg$cache5;
  513. if (EmpireLifeModeManager.<>f__mg$cache6 == null)
  514. {
  515. EmpireLifeModeManager.<>f__mg$cache6 = new Func<BinaryReader, byte>(Util.ToByte);
  516. }
  517. saveDataScenarioExecuteCountArray.Deserialize(brRead, func_read_key2, EmpireLifeModeManager.<>f__mg$cache6);
  518. int num4 = brRead.ReadInt32();
  519. for (int i = 0; i < num4; i++)
  520. {
  521. string text3 = brRead.ReadString();
  522. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(text3);
  523. if (stockMaid == null)
  524. {
  525. Debug.LogFormat("■GUID「{0}」のメイドは存在しなかったので、このメイドの情報は読み飛ばします", new object[]
  526. {
  527. text3
  528. });
  529. if (EmpireLifeModeManager.<>f__mg$cache7 == null)
  530. {
  531. EmpireLifeModeManager.<>f__mg$cache7 = new Func<BinaryReader, int>(Util.ToInt32);
  532. }
  533. Func<BinaryReader, int> func_read_key3 = EmpireLifeModeManager.<>f__mg$cache7;
  534. if (EmpireLifeModeManager.<>f__mg$cache8 == null)
  535. {
  536. EmpireLifeModeManager.<>f__mg$cache8 = new Func<BinaryReader, byte>(Util.ToByte);
  537. }
  538. DataArray<int, byte>.Skip(brRead, func_read_key3, EmpireLifeModeManager.<>f__mg$cache8);
  539. }
  540. else
  541. {
  542. DataArray<int, byte> dataArray = this.CreateMaidDataArray(stockMaid);
  543. DataArray<int, byte> dataArray2 = dataArray;
  544. if (EmpireLifeModeManager.<>f__mg$cache9 == null)
  545. {
  546. EmpireLifeModeManager.<>f__mg$cache9 = new Func<BinaryReader, int>(Util.ToInt32);
  547. }
  548. Func<BinaryReader, int> func_read_key4 = EmpireLifeModeManager.<>f__mg$cache9;
  549. if (EmpireLifeModeManager.<>f__mg$cacheA == null)
  550. {
  551. EmpireLifeModeManager.<>f__mg$cacheA = new Func<BinaryReader, byte>(Util.ToByte);
  552. }
  553. dataArray2.Deserialize(brRead, func_read_key4, EmpireLifeModeManager.<>f__mg$cacheA);
  554. }
  555. }
  556. List<Maid> list = new List<Maid>();
  557. num4 = brRead.ReadInt32();
  558. for (int j = 0; j < num4; j++)
  559. {
  560. string guid = brRead.ReadString();
  561. Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(guid);
  562. if (stockMaid2 != null)
  563. {
  564. list.Add(stockMaid2);
  565. }
  566. }
  567. this.SetAllMaidList(list);
  568. }
  569. return true;
  570. }
  571. private const int MAX_COUNT_MAID_ALLOCATE = 3;
  572. private List<EmpireLifeModeManager.EventDataObject> m_EventList = new List<EmpireLifeModeManager.EventDataObject>();
  573. private Dictionary<Facility, List<Maid>> m_NowMaidAllocationDic = new Dictionary<Facility, List<Maid>>();
  574. private List<EmpireLifeModeManager.EventDataObject> m_ExecutedEventList = new List<EmpireLifeModeManager.EventDataObject>();
  575. private List<Maid> m_LifeModeAllMaidList = new List<Maid>();
  576. private List<Maid> m_ExecutedMaidList = new List<Maid>();
  577. private Dictionary<string, DataArray<int, byte>> m_SaveDataMaidScenarioExecuteCountArray = new Dictionary<string, DataArray<int, byte>>();
  578. private DataArray<int, byte> m_SaveDataScenarioExecuteCountArray = new DataArray<int, byte>();
  579. private const string STR_LOG_HEAD = "LifeMode\n";
  580. private const string STR_LIFE_MODE_SERIALIZE_HEADER = "CM3D21_LIFE_MODE_MGR";
  581. private const string STR_LIFE_MODE_SERIALIZE_VER = "2";
  582. [CompilerGenerated]
  583. private static Func<EmpireLifeModeData.Data, int> <>f__mg$cache0;
  584. [CompilerGenerated]
  585. private static Converter<int, byte[]> <>f__mg$cache1;
  586. [CompilerGenerated]
  587. private static Converter<int, byte[]> <>f__mg$cache2;
  588. [CompilerGenerated]
  589. private static Func<BinaryReader, int> <>f__mg$cache3;
  590. [CompilerGenerated]
  591. private static Func<BinaryReader, int> <>f__mg$cache4;
  592. [CompilerGenerated]
  593. private static Func<BinaryReader, int> <>f__mg$cache5;
  594. [CompilerGenerated]
  595. private static Func<BinaryReader, byte> <>f__mg$cache6;
  596. [CompilerGenerated]
  597. private static Func<BinaryReader, int> <>f__mg$cache7;
  598. [CompilerGenerated]
  599. private static Func<BinaryReader, byte> <>f__mg$cache8;
  600. [CompilerGenerated]
  601. private static Func<BinaryReader, int> <>f__mg$cache9;
  602. [CompilerGenerated]
  603. private static Func<BinaryReader, byte> <>f__mg$cacheA;
  604. public class EventDataObject
  605. {
  606. public Facility targetFacility { get; set; }
  607. public EmpireLifeModeData.Data targetEvent { get; set; }
  608. public List<Maid> targetMaidList;
  609. }
  610. }