KasizukiManager.cs 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
  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. ManData.Data data = ManData.GetData(manTypeID);
  375. if (ManData.IsEnabled(manTypeID))
  376. {
  377. this.SetSystemData<int>(SystemDataType.男種類, manTypeID, false);
  378. }
  379. else
  380. {
  381. NDebug.Assert("男の種類に正しくない値が入りました", false);
  382. }
  383. }
  384. public void SetNowManType(ManDataType manType)
  385. {
  386. this.SetNowManType((int)manType);
  387. }
  388. public void SetManModel(Maid target, ManDataType type)
  389. {
  390. if (type == ManDataType.主人公)
  391. {
  392. this.UpdateManModelToPlayerData(target);
  393. }
  394. else
  395. {
  396. ManData.Data data = ManData.GetData((int)type);
  397. CharacterMgr.NpcData npcData = CharacterMgr.npcDatas[data.modelResourceName];
  398. npcData.Apply(target, false);
  399. GameMain.Instance.CharacterMgr.status.playerName = npcData.firstName;
  400. }
  401. }
  402. public void UpdateManModel(Maid target, Action callback)
  403. {
  404. target.Visible = true;
  405. target.AllProcProp();
  406. target.body0.SetChinkoVisible(false);
  407. target.CrossFade("man_porse01.anm", false, true, false, 0f, 1f);
  408. base.StartCoroutine(this.CoroutineWaitPropSeq(target, callback));
  409. }
  410. private void UpdateManModelToPlayerData(Maid target)
  411. {
  412. if (this.m_CachedOriginPlayerDataDic == null)
  413. {
  414. Debug.LogWarning("プレイヤーの情報は未だキャッシュされていない");
  415. return;
  416. }
  417. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  418. PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
  419. target.status.lastName = this.m_CachedOriginPlayerName;
  420. status.playerName = this.m_CachedOriginPlayerName;
  421. for (int i = 0; i < 99; i++)
  422. {
  423. MPN mpn = (MPN)i;
  424. if (mpn != MPN.null_mpn)
  425. {
  426. target.SetProp(mpn, this.m_CachedOriginPlayerDataDic[mpn].strFileName, this.m_CachedOriginPlayerDataDic[mpn].nFileNameRID, false, false);
  427. target.SetProp(mpn, this.m_CachedOriginPlayerDataDic[mpn].value, false);
  428. }
  429. }
  430. target.ManColor = this.m_CachedOriginPlayerColor;
  431. target.ManColorUpdate();
  432. }
  433. public void CacheOriginPlayerData()
  434. {
  435. this.m_CachedOriginPlayerDataDic = new Dictionary<MPN, MaidProp>();
  436. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  437. for (int i = 0; i < 99; i++)
  438. {
  439. MPN mpn = (MPN)i;
  440. MaidProp maidProp = new MaidProp();
  441. MaidProp prop = man.GetProp(mpn);
  442. maidProp.strFileName = prop.strFileName;
  443. maidProp.nFileNameRID = prop.nFileNameRID;
  444. maidProp.value = prop.value;
  445. this.m_CachedOriginPlayerDataDic.Add(mpn, maidProp);
  446. }
  447. this.m_CachedOriginPlayerName = GameMain.Instance.CharacterMgr.status.playerName;
  448. this.m_CachedOriginPlayerColor = man.ManColor;
  449. }
  450. public void ClearCacheOriginPlayerData()
  451. {
  452. if (this.m_CachedOriginPlayerDataDic != null)
  453. {
  454. this.m_CachedOriginPlayerDataDic.Clear();
  455. this.m_CachedOriginPlayerDataDic = null;
  456. }
  457. this.m_CachedOriginPlayerName = string.Empty;
  458. }
  459. private IEnumerator CoroutineWaitPropSeq(Maid target, Action callback)
  460. {
  461. while (target.IsBusy)
  462. {
  463. yield return null;
  464. }
  465. if (callback != null)
  466. {
  467. callback();
  468. }
  469. yield break;
  470. }
  471. private DataArray<string, string> GetMaidDataArray(Maid maid)
  472. {
  473. if (maid == null)
  474. {
  475. NDebug.Assert("メイドにnullが指定されました", false);
  476. return null;
  477. }
  478. string guid = maid.status.guid;
  479. DataArray<string, string> result = null;
  480. if (this.m_MaidDataArray.ContainsKey(guid))
  481. {
  482. result = this.m_MaidDataArray[guid];
  483. }
  484. return result;
  485. }
  486. private DataArray<string, string> CreateMaidDataArray(Maid maid)
  487. {
  488. if (maid == null)
  489. {
  490. NDebug.Assert("メイドにnullが指定されました", false);
  491. return null;
  492. }
  493. string guid = maid.status.guid;
  494. if (this.m_MaidDataArray.ContainsKey(guid))
  495. {
  496. Debug.LogFormat("メイド「{0}」のデータ配列は既に作成されています。", new object[]
  497. {
  498. maid.status.fullNameJpStyle
  499. });
  500. return this.m_MaidDataArray[guid];
  501. }
  502. DataArray<string, string> dataArray = new DataArray<string, string>();
  503. this.m_MaidDataArray.Add(guid, dataArray);
  504. return dataArray;
  505. }
  506. public void SetMaidData<T>(Maid maid, string valueName, T value, bool enableWarning = false)
  507. {
  508. DataArray<string, string> dataArray = this.GetMaidDataArray(maid);
  509. if (dataArray == null)
  510. {
  511. dataArray = this.CreateMaidDataArray(maid);
  512. }
  513. if (valueName == Enum.GetName(typeof(MaidDataType), MaidDataType.好感度\uFF3F本編))
  514. {
  515. if (enableWarning)
  516. {
  517. NDebug.Warning(string.Format("本編用メイドデータ「{0}」を書き換えようとしました", valueName));
  518. Debug.LogWarning(string.Format("本編用メイドデータ「{0}」を書き換えようとしました", valueName));
  519. }
  520. return;
  521. }
  522. this.UpdateData<T>(dataArray, valueName, value, enableWarning);
  523. }
  524. public void SetMaidData<T>(Maid maid, MaidDataType dataType, T value, bool enableWarning = false)
  525. {
  526. string name = Enum.GetName(typeof(MaidDataType), dataType);
  527. if (string.IsNullOrEmpty(name))
  528. {
  529. NDebug.Assert("データ型に不正な値が入りました", false);
  530. Debug.LogError("データ型に不正な値が入りました");
  531. }
  532. this.SetMaidData<T>(maid, name, value, enableWarning);
  533. }
  534. public T GetMaidData<T>(Maid maid, string valueName, bool enableWarning = true)
  535. {
  536. if (valueName == Enum.GetName(typeof(MaidDataType), MaidDataType.好感度\uFF3F本編))
  537. {
  538. try
  539. {
  540. T result = default(T);
  541. string text = maid.status.likability.ToString();
  542. TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
  543. if (converter != null)
  544. {
  545. result = (T)((object)converter.ConvertFromString(text));
  546. }
  547. return result;
  548. }
  549. catch (Exception ex)
  550. {
  551. NDebug.Assert(ex.ToString(), false);
  552. Debug.LogError(ex);
  553. }
  554. }
  555. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  556. if (maidDataArray == null)
  557. {
  558. Debug.LogFormat("メイド「{0}」の傅きモード用データ配列は未作成でした", new object[]
  559. {
  560. maid.status.fullNameJpStyle
  561. });
  562. return default(T);
  563. }
  564. return this.GetData<T>(maidDataArray, valueName, enableWarning);
  565. }
  566. public T GetMaidData<T>(Maid maid, MaidDataType dataType, bool enableWarning = true)
  567. {
  568. string name = Enum.GetName(typeof(MaidDataType), dataType);
  569. if (string.IsNullOrEmpty(name))
  570. {
  571. NDebug.Assert("データ型に不正な値が入りました", false);
  572. Debug.LogError("データ型に不正な値が入りました");
  573. }
  574. return this.GetMaidData<T>(maid, name, enableWarning);
  575. }
  576. public int GetMaidLikability(Maid maid, ManDataType dataType)
  577. {
  578. if (dataType == ManDataType.主人公)
  579. {
  580. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, false);
  581. }
  582. if (dataType != ManDataType.傅き男1)
  583. {
  584. NDebug.Assert("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました", false);
  585. Debug.LogErrorFormat("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました\n男種類.{0}", new object[]
  586. {
  587. dataType.ToString()
  588. });
  589. return -1;
  590. }
  591. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  592. }
  593. public bool TryGetMaidData<T>(Maid maid, string valueName, out T value)
  594. {
  595. value = default(T);
  596. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  597. return maidDataArray != null && this.TryGetData<T>(maidDataArray, valueName, out value);
  598. }
  599. public bool TryGetMaidData<T>(Maid maid, MaidDataType dataType, out T value)
  600. {
  601. string name = Enum.GetName(typeof(MaidDataType), dataType);
  602. if (string.IsNullOrEmpty(name))
  603. {
  604. NDebug.Assert("データ型に不正な値が入りました", false);
  605. Debug.LogError("データ型に不正な値が入りました");
  606. }
  607. return this.TryGetMaidData<T>(maid, name, out value);
  608. }
  609. public bool RemoveMaidData(Maid maid, string valueName, bool enableWarning = false)
  610. {
  611. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  612. if (maidDataArray == null)
  613. {
  614. Debug.LogFormat("メイド「{0}」に関する傅きモードのデータ配列は未作成でした\nデータ名:{1}", new object[]
  615. {
  616. maid.status.fullNameJpStyle,
  617. valueName
  618. });
  619. return false;
  620. }
  621. return this.RemoveData(maidDataArray, valueName, enableWarning);
  622. }
  623. public bool RemoveMaidData(Maid maid, MaidDataType dataType, bool enableWarning = false)
  624. {
  625. string name = Enum.GetName(typeof(MaidDataType), dataType);
  626. if (string.IsNullOrEmpty(name))
  627. {
  628. NDebug.Assert("データ型に不正な値が入りました", false);
  629. Debug.LogError("データ型に不正な値が入りました");
  630. }
  631. return this.RemoveMaidData(maid, name, enableWarning);
  632. }
  633. public static List<Maid> GetEnableMaidList()
  634. {
  635. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  636. List<Maid> list = new List<Maid>();
  637. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  638. {
  639. Maid stockMaid = characterMgr.GetStockMaid(i);
  640. if (stockMaid.status.heroineType != HeroineType.Transfer)
  641. {
  642. if (stockMaid.status.heroineType != HeroineType.Sub)
  643. {
  644. list.Add(stockMaid);
  645. }
  646. }
  647. }
  648. return list;
  649. }
  650. public void UpdateLatestSaveDataNumber()
  651. {
  652. int count = this.m_SaveDataArray.Count;
  653. List<KasizukiManager.SaveData> list = new List<KasizukiManager.SaveData>(this.m_SaveDataArray.Values);
  654. int latestSaveDataNumber = -1;
  655. long num = -1L;
  656. for (int i = 0; i < count; i++)
  657. {
  658. KasizukiManager.SaveData saveData = list[i];
  659. if (saveData != null && saveData.header != null)
  660. {
  661. long num2 = 0L;
  662. if (long.TryParse(saveData.header.strRealTime, out num2))
  663. {
  664. if (num < num2)
  665. {
  666. num = num2;
  667. latestSaveDataNumber = saveData.header.saveDataNumber;
  668. }
  669. }
  670. }
  671. }
  672. this.m_LatestSaveDataNumber = latestSaveDataNumber;
  673. }
  674. public void SerializeLocal(int saveDataIndex)
  675. {
  676. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  677. KasizukiManager.SaveData saveData;
  678. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  679. {
  680. saveData = this.m_SaveDataArray[saveDataIndex];
  681. }
  682. else
  683. {
  684. saveData = new KasizukiManager.SaveData();
  685. this.m_SaveDataArray.Add(saveDataIndex, saveData);
  686. }
  687. saveData.header.saveDataNumber = saveDataIndex;
  688. saveData.header.saveDataVersion = 5;
  689. saveData.header.UpdateNowTime();
  690. saveData.header.lastManType = this.GetNowManType();
  691. saveData.header.playCount = this.GetSystemData<int>(SystemDataType.プレイ回数);
  692. this.SerializeSaveData(saveData);
  693. this.UpdateLatestSaveDataNumber();
  694. }
  695. public void DeserializeLocal(int saveDataIndex)
  696. {
  697. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  698. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  699. {
  700. Debug.LogWarning(string.Format("傅きモードのセーブデータ[{0}]番は存在しません", saveDataIndex));
  701. return;
  702. }
  703. KasizukiManager.SaveData saveData = this.m_SaveDataArray[saveDataIndex];
  704. this.ResetData();
  705. this.DeserializeSaveData(saveData);
  706. }
  707. public void DeleteSaveDataLocal(int saveDataIndex)
  708. {
  709. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  710. {
  711. return;
  712. }
  713. this.m_SaveDataArray.Remove(saveDataIndex);
  714. this.UpdateLatestSaveDataNumber();
  715. }
  716. public KasizukiManager.SaveDataHeader GetSaveDataHeader(int saveDataIndex)
  717. {
  718. KasizukiManager.SaveDataHeader result;
  719. this.TryGetSaveDataHeader(saveDataIndex, out result);
  720. return result;
  721. }
  722. public bool TryGetSaveDataHeader(int saveDataIndex, out KasizukiManager.SaveDataHeader header)
  723. {
  724. header = null;
  725. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  726. {
  727. header = this.m_SaveDataArray[saveDataIndex].header;
  728. return true;
  729. }
  730. return false;
  731. }
  732. public bool IsExistSaveData(int saveDataIndex)
  733. {
  734. return this.m_SaveDataArray.ContainsKey(saveDataIndex);
  735. }
  736. public void Serialize(BinaryWriter bw)
  737. {
  738. bw.Write("COM3D2_KASIZUKI");
  739. bw.Write(1150);
  740. this.SerializeOriginHeader(bw);
  741. foreach (KeyValuePair<int, KasizukiManager.SaveData> keyValuePair in this.m_SaveDataArray)
  742. {
  743. int key = keyValuePair.Key;
  744. KasizukiManager.SaveData value = keyValuePair.Value;
  745. value.Serialize(bw.BaseStream);
  746. }
  747. this.UpdateLatestSaveDataNumber();
  748. KasizukiManager.FixMaidThumbnails();
  749. }
  750. public void Deserialize(int originSaveDataNumber, BinaryReader br)
  751. {
  752. this.NowOriginSaveDataNumber = originSaveDataNumber;
  753. KasizukiManager.DeleteTmpMaidThumnails();
  754. long position = br.BaseStream.Position;
  755. if (br.BaseStream.Length <= position + 1L)
  756. {
  757. Debug.LogWarning(string.Format("これ以上バッファが無いので、処理を終了します\n現在位置:{0}\n長さ:{1}", position, br.BaseStream.Length));
  758. return;
  759. }
  760. string text = br.ReadString();
  761. if (text != "COM3D2_KASIZUKI")
  762. {
  763. NDebug.Warning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  764. Debug.LogWarning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  765. br.BaseStream.Seek(position, SeekOrigin.Begin);
  766. return;
  767. }
  768. int num = br.ReadInt32();
  769. int num2;
  770. this.DeserializeOriginHeader(br, out num2);
  771. this.m_SaveDataArray.Clear();
  772. for (int i = 0; i < num2; i++)
  773. {
  774. KasizukiManager.SaveData saveData = new KasizukiManager.SaveData();
  775. if (!saveData.Deserialize(br.BaseStream))
  776. {
  777. break;
  778. }
  779. if (!this.m_SaveDataArray.ContainsKey(saveData.header.saveDataNumber))
  780. {
  781. this.m_SaveDataArray.Add(saveData.header.saveDataNumber, saveData);
  782. }
  783. else
  784. {
  785. this.m_SaveDataArray[saveData.header.saveDataNumber] = saveData;
  786. }
  787. }
  788. this.UpdateLatestSaveDataNumber();
  789. Debug.Log("プレイヤーの元情報をキャッシュします");
  790. this.CacheOriginPlayerData();
  791. }
  792. private void SerializeOriginHeader(BinaryWriter bw)
  793. {
  794. int count = this.m_SaveDataArray.Count;
  795. byte[] buffer = Util.CreatePrefix(count);
  796. bw.Write(buffer);
  797. }
  798. private void DeserializeOriginHeader(BinaryReader br, out int saveDataCount)
  799. {
  800. int prefix = Util.GetPrefix(br.BaseStream, br.BaseStream.Position, true);
  801. saveDataCount = prefix;
  802. }
  803. private void SerializeSaveData(KasizukiManager.SaveData saveData)
  804. {
  805. using (MemoryStream memoryStream = new MemoryStream())
  806. {
  807. using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
  808. {
  809. DataArray<string, string> systemData = this.m_SystemData;
  810. BinaryWriter brWrite = binaryWriter;
  811. if (KasizukiManager.<>f__mg$cache0 == null)
  812. {
  813. KasizukiManager.<>f__mg$cache0 = new Converter<string, byte[]>(Util.GetBytes);
  814. }
  815. Converter<string, byte[]> converter_key = KasizukiManager.<>f__mg$cache0;
  816. if (KasizukiManager.<>f__mg$cache1 == null)
  817. {
  818. KasizukiManager.<>f__mg$cache1 = new Converter<string, byte[]>(Util.GetBytes);
  819. }
  820. systemData.Serialize(brWrite, converter_key, KasizukiManager.<>f__mg$cache1);
  821. int count = this.m_MaidDataArray.Count;
  822. binaryWriter.Write(count);
  823. foreach (KeyValuePair<string, DataArray<string, string>> keyValuePair in this.m_MaidDataArray)
  824. {
  825. binaryWriter.Write(keyValuePair.Key);
  826. DataArray<string, string> value = keyValuePair.Value;
  827. BinaryWriter brWrite2 = binaryWriter;
  828. if (KasizukiManager.<>f__mg$cache2 == null)
  829. {
  830. KasizukiManager.<>f__mg$cache2 = new Converter<string, byte[]>(Util.GetBytes);
  831. }
  832. Converter<string, byte[]> converter_key2 = KasizukiManager.<>f__mg$cache2;
  833. if (KasizukiManager.<>f__mg$cache3 == null)
  834. {
  835. KasizukiManager.<>f__mg$cache3 = new Converter<string, byte[]>(Util.GetBytes);
  836. }
  837. value.Serialize(brWrite2, converter_key2, KasizukiManager.<>f__mg$cache3);
  838. }
  839. }
  840. saveData.buffer = memoryStream.ToArray();
  841. }
  842. }
  843. private void DeserializeSaveData(KasizukiManager.SaveData saveData)
  844. {
  845. using (MemoryStream memoryStream = new MemoryStream(saveData.buffer))
  846. {
  847. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  848. {
  849. this.SetNowManType(saveData.header.lastManType);
  850. DataArray<string, string> systemData = this.m_SystemData;
  851. BinaryReader brRead = binaryReader;
  852. if (KasizukiManager.<>f__mg$cache4 == null)
  853. {
  854. KasizukiManager.<>f__mg$cache4 = new Func<BinaryReader, string>(Util.ToString);
  855. }
  856. Func<BinaryReader, string> func_read_key = KasizukiManager.<>f__mg$cache4;
  857. if (KasizukiManager.<>f__mg$cache5 == null)
  858. {
  859. KasizukiManager.<>f__mg$cache5 = new Func<BinaryReader, string>(Util.ToString);
  860. }
  861. systemData.Deserialize(brRead, func_read_key, KasizukiManager.<>f__mg$cache5);
  862. int num = binaryReader.ReadInt32();
  863. for (int i = 0; i < num; i++)
  864. {
  865. string text = binaryReader.ReadString();
  866. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(text);
  867. if (stockMaid == null)
  868. {
  869. Debug.LogFormat("GUID「{0}」のメイドは存在しなかったので、このメイドの情報は読み飛ばします", new object[]
  870. {
  871. text
  872. });
  873. DataArray<string, string> dataArray = new DataArray<string, string>();
  874. DataArray<string, string> dataArray2 = dataArray;
  875. BinaryReader brRead2 = binaryReader;
  876. if (KasizukiManager.<>f__mg$cache6 == null)
  877. {
  878. KasizukiManager.<>f__mg$cache6 = new Func<BinaryReader, string>(Util.ToString);
  879. }
  880. Func<BinaryReader, string> func_read_key2 = KasizukiManager.<>f__mg$cache6;
  881. if (KasizukiManager.<>f__mg$cache7 == null)
  882. {
  883. KasizukiManager.<>f__mg$cache7 = new Func<BinaryReader, string>(Util.ToString);
  884. }
  885. dataArray2.Deserialize(brRead2, func_read_key2, KasizukiManager.<>f__mg$cache7);
  886. }
  887. else
  888. {
  889. DataArray<string, string> dataArray3 = this.CreateMaidDataArray(stockMaid);
  890. DataArray<string, string> dataArray4 = dataArray3;
  891. BinaryReader brRead3 = binaryReader;
  892. if (KasizukiManager.<>f__mg$cache8 == null)
  893. {
  894. KasizukiManager.<>f__mg$cache8 = new Func<BinaryReader, string>(Util.ToString);
  895. }
  896. Func<BinaryReader, string> func_read_key3 = KasizukiManager.<>f__mg$cache8;
  897. if (KasizukiManager.<>f__mg$cache9 == null)
  898. {
  899. KasizukiManager.<>f__mg$cache9 = new Func<BinaryReader, string>(Util.ToString);
  900. }
  901. dataArray4.Deserialize(brRead3, func_read_key3, KasizukiManager.<>f__mg$cache9);
  902. }
  903. }
  904. }
  905. }
  906. }
  907. public static Texture2D GetMaidThumbnail(Maid maid)
  908. {
  909. Texture2D result = null;
  910. string text = Path.GetFullPath(".\\") + "Thumb\\";
  911. if (!Directory.Exists(text))
  912. {
  913. Directory.CreateDirectory(text);
  914. }
  915. string guid = maid.status.guid;
  916. string text2 = text + "_tmp_kasizuki_" + guid + ".png";
  917. if (File.Exists(text2))
  918. {
  919. result = UTY.LoadTexture(text2);
  920. }
  921. else
  922. {
  923. text2 = text + "kasizuki_" + guid + ".png";
  924. if (File.Exists(text2))
  925. {
  926. result = UTY.LoadTexture(text2);
  927. }
  928. }
  929. return result;
  930. }
  931. public static bool IsExistMaidThumbnail(Maid maid)
  932. {
  933. string text = Path.GetFullPath(".\\") + "Thumb\\";
  934. if (!Directory.Exists(text))
  935. {
  936. return false;
  937. }
  938. string guid = maid.status.guid;
  939. string path = text + "_tmp_kasizuki_" + guid + ".png";
  940. if (File.Exists(path))
  941. {
  942. return true;
  943. }
  944. path = text + "kasizuki_" + guid + ".png";
  945. return File.Exists(path);
  946. }
  947. private static void FixMaidThumbnails()
  948. {
  949. string text = Path.GetFullPath(".\\") + "Thumb\\";
  950. if (!Directory.Exists(text))
  951. {
  952. return;
  953. }
  954. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  955. for (int i = 0; i < files.Length; i++)
  956. {
  957. string text2 = string.Empty;
  958. try
  959. {
  960. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  961. }
  962. catch
  963. {
  964. }
  965. if (string.IsNullOrEmpty(text2))
  966. {
  967. files[i] = string.Empty;
  968. }
  969. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  970. {
  971. files[i] = string.Empty;
  972. }
  973. }
  974. for (int j = 0; j < files.Length; j++)
  975. {
  976. if (!string.IsNullOrEmpty(files[j]))
  977. {
  978. try
  979. {
  980. int length = "_tmp_kasizuki_".Length;
  981. string text3 = files[j].Substring(text.Length, files[j].Length - text.Length);
  982. string str = "kasizuki_" + text3.Substring(length, text3.Length - length - ".png".Length) + ".png";
  983. if (File.Exists(text + str))
  984. {
  985. File.Delete(text + str);
  986. }
  987. File.Move(files[j], text + str);
  988. }
  989. catch
  990. {
  991. }
  992. }
  993. }
  994. }
  995. private static void DeleteTmpMaidThumnails()
  996. {
  997. string text = Path.GetFullPath(".\\") + "Thumb\\";
  998. if (!Directory.Exists(text))
  999. {
  1000. return;
  1001. }
  1002. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  1003. for (int i = 0; i < files.Length; i++)
  1004. {
  1005. string text2 = string.Empty;
  1006. try
  1007. {
  1008. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  1009. }
  1010. catch
  1011. {
  1012. }
  1013. if (string.IsNullOrEmpty(text2))
  1014. {
  1015. files[i] = string.Empty;
  1016. }
  1017. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  1018. {
  1019. files[i] = string.Empty;
  1020. }
  1021. }
  1022. for (int j = 0; j < files.Length; j++)
  1023. {
  1024. if (!string.IsNullOrEmpty(files[j]))
  1025. {
  1026. try
  1027. {
  1028. File.Delete(files[j]);
  1029. }
  1030. catch
  1031. {
  1032. }
  1033. }
  1034. }
  1035. }
  1036. public void TJSFuncGetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1037. {
  1038. NDebug.Assert(result != null, "error GetKasizukiSystemFlag");
  1039. NDebug.Assert(1 == tjs_param.Length, "GetKasizukiSystemFlag args count error.");
  1040. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1041. result.SetString(kasizukiMgr.GetSystemData<string>(tjs_param[0].AsString()));
  1042. }
  1043. public void TJSFuncSetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1044. {
  1045. NDebug.Assert(2 == tjs_param.Length, "SetKasizukiSystemFlag args count error.");
  1046. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1047. kasizukiMgr.SetSystemData<string>(tjs_param[0].AsString(), tjs_param[1].AsString(), false);
  1048. }
  1049. public void TJSFuncAddKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1050. {
  1051. NDebug.Assert(2 == tjs_param.Length, "AddKasizukiSystemFlag args count error.");
  1052. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1053. string valueName = tjs_param[0].AsString();
  1054. int num = kasizukiMgr.GetSystemData<int>(valueName);
  1055. num += tjs_param[1].AsInteger();
  1056. kasizukiMgr.SetSystemData<int>(valueName, num, false);
  1057. }
  1058. public void TJSFuncSetKasizukiPassFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1059. {
  1060. NDebug.Assert(1 == tjs_param.Length, "SetKasizukiPassFlag args count error.");
  1061. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1062. int id = tjs_param[0].AsInteger();
  1063. PlayData.Data data = PlayData.GetData(id);
  1064. data.IsPassed = true;
  1065. }
  1066. public void TJSFuncSetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1067. {
  1068. NDebug.Assert(3 == tjs_param.Length, "SetKasizukiMaidFlag args count error.");
  1069. int num = tjs_param[0].AsInteger();
  1070. string valueName = tjs_param[1].AsString();
  1071. int value = tjs_param[2].AsInteger();
  1072. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1073. NDebug.Assert(maid != null, "[SetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1074. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1075. kasizukiMgr.SetMaidData<int>(maid, valueName, value, false);
  1076. }
  1077. public void TJSFuncGetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1078. {
  1079. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1080. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1081. int num = tjs_param[0].AsInteger();
  1082. string valueName = tjs_param[1].AsString();
  1083. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1084. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1085. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1086. int maidData = kasizukiMgr.GetMaidData<int>(maid, valueName, false);
  1087. result.SetInteger(maidData);
  1088. }
  1089. public void TJSFuncIsKasizukiCorrectSenarioFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1090. {
  1091. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1092. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1093. int num = tjs_param[0].AsInteger();
  1094. int id = tjs_param[1].AsInteger();
  1095. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1096. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1097. ManDataType nowManType = (ManDataType)this.GetNowManType();
  1098. bool @bool = PlayData.GetData(id).IsCorrectMaid(maid, nowManType);
  1099. result.SetBool(@bool);
  1100. }
  1101. public static string CreateMaidTmpThumbName(Maid maid)
  1102. {
  1103. NDebug.AssertNull(maid != null);
  1104. return "_tmp_kasizuki_" + maid.status.guid + ".png";
  1105. }
  1106. public const int MAN_ACTIVATE_SLOT = 0;
  1107. private const string STR_SERIALIZE_HEADER = "COM3D2_KASIZUKI";
  1108. private const int SERIALIZE_VERSION = 5;
  1109. private int m_NowOriginSaveDataNumber;
  1110. private int m_NowKasizukiSaveDataIndex = 1;
  1111. private DataArray<int, bool> m_NowHaveItemDic;
  1112. private DataArray<string, string> m_SystemData;
  1113. private Dictionary<string, DataArray<string, string>> m_MaidDataArray;
  1114. private Dictionary<int, KasizukiManager.SaveData> m_SaveDataArray;
  1115. private int m_LatestSaveDataNumber = -1;
  1116. private Dictionary<MPN, MaidProp> m_CachedOriginPlayerDataDic;
  1117. private string m_CachedOriginPlayerName;
  1118. private Color m_CachedOriginPlayerColor;
  1119. public const string STR_TMP_THUMB_NAME = "_tmp_kasizuki_";
  1120. public const string STR_THUMB_NAME = "kasizuki_";
  1121. [CompilerGenerated]
  1122. private static Converter<string, byte[]> <>f__mg$cache0;
  1123. [CompilerGenerated]
  1124. private static Converter<string, byte[]> <>f__mg$cache1;
  1125. [CompilerGenerated]
  1126. private static Converter<string, byte[]> <>f__mg$cache2;
  1127. [CompilerGenerated]
  1128. private static Converter<string, byte[]> <>f__mg$cache3;
  1129. [CompilerGenerated]
  1130. private static Func<BinaryReader, string> <>f__mg$cache4;
  1131. [CompilerGenerated]
  1132. private static Func<BinaryReader, string> <>f__mg$cache5;
  1133. [CompilerGenerated]
  1134. private static Func<BinaryReader, string> <>f__mg$cache6;
  1135. [CompilerGenerated]
  1136. private static Func<BinaryReader, string> <>f__mg$cache7;
  1137. [CompilerGenerated]
  1138. private static Func<BinaryReader, string> <>f__mg$cache8;
  1139. [CompilerGenerated]
  1140. private static Func<BinaryReader, string> <>f__mg$cache9;
  1141. public class SaveDataHeader
  1142. {
  1143. public SaveDataHeader()
  1144. {
  1145. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1146. this.saveDataNumber = -1;
  1147. this.saveDataVersion = -1;
  1148. this.lastManType = 10;
  1149. this.playCount = 0;
  1150. this.strComment = string.Empty;
  1151. }
  1152. public void Serialize(BinaryWriter bw)
  1153. {
  1154. bw.Write(this.saveDataNumber);
  1155. bw.Write(this.saveDataVersion);
  1156. bw.Write(this.strRealTime);
  1157. bw.Write(this.lastManType);
  1158. bw.Write(this.playCount);
  1159. bw.Write(this.strComment);
  1160. }
  1161. public void Deserialize(BinaryReader br)
  1162. {
  1163. this.saveDataNumber = br.ReadInt32();
  1164. this.saveDataVersion = br.ReadInt32();
  1165. this.strRealTime = br.ReadString();
  1166. this.lastManType = br.ReadInt32();
  1167. if (this.saveDataVersion >= 5)
  1168. {
  1169. this.playCount = br.ReadInt32();
  1170. }
  1171. this.strComment = br.ReadString();
  1172. }
  1173. public void UpdateNowTime()
  1174. {
  1175. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1176. }
  1177. public DateTime GetDateTime()
  1178. {
  1179. return DateTime.ParseExact(this.strRealTime, "yyyyMMddHHmmss", null);
  1180. }
  1181. public string strRealTime;
  1182. public int saveDataNumber;
  1183. public int saveDataVersion;
  1184. public int lastManType;
  1185. public int playCount;
  1186. public string strComment;
  1187. }
  1188. public class SaveData
  1189. {
  1190. public SaveData()
  1191. {
  1192. this.header = new KasizukiManager.SaveDataHeader();
  1193. }
  1194. public void Serialize(Stream stream)
  1195. {
  1196. BinaryWriter binaryWriter = new BinaryWriter(stream);
  1197. this.header.Serialize(binaryWriter);
  1198. byte[] array = Util.CreatePrefix(this.buffer.Length);
  1199. binaryWriter.Write(array);
  1200. binaryWriter.Write(this.buffer);
  1201. binaryWriter.Flush();
  1202. }
  1203. public bool Deserialize(Stream stream)
  1204. {
  1205. if (stream.Position + 1L >= stream.Length)
  1206. {
  1207. return false;
  1208. }
  1209. BinaryReader binaryReader = new BinaryReader(stream);
  1210. this.header.Deserialize(binaryReader);
  1211. int prefix = Util.GetPrefix(binaryReader.BaseStream, binaryReader.BaseStream.Position, true);
  1212. this.buffer = new byte[prefix];
  1213. binaryReader.Read(this.buffer, 0, this.buffer.Length);
  1214. return true;
  1215. }
  1216. public KasizukiManager.SaveDataHeader header;
  1217. public byte[] buffer;
  1218. }
  1219. }
  1220. }