EmpireLifeModeManager.cs 22 KB

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