KasizukiManager.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.IO;
  6. using System.Runtime.CompilerServices;
  7. using FacilityFlag;
  8. using MaidStatus;
  9. using PlayerStatus;
  10. using UnityEngine;
  11. namespace Kasizuki
  12. {
  13. public class KasizukiManager : MonoBehaviour
  14. {
  15. public int NowOriginSaveDataNumber
  16. {
  17. get
  18. {
  19. return this.m_NowOriginSaveDataNumber;
  20. }
  21. set
  22. {
  23. this.m_NowOriginSaveDataNumber = value;
  24. }
  25. }
  26. public int NowSaveDataIndex
  27. {
  28. get
  29. {
  30. return this.m_NowKasizukiSaveDataIndex;
  31. }
  32. }
  33. public int LatestSaveDataNumber
  34. {
  35. get
  36. {
  37. return this.m_LatestSaveDataNumber;
  38. }
  39. }
  40. public DataArray<string, string> systemData
  41. {
  42. get
  43. {
  44. return this.m_SystemData;
  45. }
  46. }
  47. public Dictionary<string, DataArray<string, string>> maidDataArray
  48. {
  49. get
  50. {
  51. return this.m_MaidDataArray;
  52. }
  53. }
  54. private void Awake()
  55. {
  56. }
  57. public void Init()
  58. {
  59. this.ResetData();
  60. if (this.m_SaveDataArray != null)
  61. {
  62. this.m_SaveDataArray.Clear();
  63. this.m_SaveDataArray = null;
  64. }
  65. this.m_SaveDataArray = new Dictionary<int, KasizukiManager.SaveData>();
  66. }
  67. public void UnInit()
  68. {
  69. if (this.m_NowHaveItemDic != null)
  70. {
  71. this.m_NowHaveItemDic.Clear();
  72. this.m_NowHaveItemDic = null;
  73. }
  74. this.m_SystemData = null;
  75. if (this.m_MaidDataArray != null)
  76. {
  77. this.m_MaidDataArray.Clear();
  78. this.m_MaidDataArray = null;
  79. }
  80. }
  81. private void ResetData()
  82. {
  83. if (this.m_NowHaveItemDic != null)
  84. {
  85. this.m_NowHaveItemDic.Clear();
  86. }
  87. else
  88. {
  89. this.m_NowHaveItemDic = new DataArray<int, bool>();
  90. }
  91. if (this.m_SystemData != null)
  92. {
  93. this.m_SystemData.Clear();
  94. }
  95. else
  96. {
  97. this.m_SystemData = new DataArray<string, string>();
  98. }
  99. if (this.m_MaidDataArray != null)
  100. {
  101. this.m_MaidDataArray.Clear();
  102. }
  103. else
  104. {
  105. this.m_MaidDataArray = new Dictionary<string, DataArray<string, string>>();
  106. }
  107. this.SetNowManType(ManDataType.主人公);
  108. }
  109. public void CreateNewData()
  110. {
  111. this.ResetData();
  112. }
  113. public bool IsMeetConditions(string comparisonFlagName, string comparisonOperator, string comparisonValue, bool isEnableWarning = true)
  114. {
  115. if (string.IsNullOrEmpty(comparisonOperator))
  116. {
  117. NDebug.Assert("KasizukiManager.IsMeetConditions(string[])\n比較演算子が空文字でした", false);
  118. Debug.LogError("KasizukiManager.IsMeetConditions(string[])\n比較演算子が空文字でした");
  119. }
  120. if (string.IsNullOrEmpty(comparisonFlagName))
  121. {
  122. NDebug.Assert("KasizukiManager.IsMeetConditions(string[])\n比較するフラグ名が空文字でした", false);
  123. Debug.LogError("KasizukiManager.IsMeetConditions(string[])\n比較するフラグ名が空文字でした");
  124. }
  125. if (string.IsNullOrEmpty(comparisonValue))
  126. {
  127. NDebug.Assert("KasizukiManager.IsMeetConditions(string[])\n比較する値が空文字でした", false);
  128. Debug.LogError("KasizukiManager.IsMeetConditions(string[])\n比較する値が空文字でした");
  129. }
  130. string text;
  131. if (!this.TryGetSystemData<string>(comparisonFlagName, out text))
  132. {
  133. if (isEnableWarning)
  134. {
  135. NDebug.Warning(string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]は存在しませんでした。", comparisonFlagName));
  136. Debug.LogWarning(string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]は存在しませんでした。", comparisonFlagName));
  137. }
  138. return false;
  139. }
  140. if (comparisonOperator != null)
  141. {
  142. if (comparisonOperator == "<")
  143. {
  144. int num;
  145. NDebug.Assert(int.TryParse(text, out num), string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]の値は数値に変換できません", comparisonFlagName));
  146. int num2;
  147. NDebug.Assert(int.TryParse(comparisonValue, out num2), string.Format("KasizukiManager.IsMeetConditions(string[])\n文字列[{0}]は数値に変換できません", comparisonValue));
  148. return num < num2;
  149. }
  150. if (comparisonOperator == ">")
  151. {
  152. int num;
  153. NDebug.Assert(int.TryParse(text, out num), string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]の値は数値に変換できません", comparisonFlagName));
  154. int num2;
  155. NDebug.Assert(int.TryParse(comparisonValue, out num2), string.Format("KasizukiManager.IsMeetConditions(string[])\n文字列[{0}]は数値に変換できません", comparisonValue));
  156. return num > num2;
  157. }
  158. if (comparisonOperator == "<=")
  159. {
  160. int num;
  161. NDebug.Assert(int.TryParse(text, out num), string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]の値は数値に変換できません", comparisonFlagName));
  162. int num2;
  163. NDebug.Assert(int.TryParse(comparisonValue, out num2), string.Format("KasizukiManager.IsMeetConditions(string[])\n文字列[{0}]は数値に変換できません", comparisonValue));
  164. return num <= num2;
  165. }
  166. if (comparisonOperator == ">=")
  167. {
  168. int num;
  169. NDebug.Assert(int.TryParse(text, out num), string.Format("KasizukiManager.IsMeetConditions(string[])\nフラグ[{0}]の値は数値に変換できません", comparisonFlagName));
  170. int num2;
  171. NDebug.Assert(int.TryParse(comparisonValue, out num2), string.Format("KasizukiManager.IsMeetConditions(string[])\n文字列[{0}]は数値に変換できません", comparisonValue));
  172. return num >= num2;
  173. }
  174. if (comparisonOperator == "=")
  175. {
  176. return text.CompareTo(comparisonValue) == 0;
  177. }
  178. if (comparisonOperator == "!")
  179. {
  180. return text.CompareTo(comparisonValue) != 0;
  181. }
  182. }
  183. NDebug.Assert(string.Format("KasizukiManager.IsMeetConditions(string[])\n比較演算子に不正な文字列が指定されました\n受け取った比較演算子:{0}", comparisonOperator), false);
  184. return false;
  185. }
  186. public bool IsMeetConditions(string[] str)
  187. {
  188. if (str.Length != 3)
  189. {
  190. NDebug.Assert("KasizukiManager.IsMeetConditions(string[])\n引数の数が正しくありません。", false);
  191. Debug.LogErrorFormat("KasizukiManager.IsMeetConditions(string[])\n渡された引数の数:{0}", new object[]
  192. {
  193. str.Length
  194. });
  195. return false;
  196. }
  197. return this.IsMeetConditions(str[0], str[1], str[2], true);
  198. }
  199. private void UpdateData<T>(DataArray<string, string> dataArray, string valueName, T value, bool enableWarningEmptyData = true)
  200. {
  201. if (dataArray == null)
  202. {
  203. NDebug.Assert("データ配列にnullが指定されました", false);
  204. return;
  205. }
  206. string value2 = value.ToString();
  207. if (!dataArray.Contains(valueName))
  208. {
  209. if (enableWarningEmptyData)
  210. {
  211. NDebug.Warning(string.Format("データ配列には「{0}」が登録されていません。", valueName));
  212. return;
  213. }
  214. dataArray.Add(valueName, value2, false);
  215. }
  216. else
  217. {
  218. dataArray.Add(valueName, value2, true);
  219. }
  220. }
  221. private T GetData<T>(DataArray<string, string> dataArray, string valueName, bool enableWarningEmptyData = true)
  222. {
  223. if (dataArray == null)
  224. {
  225. NDebug.Assert("データ配列にnullが指定されました", false);
  226. return default(T);
  227. }
  228. string text = dataArray.Get(valueName, false);
  229. if (text == null)
  230. {
  231. if (enableWarningEmptyData)
  232. {
  233. Debug.LogWarning(string.Format("データ配列には「{0}」が登録されていません。", valueName));
  234. }
  235. return default(T);
  236. }
  237. Type typeFromHandle = typeof(T);
  238. TypeConverter converter = TypeDescriptor.GetConverter(typeFromHandle);
  239. T result = default(T);
  240. try
  241. {
  242. if (converter != null)
  243. {
  244. result = (T)((object)converter.ConvertFromString(text));
  245. }
  246. }
  247. catch (Exception ex)
  248. {
  249. string message = string.Concat(new string[]
  250. {
  251. "データの変換に失敗しました\n値: ",
  252. text,
  253. "\nを ",
  254. typeFromHandle.Name,
  255. " への変換に失敗しました。"
  256. });
  257. NDebug.Warning(message);
  258. Debug.LogWarning(message);
  259. }
  260. return result;
  261. }
  262. private bool TryGetData<T>(DataArray<string, string> dataArray, string valueName, out T value)
  263. {
  264. value = default(T);
  265. if (dataArray == null)
  266. {
  267. NDebug.Assert("データ配列にnullが指定されました", false);
  268. Debug.LogError("データ配列にnullが指定されました");
  269. return false;
  270. }
  271. string text = dataArray.Get(valueName, false);
  272. if (text == null)
  273. {
  274. return false;
  275. }
  276. Type typeFromHandle = typeof(T);
  277. TypeConverter converter = TypeDescriptor.GetConverter(typeFromHandle);
  278. try
  279. {
  280. if (converter != null)
  281. {
  282. value = (T)((object)converter.ConvertFromString(text));
  283. }
  284. }
  285. catch (Exception ex)
  286. {
  287. string message = string.Concat(new string[]
  288. {
  289. "データの変換に失敗しました\n値: ",
  290. text,
  291. "\nを ",
  292. typeFromHandle.Name,
  293. " への変換に失敗しました。"
  294. });
  295. NDebug.Warning(message);
  296. Debug.LogWarning(message);
  297. }
  298. return true;
  299. }
  300. private bool RemoveData(DataArray<string, string> dataArray, string valueName, bool enableWarningEmptyData = true)
  301. {
  302. if (dataArray == null)
  303. {
  304. NDebug.Assert("データ配列にnullが指定されました", false);
  305. return false;
  306. }
  307. bool flag = dataArray.Remove(valueName, enableWarningEmptyData);
  308. if (!flag && enableWarningEmptyData)
  309. {
  310. NDebug.Warning(string.Format("データ配列には「{0}」が登録されていません。", valueName));
  311. }
  312. return flag;
  313. }
  314. public void SetSystemData<T>(string valueName, T value, bool isEnableDebugLog = false)
  315. {
  316. this.UpdateData<T>(this.m_SystemData, valueName, value, false);
  317. if (isEnableDebugLog)
  318. {
  319. Debug.LogFormat("傅きモードのシステムの情報を更新しました。\nデータ名:{0}\u3000\u3000値:{1}", new object[]
  320. {
  321. valueName,
  322. value.ToString()
  323. });
  324. }
  325. }
  326. public void SetSystemData<T>(SystemDataType dataType, T value, bool isEnableDebugLog = false)
  327. {
  328. string name = Enum.GetName(typeof(SystemDataType), dataType);
  329. if (string.IsNullOrEmpty(name))
  330. {
  331. NDebug.Assert("データ型に不正な値が入りました", false);
  332. Debug.LogError("データ型に不正な値が入りました");
  333. }
  334. this.SetSystemData<T>(name, value, isEnableDebugLog);
  335. }
  336. public T GetSystemData<T>(string valueName)
  337. {
  338. return this.GetData<T>(this.m_SystemData, valueName, false);
  339. }
  340. public T GetSystemData<T>(SystemDataType dataType)
  341. {
  342. string name = Enum.GetName(typeof(SystemDataType), dataType);
  343. if (string.IsNullOrEmpty(name))
  344. {
  345. NDebug.Assert("データ型に不正な値が入りました", false);
  346. Debug.LogError("データ型に不正な値が入りました");
  347. }
  348. return this.GetSystemData<T>(name);
  349. }
  350. public bool TryGetSystemData<T>(string valueName, out T value)
  351. {
  352. return this.TryGetData<T>(this.m_SystemData, valueName, out value);
  353. }
  354. public bool TryGetSystemData<T>(SystemDataType dataType, out T value)
  355. {
  356. string name = Enum.GetName(typeof(SystemDataType), dataType);
  357. if (string.IsNullOrEmpty(name))
  358. {
  359. NDebug.Assert("データ型に不正な値が入りました", false);
  360. Debug.LogError("データ型に不正な値が入りました");
  361. }
  362. return this.TryGetSystemData<T>(name, out value);
  363. }
  364. public Maid GetMan()
  365. {
  366. return GameMain.Instance.CharacterMgr.GetMan(0);
  367. }
  368. public int GetNowManType()
  369. {
  370. return this.GetSystemData<int>(SystemDataType.男種類);
  371. }
  372. public void SetNowManType(int manTypeID)
  373. {
  374. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  375. {
  376. manTypeID = 10;
  377. }
  378. ManData.Data data = ManData.GetData(manTypeID);
  379. if (ManData.IsEnabled(manTypeID))
  380. {
  381. this.SetSystemData<int>(SystemDataType.男種類, manTypeID, false);
  382. }
  383. else
  384. {
  385. NDebug.Assert("男の種類に正しくない値が入りました", false);
  386. }
  387. }
  388. public void SetNowManType(ManDataType manType)
  389. {
  390. this.SetNowManType((int)manType);
  391. }
  392. public void SetManModel(Maid target, ManDataType type)
  393. {
  394. if (type == ManDataType.主人公)
  395. {
  396. this.UpdateManModelToPlayerData(target);
  397. }
  398. else
  399. {
  400. ManData.Data data = ManData.GetData((int)type);
  401. CharacterMgr.NpcData npcData = CharacterMgr.npcDatas[data.modelResourceName];
  402. npcData.Apply(target, false);
  403. GameMain.Instance.CharacterMgr.status.playerName = npcData.firstName;
  404. }
  405. }
  406. public void UpdateManModel(Maid target, Action callback)
  407. {
  408. target.Visible = true;
  409. target.AllProcProp();
  410. target.body0.SetChinkoVisible(false);
  411. target.CrossFade("man_porse01.anm", false, true, false, 0f, 1f);
  412. base.StartCoroutine(this.CoroutineWaitPropSeq(target, callback));
  413. }
  414. private void UpdateManModelToPlayerData(Maid target)
  415. {
  416. if (this.m_CachedOriginPlayerDataDic == null)
  417. {
  418. Debug.LogWarning("プレイヤーの情報は未だキャッシュされていない");
  419. return;
  420. }
  421. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  422. PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
  423. target.status.lastName = this.m_CachedOriginPlayerName;
  424. status.playerName = this.m_CachedOriginPlayerName;
  425. for (int i = 0; i < 114; i++)
  426. {
  427. MPN mpn = (MPN)i;
  428. if (mpn != MPN.null_mpn)
  429. {
  430. target.SetProp(mpn, this.m_CachedOriginPlayerDataDic[mpn].strFileName, this.m_CachedOriginPlayerDataDic[mpn].nFileNameRID, false, false);
  431. target.SetProp(mpn, this.m_CachedOriginPlayerDataDic[mpn].value, false);
  432. }
  433. }
  434. target.ManColor = this.m_CachedOriginPlayerColor;
  435. target.ManColorUpdate();
  436. }
  437. public void CacheOriginPlayerData()
  438. {
  439. this.m_CachedOriginPlayerDataDic = new Dictionary<MPN, MaidProp>();
  440. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  441. for (int i = 0; i < 114; i++)
  442. {
  443. MPN mpn = (MPN)i;
  444. MaidProp maidProp = new MaidProp();
  445. MaidProp prop = man.GetProp(mpn);
  446. maidProp.strFileName = prop.strFileName;
  447. maidProp.nFileNameRID = prop.nFileNameRID;
  448. maidProp.value = prop.value;
  449. this.m_CachedOriginPlayerDataDic.Add(mpn, maidProp);
  450. }
  451. this.m_CachedOriginPlayerName = GameMain.Instance.CharacterMgr.status.playerName;
  452. this.m_CachedOriginPlayerColor = man.ManColor;
  453. }
  454. public void ClearCacheOriginPlayerData()
  455. {
  456. if (this.m_CachedOriginPlayerDataDic != null)
  457. {
  458. this.m_CachedOriginPlayerDataDic.Clear();
  459. this.m_CachedOriginPlayerDataDic = null;
  460. }
  461. this.m_CachedOriginPlayerName = string.Empty;
  462. }
  463. private IEnumerator CoroutineWaitPropSeq(Maid target, Action callback)
  464. {
  465. while (target.IsBusy)
  466. {
  467. yield return null;
  468. }
  469. if (callback != null)
  470. {
  471. callback();
  472. }
  473. yield break;
  474. }
  475. private DataArray<string, string> GetMaidDataArray(Maid maid)
  476. {
  477. if (maid == null)
  478. {
  479. NDebug.Assert("メイドにnullが指定されました", false);
  480. return null;
  481. }
  482. string guid = maid.status.guid;
  483. DataArray<string, string> result = null;
  484. if (this.m_MaidDataArray.ContainsKey(guid))
  485. {
  486. result = this.m_MaidDataArray[guid];
  487. }
  488. return result;
  489. }
  490. private DataArray<string, string> CreateMaidDataArray(Maid maid)
  491. {
  492. if (maid == null)
  493. {
  494. NDebug.Assert("メイドにnullが指定されました", false);
  495. return null;
  496. }
  497. string guid = maid.status.guid;
  498. if (this.m_MaidDataArray.ContainsKey(guid))
  499. {
  500. Debug.LogFormat("メイド「{0}」のデータ配列は既に作成されています。", new object[]
  501. {
  502. maid.status.fullNameJpStyle
  503. });
  504. return this.m_MaidDataArray[guid];
  505. }
  506. DataArray<string, string> dataArray = new DataArray<string, string>();
  507. this.m_MaidDataArray.Add(guid, dataArray);
  508. return dataArray;
  509. }
  510. public void SetMaidData<T>(Maid maid, string valueName, T value, bool enableWarning = false)
  511. {
  512. DataArray<string, string> dataArray = this.GetMaidDataArray(maid);
  513. if (dataArray == null)
  514. {
  515. dataArray = this.CreateMaidDataArray(maid);
  516. }
  517. if (valueName == Enum.GetName(typeof(MaidDataType), MaidDataType.好感度\uFF3F本編))
  518. {
  519. if (enableWarning)
  520. {
  521. NDebug.Warning(string.Format("本編用メイドデータ「{0}」を書き換えようとしました", valueName));
  522. Debug.LogWarning(string.Format("本編用メイドデータ「{0}」を書き換えようとしました", valueName));
  523. }
  524. return;
  525. }
  526. this.UpdateData<T>(dataArray, valueName, value, enableWarning);
  527. }
  528. public void SetMaidData<T>(Maid maid, MaidDataType dataType, T value, bool enableWarning = false)
  529. {
  530. string name = Enum.GetName(typeof(MaidDataType), dataType);
  531. if (string.IsNullOrEmpty(name))
  532. {
  533. NDebug.Assert("データ型に不正な値が入りました", false);
  534. Debug.LogError("データ型に不正な値が入りました");
  535. }
  536. this.SetMaidData<T>(maid, name, value, enableWarning);
  537. }
  538. public T GetMaidData<T>(Maid maid, string valueName, bool enableWarning = true)
  539. {
  540. if (valueName == Enum.GetName(typeof(MaidDataType), MaidDataType.好感度\uFF3F本編))
  541. {
  542. try
  543. {
  544. T result = default(T);
  545. string text = maid.status.likability.ToString();
  546. TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
  547. if (converter != null)
  548. {
  549. result = (T)((object)converter.ConvertFromString(text));
  550. }
  551. return result;
  552. }
  553. catch (Exception ex)
  554. {
  555. NDebug.Assert(ex.ToString(), false);
  556. Debug.LogError(ex);
  557. }
  558. }
  559. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  560. if (maidDataArray == null)
  561. {
  562. Debug.LogFormat("メイド「{0}」の傅きモード用データ配列は未作成でした", new object[]
  563. {
  564. maid.status.fullNameJpStyle
  565. });
  566. return default(T);
  567. }
  568. return this.GetData<T>(maidDataArray, valueName, enableWarning);
  569. }
  570. public T GetMaidData<T>(Maid maid, MaidDataType dataType, bool enableWarning = true)
  571. {
  572. string name = Enum.GetName(typeof(MaidDataType), dataType);
  573. if (string.IsNullOrEmpty(name))
  574. {
  575. NDebug.Assert("データ型に不正な値が入りました", false);
  576. Debug.LogError("データ型に不正な値が入りました");
  577. }
  578. return this.GetMaidData<T>(maid, name, enableWarning);
  579. }
  580. public int GetMaidLikability(Maid maid, ManDataType dataType)
  581. {
  582. if (dataType == ManDataType.主人公)
  583. {
  584. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, false);
  585. }
  586. if (dataType == ManDataType.傅き男1)
  587. {
  588. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  589. }
  590. if (dataType == ManDataType.傅き男2)
  591. {
  592. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男2, false);
  593. }
  594. if (dataType == ManDataType.傅き男3)
  595. {
  596. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男3, false);
  597. }
  598. if (dataType == ManDataType.傅き男4)
  599. {
  600. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男4, false);
  601. }
  602. if (dataType != ManDataType.傅き男5)
  603. {
  604. NDebug.Assert("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました", false);
  605. Debug.LogErrorFormat("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました\n男種類.{0}", new object[]
  606. {
  607. dataType.ToString()
  608. });
  609. return -1;
  610. }
  611. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男5, false);
  612. }
  613. public bool TryGetMaidData<T>(Maid maid, string valueName, out T value)
  614. {
  615. value = default(T);
  616. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  617. return maidDataArray != null && this.TryGetData<T>(maidDataArray, valueName, out value);
  618. }
  619. public bool TryGetMaidData<T>(Maid maid, MaidDataType dataType, out T value)
  620. {
  621. string name = Enum.GetName(typeof(MaidDataType), dataType);
  622. if (string.IsNullOrEmpty(name))
  623. {
  624. NDebug.Assert("データ型に不正な値が入りました", false);
  625. Debug.LogError("データ型に不正な値が入りました");
  626. }
  627. return this.TryGetMaidData<T>(maid, name, out value);
  628. }
  629. public bool RemoveMaidData(Maid maid, string valueName, bool enableWarning = false)
  630. {
  631. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  632. if (maidDataArray == null)
  633. {
  634. Debug.LogFormat("メイド「{0}」に関する傅きモードのデータ配列は未作成でした\nデータ名:{1}", new object[]
  635. {
  636. maid.status.fullNameJpStyle,
  637. valueName
  638. });
  639. return false;
  640. }
  641. return this.RemoveData(maidDataArray, valueName, enableWarning);
  642. }
  643. public bool RemoveMaidData(Maid maid, MaidDataType dataType, bool enableWarning = false)
  644. {
  645. string name = Enum.GetName(typeof(MaidDataType), dataType);
  646. if (string.IsNullOrEmpty(name))
  647. {
  648. NDebug.Assert("データ型に不正な値が入りました", false);
  649. Debug.LogError("データ型に不正な値が入りました");
  650. }
  651. return this.RemoveMaidData(maid, name, enableWarning);
  652. }
  653. public static List<Maid> GetEnableMaidList()
  654. {
  655. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  656. List<Maid> list = new List<Maid>();
  657. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  658. {
  659. Maid stockMaid = characterMgr.GetStockMaid(i);
  660. if (stockMaid.status.heroineType != HeroineType.Transfer)
  661. {
  662. if (stockMaid.status.heroineType != HeroineType.Sub)
  663. {
  664. list.Add(stockMaid);
  665. }
  666. }
  667. }
  668. return list;
  669. }
  670. public void UpdateLatestSaveDataNumber()
  671. {
  672. int count = this.m_SaveDataArray.Count;
  673. List<KasizukiManager.SaveData> list = new List<KasizukiManager.SaveData>(this.m_SaveDataArray.Values);
  674. int latestSaveDataNumber = -1;
  675. long num = -1L;
  676. for (int i = 0; i < count; i++)
  677. {
  678. KasizukiManager.SaveData saveData = list[i];
  679. if (saveData != null && saveData.header != null)
  680. {
  681. long num2 = 0L;
  682. if (long.TryParse(saveData.header.strRealTime, out num2))
  683. {
  684. if (num < num2)
  685. {
  686. num = num2;
  687. latestSaveDataNumber = saveData.header.saveDataNumber;
  688. }
  689. }
  690. }
  691. }
  692. this.m_LatestSaveDataNumber = latestSaveDataNumber;
  693. }
  694. public void SerializeLocal(int saveDataIndex)
  695. {
  696. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  697. KasizukiManager.SaveData saveData;
  698. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  699. {
  700. saveData = this.m_SaveDataArray[saveDataIndex];
  701. }
  702. else
  703. {
  704. saveData = new KasizukiManager.SaveData();
  705. this.m_SaveDataArray.Add(saveDataIndex, saveData);
  706. }
  707. saveData.header.saveDataNumber = saveDataIndex;
  708. saveData.header.saveDataVersion = 5;
  709. saveData.header.UpdateNowTime();
  710. saveData.header.lastManType = this.GetNowManType();
  711. saveData.header.playCount = this.GetSystemData<int>(SystemDataType.プレイ回数);
  712. this.SerializeSaveData(saveData);
  713. this.UpdateLatestSaveDataNumber();
  714. }
  715. public void DeserializeLocal(int saveDataIndex)
  716. {
  717. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  718. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  719. {
  720. Debug.LogWarning(string.Format("傅きモードのセーブデータ[{0}]番は存在しません", saveDataIndex));
  721. return;
  722. }
  723. KasizukiManager.SaveData saveData = this.m_SaveDataArray[saveDataIndex];
  724. this.ResetData();
  725. this.DeserializeSaveData(saveData);
  726. }
  727. public void DeleteSaveDataLocal(int saveDataIndex)
  728. {
  729. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  730. {
  731. return;
  732. }
  733. this.m_SaveDataArray.Remove(saveDataIndex);
  734. this.UpdateLatestSaveDataNumber();
  735. }
  736. public KasizukiManager.SaveDataHeader GetSaveDataHeader(int saveDataIndex)
  737. {
  738. KasizukiManager.SaveDataHeader result;
  739. this.TryGetSaveDataHeader(saveDataIndex, out result);
  740. return result;
  741. }
  742. public bool TryGetSaveDataHeader(int saveDataIndex, out KasizukiManager.SaveDataHeader header)
  743. {
  744. header = null;
  745. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  746. {
  747. header = this.m_SaveDataArray[saveDataIndex].header;
  748. return true;
  749. }
  750. return false;
  751. }
  752. public bool IsExistSaveData(int saveDataIndex)
  753. {
  754. return this.m_SaveDataArray.ContainsKey(saveDataIndex);
  755. }
  756. public void Serialize(BinaryWriter bw)
  757. {
  758. bw.Write("COM3D2_KASIZUKI");
  759. bw.Write(1270);
  760. this.SerializeOriginHeader(bw);
  761. foreach (KeyValuePair<int, KasizukiManager.SaveData> keyValuePair in this.m_SaveDataArray)
  762. {
  763. int key = keyValuePair.Key;
  764. KasizukiManager.SaveData value = keyValuePair.Value;
  765. value.Serialize(bw.BaseStream);
  766. }
  767. this.UpdateLatestSaveDataNumber();
  768. KasizukiManager.FixMaidThumbnails();
  769. }
  770. public void Deserialize(int originSaveDataNumber, BinaryReader br)
  771. {
  772. this.NowOriginSaveDataNumber = originSaveDataNumber;
  773. KasizukiManager.DeleteTmpMaidThumnails();
  774. long position = br.BaseStream.Position;
  775. if (br.BaseStream.Length <= position + 1L)
  776. {
  777. Debug.LogWarning(string.Format("これ以上バッファが無いので、処理を終了します\n現在位置:{0}\n長さ:{1}", position, br.BaseStream.Length));
  778. return;
  779. }
  780. string text = br.ReadString();
  781. if (text != "COM3D2_KASIZUKI")
  782. {
  783. NDebug.Warning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  784. Debug.LogWarning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  785. br.BaseStream.Seek(position, SeekOrigin.Begin);
  786. return;
  787. }
  788. int num = br.ReadInt32();
  789. int num2;
  790. this.DeserializeOriginHeader(br, out num2);
  791. this.m_SaveDataArray.Clear();
  792. for (int i = 0; i < num2; i++)
  793. {
  794. KasizukiManager.SaveData saveData = new KasizukiManager.SaveData();
  795. if (!saveData.Deserialize(br.BaseStream))
  796. {
  797. break;
  798. }
  799. if (!this.m_SaveDataArray.ContainsKey(saveData.header.saveDataNumber))
  800. {
  801. this.m_SaveDataArray.Add(saveData.header.saveDataNumber, saveData);
  802. }
  803. else
  804. {
  805. this.m_SaveDataArray[saveData.header.saveDataNumber] = saveData;
  806. }
  807. }
  808. this.UpdateLatestSaveDataNumber();
  809. Debug.Log("プレイヤーの元情報をキャッシュします");
  810. this.CacheOriginPlayerData();
  811. }
  812. private void SerializeOriginHeader(BinaryWriter bw)
  813. {
  814. int count = this.m_SaveDataArray.Count;
  815. byte[] buffer = Util.CreatePrefix(count);
  816. bw.Write(buffer);
  817. }
  818. private void DeserializeOriginHeader(BinaryReader br, out int saveDataCount)
  819. {
  820. int prefix = Util.GetPrefix(br.BaseStream, br.BaseStream.Position, true);
  821. saveDataCount = prefix;
  822. }
  823. private void SerializeSaveData(KasizukiManager.SaveData saveData)
  824. {
  825. using (MemoryStream memoryStream = new MemoryStream())
  826. {
  827. using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
  828. {
  829. DataArray<string, string> systemData = this.m_SystemData;
  830. BinaryWriter brWrite = binaryWriter;
  831. if (KasizukiManager.<>f__mg$cache0 == null)
  832. {
  833. KasizukiManager.<>f__mg$cache0 = new Converter<string, byte[]>(Util.GetBytes);
  834. }
  835. Converter<string, byte[]> converter_key = KasizukiManager.<>f__mg$cache0;
  836. if (KasizukiManager.<>f__mg$cache1 == null)
  837. {
  838. KasizukiManager.<>f__mg$cache1 = new Converter<string, byte[]>(Util.GetBytes);
  839. }
  840. systemData.Serialize(brWrite, converter_key, KasizukiManager.<>f__mg$cache1);
  841. int count = this.m_MaidDataArray.Count;
  842. binaryWriter.Write(count);
  843. foreach (KeyValuePair<string, DataArray<string, string>> keyValuePair in this.m_MaidDataArray)
  844. {
  845. binaryWriter.Write(keyValuePair.Key);
  846. DataArray<string, string> value = keyValuePair.Value;
  847. BinaryWriter brWrite2 = binaryWriter;
  848. if (KasizukiManager.<>f__mg$cache2 == null)
  849. {
  850. KasizukiManager.<>f__mg$cache2 = new Converter<string, byte[]>(Util.GetBytes);
  851. }
  852. Converter<string, byte[]> converter_key2 = KasizukiManager.<>f__mg$cache2;
  853. if (KasizukiManager.<>f__mg$cache3 == null)
  854. {
  855. KasizukiManager.<>f__mg$cache3 = new Converter<string, byte[]>(Util.GetBytes);
  856. }
  857. value.Serialize(brWrite2, converter_key2, KasizukiManager.<>f__mg$cache3);
  858. }
  859. }
  860. saveData.buffer = memoryStream.ToArray();
  861. }
  862. }
  863. private void DeserializeSaveData(KasizukiManager.SaveData saveData)
  864. {
  865. using (MemoryStream memoryStream = new MemoryStream(saveData.buffer))
  866. {
  867. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  868. {
  869. DataArray<string, string> systemData = this.m_SystemData;
  870. BinaryReader brRead = binaryReader;
  871. if (KasizukiManager.<>f__mg$cache4 == null)
  872. {
  873. KasizukiManager.<>f__mg$cache4 = new Func<BinaryReader, string>(Util.ToString);
  874. }
  875. Func<BinaryReader, string> func_read_key = KasizukiManager.<>f__mg$cache4;
  876. if (KasizukiManager.<>f__mg$cache5 == null)
  877. {
  878. KasizukiManager.<>f__mg$cache5 = new Func<BinaryReader, string>(Util.ToString);
  879. }
  880. systemData.Deserialize(brRead, func_read_key, KasizukiManager.<>f__mg$cache5);
  881. this.SetNowManType(saveData.header.lastManType);
  882. int num = binaryReader.ReadInt32();
  883. for (int i = 0; i < num; i++)
  884. {
  885. string text = binaryReader.ReadString();
  886. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(text);
  887. if (stockMaid == null)
  888. {
  889. Debug.LogFormat("GUID「{0}」のメイドは存在しなかったので、このメイドの情報は読み飛ばします", new object[]
  890. {
  891. text
  892. });
  893. DataArray<string, string> dataArray = new DataArray<string, string>();
  894. DataArray<string, string> dataArray2 = dataArray;
  895. BinaryReader brRead2 = binaryReader;
  896. if (KasizukiManager.<>f__mg$cache6 == null)
  897. {
  898. KasizukiManager.<>f__mg$cache6 = new Func<BinaryReader, string>(Util.ToString);
  899. }
  900. Func<BinaryReader, string> func_read_key2 = KasizukiManager.<>f__mg$cache6;
  901. if (KasizukiManager.<>f__mg$cache7 == null)
  902. {
  903. KasizukiManager.<>f__mg$cache7 = new Func<BinaryReader, string>(Util.ToString);
  904. }
  905. dataArray2.Deserialize(brRead2, func_read_key2, KasizukiManager.<>f__mg$cache7);
  906. }
  907. else
  908. {
  909. DataArray<string, string> dataArray3 = this.CreateMaidDataArray(stockMaid);
  910. DataArray<string, string> dataArray4 = dataArray3;
  911. BinaryReader brRead3 = binaryReader;
  912. if (KasizukiManager.<>f__mg$cache8 == null)
  913. {
  914. KasizukiManager.<>f__mg$cache8 = new Func<BinaryReader, string>(Util.ToString);
  915. }
  916. Func<BinaryReader, string> func_read_key3 = KasizukiManager.<>f__mg$cache8;
  917. if (KasizukiManager.<>f__mg$cache9 == null)
  918. {
  919. KasizukiManager.<>f__mg$cache9 = new Func<BinaryReader, string>(Util.ToString);
  920. }
  921. dataArray4.Deserialize(brRead3, func_read_key3, KasizukiManager.<>f__mg$cache9);
  922. }
  923. }
  924. }
  925. }
  926. }
  927. public static Texture2D GetMaidThumbnail(Maid maid)
  928. {
  929. Texture2D result = null;
  930. string text = Path.GetFullPath(".\\") + "Thumb\\";
  931. if (!Directory.Exists(text))
  932. {
  933. Directory.CreateDirectory(text);
  934. }
  935. string guid = maid.status.guid;
  936. string text2 = text + "_tmp_kasizuki_" + guid + ".png";
  937. if (File.Exists(text2))
  938. {
  939. result = UTY.LoadTexture(text2);
  940. }
  941. else
  942. {
  943. text2 = text + "kasizuki_" + guid + ".png";
  944. if (File.Exists(text2))
  945. {
  946. result = UTY.LoadTexture(text2);
  947. }
  948. }
  949. return result;
  950. }
  951. public static bool IsExistMaidThumbnail(Maid maid)
  952. {
  953. string text = Path.GetFullPath(".\\") + "Thumb\\";
  954. if (!Directory.Exists(text))
  955. {
  956. return false;
  957. }
  958. string guid = maid.status.guid;
  959. string path = text + "_tmp_kasizuki_" + guid + ".png";
  960. if (File.Exists(path))
  961. {
  962. return true;
  963. }
  964. path = text + "kasizuki_" + guid + ".png";
  965. return File.Exists(path);
  966. }
  967. private static void FixMaidThumbnails()
  968. {
  969. string text = Path.GetFullPath(".\\") + "Thumb\\";
  970. if (!Directory.Exists(text))
  971. {
  972. return;
  973. }
  974. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  975. for (int i = 0; i < files.Length; i++)
  976. {
  977. string text2 = string.Empty;
  978. try
  979. {
  980. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  981. }
  982. catch
  983. {
  984. }
  985. if (string.IsNullOrEmpty(text2))
  986. {
  987. files[i] = string.Empty;
  988. }
  989. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  990. {
  991. files[i] = string.Empty;
  992. }
  993. }
  994. for (int j = 0; j < files.Length; j++)
  995. {
  996. if (!string.IsNullOrEmpty(files[j]))
  997. {
  998. try
  999. {
  1000. int length = "_tmp_kasizuki_".Length;
  1001. string text3 = files[j].Substring(text.Length, files[j].Length - text.Length);
  1002. string str = "kasizuki_" + text3.Substring(length, text3.Length - length - ".png".Length) + ".png";
  1003. if (File.Exists(text + str))
  1004. {
  1005. File.Delete(text + str);
  1006. }
  1007. File.Move(files[j], text + str);
  1008. }
  1009. catch
  1010. {
  1011. }
  1012. }
  1013. }
  1014. }
  1015. private static void DeleteTmpMaidThumnails()
  1016. {
  1017. string text = Path.GetFullPath(".\\") + "Thumb\\";
  1018. if (!Directory.Exists(text))
  1019. {
  1020. return;
  1021. }
  1022. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  1023. for (int i = 0; i < files.Length; i++)
  1024. {
  1025. string text2 = string.Empty;
  1026. try
  1027. {
  1028. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  1029. }
  1030. catch
  1031. {
  1032. }
  1033. if (string.IsNullOrEmpty(text2))
  1034. {
  1035. files[i] = string.Empty;
  1036. }
  1037. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  1038. {
  1039. files[i] = string.Empty;
  1040. }
  1041. }
  1042. for (int j = 0; j < files.Length; j++)
  1043. {
  1044. if (!string.IsNullOrEmpty(files[j]))
  1045. {
  1046. try
  1047. {
  1048. File.Delete(files[j]);
  1049. }
  1050. catch
  1051. {
  1052. }
  1053. }
  1054. }
  1055. }
  1056. public void TJSFuncGetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1057. {
  1058. NDebug.Assert(result != null, "error GetKasizukiSystemFlag");
  1059. NDebug.Assert(1 == tjs_param.Length, "GetKasizukiSystemFlag args count error.");
  1060. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1061. result.SetString(kasizukiMgr.GetSystemData<string>(tjs_param[0].AsString()));
  1062. }
  1063. public void TJSFuncSetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1064. {
  1065. NDebug.Assert(2 == tjs_param.Length, "SetKasizukiSystemFlag args count error.");
  1066. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1067. kasizukiMgr.SetSystemData<string>(tjs_param[0].AsString(), tjs_param[1].AsString(), false);
  1068. }
  1069. public void TJSFuncAddKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1070. {
  1071. NDebug.Assert(2 == tjs_param.Length, "AddKasizukiSystemFlag args count error.");
  1072. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1073. string valueName = tjs_param[0].AsString();
  1074. int num = kasizukiMgr.GetSystemData<int>(valueName);
  1075. num += tjs_param[1].AsInteger();
  1076. kasizukiMgr.SetSystemData<int>(valueName, num, false);
  1077. }
  1078. public void TJSFuncSetKasizukiPassFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1079. {
  1080. NDebug.Assert(1 == tjs_param.Length, "SetKasizukiPassFlag args count error.");
  1081. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1082. int id = tjs_param[0].AsInteger();
  1083. PlayData.Data data = PlayData.GetData(id);
  1084. data.IsPassed = true;
  1085. }
  1086. public void TJSFuncSetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1087. {
  1088. NDebug.Assert(3 == tjs_param.Length, "SetKasizukiMaidFlag args count error.");
  1089. int num = tjs_param[0].AsInteger();
  1090. string valueName = tjs_param[1].AsString();
  1091. int value = tjs_param[2].AsInteger();
  1092. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1093. NDebug.Assert(maid != null, "[SetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1094. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1095. kasizukiMgr.SetMaidData<int>(maid, valueName, value, false);
  1096. }
  1097. public void TJSFuncGetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1098. {
  1099. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1100. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1101. int num = tjs_param[0].AsInteger();
  1102. string valueName = tjs_param[1].AsString();
  1103. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1104. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1105. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1106. int maidData = kasizukiMgr.GetMaidData<int>(maid, valueName, false);
  1107. result.SetInteger(maidData);
  1108. }
  1109. public void TJSFuncIsKasizukiCorrectSenarioFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1110. {
  1111. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1112. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1113. int num = tjs_param[0].AsInteger();
  1114. int id = tjs_param[1].AsInteger();
  1115. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1116. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1117. ManDataType nowManType = (ManDataType)this.GetNowManType();
  1118. bool @bool = PlayData.GetData(id).IsCorrectMaid(maid, nowManType);
  1119. result.SetBool(@bool);
  1120. }
  1121. public static string CreateMaidTmpThumbName(Maid maid)
  1122. {
  1123. NDebug.AssertNull(maid != null);
  1124. return "_tmp_kasizuki_" + maid.status.guid + ".png";
  1125. }
  1126. public const int MAN_ACTIVATE_SLOT = 0;
  1127. private const string STR_SERIALIZE_HEADER = "COM3D2_KASIZUKI";
  1128. private const int SERIALIZE_VERSION = 5;
  1129. private int m_NowOriginSaveDataNumber;
  1130. private int m_NowKasizukiSaveDataIndex = 1;
  1131. private DataArray<int, bool> m_NowHaveItemDic;
  1132. private DataArray<string, string> m_SystemData;
  1133. private Dictionary<string, DataArray<string, string>> m_MaidDataArray;
  1134. private Dictionary<int, KasizukiManager.SaveData> m_SaveDataArray;
  1135. private int m_LatestSaveDataNumber = -1;
  1136. private Dictionary<MPN, MaidProp> m_CachedOriginPlayerDataDic;
  1137. private string m_CachedOriginPlayerName;
  1138. private Color m_CachedOriginPlayerColor;
  1139. public const string STR_TMP_THUMB_NAME = "_tmp_kasizuki_";
  1140. public const string STR_THUMB_NAME = "kasizuki_";
  1141. [CompilerGenerated]
  1142. private static Converter<string, byte[]> <>f__mg$cache0;
  1143. [CompilerGenerated]
  1144. private static Converter<string, byte[]> <>f__mg$cache1;
  1145. [CompilerGenerated]
  1146. private static Converter<string, byte[]> <>f__mg$cache2;
  1147. [CompilerGenerated]
  1148. private static Converter<string, byte[]> <>f__mg$cache3;
  1149. [CompilerGenerated]
  1150. private static Func<BinaryReader, string> <>f__mg$cache4;
  1151. [CompilerGenerated]
  1152. private static Func<BinaryReader, string> <>f__mg$cache5;
  1153. [CompilerGenerated]
  1154. private static Func<BinaryReader, string> <>f__mg$cache6;
  1155. [CompilerGenerated]
  1156. private static Func<BinaryReader, string> <>f__mg$cache7;
  1157. [CompilerGenerated]
  1158. private static Func<BinaryReader, string> <>f__mg$cache8;
  1159. [CompilerGenerated]
  1160. private static Func<BinaryReader, string> <>f__mg$cache9;
  1161. public class SaveDataHeader
  1162. {
  1163. public SaveDataHeader()
  1164. {
  1165. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1166. this.saveDataNumber = -1;
  1167. this.saveDataVersion = -1;
  1168. this.lastManType = 10;
  1169. this.playCount = 0;
  1170. this.strComment = string.Empty;
  1171. }
  1172. public void Serialize(BinaryWriter bw)
  1173. {
  1174. bw.Write(this.saveDataNumber);
  1175. bw.Write(this.saveDataVersion);
  1176. bw.Write(this.strRealTime);
  1177. bw.Write(this.lastManType);
  1178. bw.Write(this.playCount);
  1179. bw.Write(this.strComment);
  1180. }
  1181. public void Deserialize(BinaryReader br)
  1182. {
  1183. this.saveDataNumber = br.ReadInt32();
  1184. this.saveDataVersion = br.ReadInt32();
  1185. this.strRealTime = br.ReadString();
  1186. this.lastManType = br.ReadInt32();
  1187. if (this.saveDataVersion >= 5)
  1188. {
  1189. this.playCount = br.ReadInt32();
  1190. }
  1191. this.strComment = br.ReadString();
  1192. }
  1193. public void UpdateNowTime()
  1194. {
  1195. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1196. }
  1197. public DateTime GetDateTime()
  1198. {
  1199. return DateTime.ParseExact(this.strRealTime, "yyyyMMddHHmmss", null);
  1200. }
  1201. public string strRealTime;
  1202. public int saveDataNumber;
  1203. public int saveDataVersion;
  1204. public int lastManType;
  1205. public int playCount;
  1206. public string strComment;
  1207. }
  1208. public class SaveData
  1209. {
  1210. public SaveData()
  1211. {
  1212. this.header = new KasizukiManager.SaveDataHeader();
  1213. }
  1214. public void Serialize(Stream stream)
  1215. {
  1216. BinaryWriter binaryWriter = new BinaryWriter(stream);
  1217. this.header.Serialize(binaryWriter);
  1218. byte[] array = Util.CreatePrefix(this.buffer.Length);
  1219. binaryWriter.Write(array);
  1220. binaryWriter.Write(this.buffer);
  1221. binaryWriter.Flush();
  1222. }
  1223. public bool Deserialize(Stream stream)
  1224. {
  1225. if (stream.Position + 1L >= stream.Length)
  1226. {
  1227. return false;
  1228. }
  1229. BinaryReader binaryReader = new BinaryReader(stream);
  1230. this.header.Deserialize(binaryReader);
  1231. int prefix = Util.GetPrefix(binaryReader.BaseStream, binaryReader.BaseStream.Position, true);
  1232. this.buffer = new byte[prefix];
  1233. binaryReader.Read(this.buffer, 0, this.buffer.Length);
  1234. return true;
  1235. }
  1236. public KasizukiManager.SaveDataHeader header;
  1237. public byte[] buffer;
  1238. }
  1239. }
  1240. }