KasizukiManager.cs 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  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. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  585. }
  586. if (dataType == ManDataType.傅き男2)
  587. {
  588. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男2, false);
  589. }
  590. if (dataType == ManDataType.傅き男3)
  591. {
  592. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男3, false);
  593. }
  594. if (dataType == ManDataType.傅き男4)
  595. {
  596. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男4, false);
  597. }
  598. if (dataType != ManDataType.傅き男5)
  599. {
  600. NDebug.Assert("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました", false);
  601. Debug.LogErrorFormat("[KasizukiManager.GetMaidLikability] 男種類に不正な値が入りました\n男種類.{0}", new object[]
  602. {
  603. dataType.ToString()
  604. });
  605. return -1;
  606. }
  607. return this.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男5, false);
  608. }
  609. public bool TryGetMaidData<T>(Maid maid, string valueName, out T value)
  610. {
  611. value = default(T);
  612. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  613. return maidDataArray != null && this.TryGetData<T>(maidDataArray, valueName, out value);
  614. }
  615. public bool TryGetMaidData<T>(Maid maid, MaidDataType dataType, out T value)
  616. {
  617. string name = Enum.GetName(typeof(MaidDataType), dataType);
  618. if (string.IsNullOrEmpty(name))
  619. {
  620. NDebug.Assert("データ型に不正な値が入りました", false);
  621. Debug.LogError("データ型に不正な値が入りました");
  622. }
  623. return this.TryGetMaidData<T>(maid, name, out value);
  624. }
  625. public bool RemoveMaidData(Maid maid, string valueName, bool enableWarning = false)
  626. {
  627. DataArray<string, string> maidDataArray = this.GetMaidDataArray(maid);
  628. if (maidDataArray == null)
  629. {
  630. Debug.LogFormat("メイド「{0}」に関する傅きモードのデータ配列は未作成でした\nデータ名:{1}", new object[]
  631. {
  632. maid.status.fullNameJpStyle,
  633. valueName
  634. });
  635. return false;
  636. }
  637. return this.RemoveData(maidDataArray, valueName, enableWarning);
  638. }
  639. public bool RemoveMaidData(Maid maid, MaidDataType dataType, bool enableWarning = false)
  640. {
  641. string name = Enum.GetName(typeof(MaidDataType), dataType);
  642. if (string.IsNullOrEmpty(name))
  643. {
  644. NDebug.Assert("データ型に不正な値が入りました", false);
  645. Debug.LogError("データ型に不正な値が入りました");
  646. }
  647. return this.RemoveMaidData(maid, name, enableWarning);
  648. }
  649. public static List<Maid> GetEnableMaidList()
  650. {
  651. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  652. List<Maid> list = new List<Maid>();
  653. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  654. {
  655. Maid stockMaid = characterMgr.GetStockMaid(i);
  656. if (stockMaid.status.heroineType != HeroineType.Transfer)
  657. {
  658. if (stockMaid.status.heroineType != HeroineType.Sub)
  659. {
  660. list.Add(stockMaid);
  661. }
  662. }
  663. }
  664. return list;
  665. }
  666. public void UpdateLatestSaveDataNumber()
  667. {
  668. int count = this.m_SaveDataArray.Count;
  669. List<KasizukiManager.SaveData> list = new List<KasizukiManager.SaveData>(this.m_SaveDataArray.Values);
  670. int latestSaveDataNumber = -1;
  671. long num = -1L;
  672. for (int i = 0; i < count; i++)
  673. {
  674. KasizukiManager.SaveData saveData = list[i];
  675. if (saveData != null && saveData.header != null)
  676. {
  677. long num2 = 0L;
  678. if (long.TryParse(saveData.header.strRealTime, out num2))
  679. {
  680. if (num < num2)
  681. {
  682. num = num2;
  683. latestSaveDataNumber = saveData.header.saveDataNumber;
  684. }
  685. }
  686. }
  687. }
  688. this.m_LatestSaveDataNumber = latestSaveDataNumber;
  689. }
  690. public void SerializeLocal(int saveDataIndex)
  691. {
  692. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  693. KasizukiManager.SaveData saveData;
  694. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  695. {
  696. saveData = this.m_SaveDataArray[saveDataIndex];
  697. }
  698. else
  699. {
  700. saveData = new KasizukiManager.SaveData();
  701. this.m_SaveDataArray.Add(saveDataIndex, saveData);
  702. }
  703. saveData.header.saveDataNumber = saveDataIndex;
  704. saveData.header.saveDataVersion = 5;
  705. saveData.header.UpdateNowTime();
  706. saveData.header.lastManType = this.GetNowManType();
  707. saveData.header.playCount = this.GetSystemData<int>(SystemDataType.プレイ回数);
  708. this.SerializeSaveData(saveData);
  709. this.UpdateLatestSaveDataNumber();
  710. }
  711. public void DeserializeLocal(int saveDataIndex)
  712. {
  713. this.m_NowKasizukiSaveDataIndex = saveDataIndex;
  714. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  715. {
  716. Debug.LogWarning(string.Format("傅きモードのセーブデータ[{0}]番は存在しません", saveDataIndex));
  717. return;
  718. }
  719. KasizukiManager.SaveData saveData = this.m_SaveDataArray[saveDataIndex];
  720. this.ResetData();
  721. this.DeserializeSaveData(saveData);
  722. }
  723. public void DeleteSaveDataLocal(int saveDataIndex)
  724. {
  725. if (!this.m_SaveDataArray.ContainsKey(saveDataIndex))
  726. {
  727. return;
  728. }
  729. this.m_SaveDataArray.Remove(saveDataIndex);
  730. this.UpdateLatestSaveDataNumber();
  731. }
  732. public KasizukiManager.SaveDataHeader GetSaveDataHeader(int saveDataIndex)
  733. {
  734. KasizukiManager.SaveDataHeader result;
  735. this.TryGetSaveDataHeader(saveDataIndex, out result);
  736. return result;
  737. }
  738. public bool TryGetSaveDataHeader(int saveDataIndex, out KasizukiManager.SaveDataHeader header)
  739. {
  740. header = null;
  741. if (this.m_SaveDataArray.ContainsKey(saveDataIndex))
  742. {
  743. header = this.m_SaveDataArray[saveDataIndex].header;
  744. return true;
  745. }
  746. return false;
  747. }
  748. public bool IsExistSaveData(int saveDataIndex)
  749. {
  750. return this.m_SaveDataArray.ContainsKey(saveDataIndex);
  751. }
  752. public void Serialize(BinaryWriter bw)
  753. {
  754. bw.Write("COM3D2_KASIZUKI");
  755. bw.Write(1170);
  756. this.SerializeOriginHeader(bw);
  757. foreach (KeyValuePair<int, KasizukiManager.SaveData> keyValuePair in this.m_SaveDataArray)
  758. {
  759. int key = keyValuePair.Key;
  760. KasizukiManager.SaveData value = keyValuePair.Value;
  761. value.Serialize(bw.BaseStream);
  762. }
  763. this.UpdateLatestSaveDataNumber();
  764. KasizukiManager.FixMaidThumbnails();
  765. }
  766. public void Deserialize(int originSaveDataNumber, BinaryReader br)
  767. {
  768. this.NowOriginSaveDataNumber = originSaveDataNumber;
  769. KasizukiManager.DeleteTmpMaidThumnails();
  770. long position = br.BaseStream.Position;
  771. if (br.BaseStream.Length <= position + 1L)
  772. {
  773. Debug.LogWarning(string.Format("これ以上バッファが無いので、処理を終了します\n現在位置:{0}\n長さ:{1}", position, br.BaseStream.Length));
  774. return;
  775. }
  776. string text = br.ReadString();
  777. if (text != "COM3D2_KASIZUKI")
  778. {
  779. NDebug.Warning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  780. Debug.LogWarning(string.Format("傅きモードのヘッダー取得に失敗しました\n取得した文字:{0}\n読み込み位置を戻します", text));
  781. br.BaseStream.Seek(position, SeekOrigin.Begin);
  782. return;
  783. }
  784. int num = br.ReadInt32();
  785. int num2;
  786. this.DeserializeOriginHeader(br, out num2);
  787. this.m_SaveDataArray.Clear();
  788. for (int i = 0; i < num2; i++)
  789. {
  790. KasizukiManager.SaveData saveData = new KasizukiManager.SaveData();
  791. if (!saveData.Deserialize(br.BaseStream))
  792. {
  793. break;
  794. }
  795. if (!this.m_SaveDataArray.ContainsKey(saveData.header.saveDataNumber))
  796. {
  797. this.m_SaveDataArray.Add(saveData.header.saveDataNumber, saveData);
  798. }
  799. else
  800. {
  801. this.m_SaveDataArray[saveData.header.saveDataNumber] = saveData;
  802. }
  803. }
  804. this.UpdateLatestSaveDataNumber();
  805. Debug.Log("プレイヤーの元情報をキャッシュします");
  806. this.CacheOriginPlayerData();
  807. }
  808. private void SerializeOriginHeader(BinaryWriter bw)
  809. {
  810. int count = this.m_SaveDataArray.Count;
  811. byte[] buffer = Util.CreatePrefix(count);
  812. bw.Write(buffer);
  813. }
  814. private void DeserializeOriginHeader(BinaryReader br, out int saveDataCount)
  815. {
  816. int prefix = Util.GetPrefix(br.BaseStream, br.BaseStream.Position, true);
  817. saveDataCount = prefix;
  818. }
  819. private void SerializeSaveData(KasizukiManager.SaveData saveData)
  820. {
  821. using (MemoryStream memoryStream = new MemoryStream())
  822. {
  823. using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
  824. {
  825. DataArray<string, string> systemData = this.m_SystemData;
  826. BinaryWriter brWrite = binaryWriter;
  827. if (KasizukiManager.<>f__mg$cache0 == null)
  828. {
  829. KasizukiManager.<>f__mg$cache0 = new Converter<string, byte[]>(Util.GetBytes);
  830. }
  831. Converter<string, byte[]> converter_key = KasizukiManager.<>f__mg$cache0;
  832. if (KasizukiManager.<>f__mg$cache1 == null)
  833. {
  834. KasizukiManager.<>f__mg$cache1 = new Converter<string, byte[]>(Util.GetBytes);
  835. }
  836. systemData.Serialize(brWrite, converter_key, KasizukiManager.<>f__mg$cache1);
  837. int count = this.m_MaidDataArray.Count;
  838. binaryWriter.Write(count);
  839. foreach (KeyValuePair<string, DataArray<string, string>> keyValuePair in this.m_MaidDataArray)
  840. {
  841. binaryWriter.Write(keyValuePair.Key);
  842. DataArray<string, string> value = keyValuePair.Value;
  843. BinaryWriter brWrite2 = binaryWriter;
  844. if (KasizukiManager.<>f__mg$cache2 == null)
  845. {
  846. KasizukiManager.<>f__mg$cache2 = new Converter<string, byte[]>(Util.GetBytes);
  847. }
  848. Converter<string, byte[]> converter_key2 = KasizukiManager.<>f__mg$cache2;
  849. if (KasizukiManager.<>f__mg$cache3 == null)
  850. {
  851. KasizukiManager.<>f__mg$cache3 = new Converter<string, byte[]>(Util.GetBytes);
  852. }
  853. value.Serialize(brWrite2, converter_key2, KasizukiManager.<>f__mg$cache3);
  854. }
  855. }
  856. saveData.buffer = memoryStream.ToArray();
  857. }
  858. }
  859. private void DeserializeSaveData(KasizukiManager.SaveData saveData)
  860. {
  861. using (MemoryStream memoryStream = new MemoryStream(saveData.buffer))
  862. {
  863. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  864. {
  865. this.SetNowManType(saveData.header.lastManType);
  866. DataArray<string, string> systemData = this.m_SystemData;
  867. BinaryReader brRead = binaryReader;
  868. if (KasizukiManager.<>f__mg$cache4 == null)
  869. {
  870. KasizukiManager.<>f__mg$cache4 = new Func<BinaryReader, string>(Util.ToString);
  871. }
  872. Func<BinaryReader, string> func_read_key = KasizukiManager.<>f__mg$cache4;
  873. if (KasizukiManager.<>f__mg$cache5 == null)
  874. {
  875. KasizukiManager.<>f__mg$cache5 = new Func<BinaryReader, string>(Util.ToString);
  876. }
  877. systemData.Deserialize(brRead, func_read_key, KasizukiManager.<>f__mg$cache5);
  878. int num = binaryReader.ReadInt32();
  879. for (int i = 0; i < num; i++)
  880. {
  881. string text = binaryReader.ReadString();
  882. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(text);
  883. if (stockMaid == null)
  884. {
  885. Debug.LogFormat("GUID「{0}」のメイドは存在しなかったので、このメイドの情報は読み飛ばします", new object[]
  886. {
  887. text
  888. });
  889. DataArray<string, string> dataArray = new DataArray<string, string>();
  890. DataArray<string, string> dataArray2 = dataArray;
  891. BinaryReader brRead2 = binaryReader;
  892. if (KasizukiManager.<>f__mg$cache6 == null)
  893. {
  894. KasizukiManager.<>f__mg$cache6 = new Func<BinaryReader, string>(Util.ToString);
  895. }
  896. Func<BinaryReader, string> func_read_key2 = KasizukiManager.<>f__mg$cache6;
  897. if (KasizukiManager.<>f__mg$cache7 == null)
  898. {
  899. KasizukiManager.<>f__mg$cache7 = new Func<BinaryReader, string>(Util.ToString);
  900. }
  901. dataArray2.Deserialize(brRead2, func_read_key2, KasizukiManager.<>f__mg$cache7);
  902. }
  903. else
  904. {
  905. DataArray<string, string> dataArray3 = this.CreateMaidDataArray(stockMaid);
  906. DataArray<string, string> dataArray4 = dataArray3;
  907. BinaryReader brRead3 = binaryReader;
  908. if (KasizukiManager.<>f__mg$cache8 == null)
  909. {
  910. KasizukiManager.<>f__mg$cache8 = new Func<BinaryReader, string>(Util.ToString);
  911. }
  912. Func<BinaryReader, string> func_read_key3 = KasizukiManager.<>f__mg$cache8;
  913. if (KasizukiManager.<>f__mg$cache9 == null)
  914. {
  915. KasizukiManager.<>f__mg$cache9 = new Func<BinaryReader, string>(Util.ToString);
  916. }
  917. dataArray4.Deserialize(brRead3, func_read_key3, KasizukiManager.<>f__mg$cache9);
  918. }
  919. }
  920. }
  921. }
  922. }
  923. public static Texture2D GetMaidThumbnail(Maid maid)
  924. {
  925. Texture2D result = null;
  926. string text = Path.GetFullPath(".\\") + "Thumb\\";
  927. if (!Directory.Exists(text))
  928. {
  929. Directory.CreateDirectory(text);
  930. }
  931. string guid = maid.status.guid;
  932. string text2 = text + "_tmp_kasizuki_" + guid + ".png";
  933. if (File.Exists(text2))
  934. {
  935. result = UTY.LoadTexture(text2);
  936. }
  937. else
  938. {
  939. text2 = text + "kasizuki_" + guid + ".png";
  940. if (File.Exists(text2))
  941. {
  942. result = UTY.LoadTexture(text2);
  943. }
  944. }
  945. return result;
  946. }
  947. public static bool IsExistMaidThumbnail(Maid maid)
  948. {
  949. string text = Path.GetFullPath(".\\") + "Thumb\\";
  950. if (!Directory.Exists(text))
  951. {
  952. return false;
  953. }
  954. string guid = maid.status.guid;
  955. string path = text + "_tmp_kasizuki_" + guid + ".png";
  956. if (File.Exists(path))
  957. {
  958. return true;
  959. }
  960. path = text + "kasizuki_" + guid + ".png";
  961. return File.Exists(path);
  962. }
  963. private static void FixMaidThumbnails()
  964. {
  965. string text = Path.GetFullPath(".\\") + "Thumb\\";
  966. if (!Directory.Exists(text))
  967. {
  968. return;
  969. }
  970. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  971. for (int i = 0; i < files.Length; i++)
  972. {
  973. string text2 = string.Empty;
  974. try
  975. {
  976. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  977. }
  978. catch
  979. {
  980. }
  981. if (string.IsNullOrEmpty(text2))
  982. {
  983. files[i] = string.Empty;
  984. }
  985. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  986. {
  987. files[i] = string.Empty;
  988. }
  989. }
  990. for (int j = 0; j < files.Length; j++)
  991. {
  992. if (!string.IsNullOrEmpty(files[j]))
  993. {
  994. try
  995. {
  996. int length = "_tmp_kasizuki_".Length;
  997. string text3 = files[j].Substring(text.Length, files[j].Length - text.Length);
  998. string str = "kasizuki_" + text3.Substring(length, text3.Length - length - ".png".Length) + ".png";
  999. if (File.Exists(text + str))
  1000. {
  1001. File.Delete(text + str);
  1002. }
  1003. File.Move(files[j], text + str);
  1004. }
  1005. catch
  1006. {
  1007. }
  1008. }
  1009. }
  1010. }
  1011. private static void DeleteTmpMaidThumnails()
  1012. {
  1013. string text = Path.GetFullPath(".\\") + "Thumb\\";
  1014. if (!Directory.Exists(text))
  1015. {
  1016. return;
  1017. }
  1018. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  1019. for (int i = 0; i < files.Length; i++)
  1020. {
  1021. string text2 = string.Empty;
  1022. try
  1023. {
  1024. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  1025. }
  1026. catch
  1027. {
  1028. }
  1029. if (string.IsNullOrEmpty(text2))
  1030. {
  1031. files[i] = string.Empty;
  1032. }
  1033. else if (0 > text2.IndexOf(".png") || 0 > text2.IndexOf("_tmp_kasizuki_"))
  1034. {
  1035. files[i] = string.Empty;
  1036. }
  1037. }
  1038. for (int j = 0; j < files.Length; j++)
  1039. {
  1040. if (!string.IsNullOrEmpty(files[j]))
  1041. {
  1042. try
  1043. {
  1044. File.Delete(files[j]);
  1045. }
  1046. catch
  1047. {
  1048. }
  1049. }
  1050. }
  1051. }
  1052. public void TJSFuncGetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1053. {
  1054. NDebug.Assert(result != null, "error GetKasizukiSystemFlag");
  1055. NDebug.Assert(1 == tjs_param.Length, "GetKasizukiSystemFlag args count error.");
  1056. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1057. result.SetString(kasizukiMgr.GetSystemData<string>(tjs_param[0].AsString()));
  1058. }
  1059. public void TJSFuncSetKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1060. {
  1061. NDebug.Assert(2 == tjs_param.Length, "SetKasizukiSystemFlag args count error.");
  1062. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1063. kasizukiMgr.SetSystemData<string>(tjs_param[0].AsString(), tjs_param[1].AsString(), false);
  1064. }
  1065. public void TJSFuncAddKasizukiSystemFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1066. {
  1067. NDebug.Assert(2 == tjs_param.Length, "AddKasizukiSystemFlag args count error.");
  1068. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1069. string valueName = tjs_param[0].AsString();
  1070. int num = kasizukiMgr.GetSystemData<int>(valueName);
  1071. num += tjs_param[1].AsInteger();
  1072. kasizukiMgr.SetSystemData<int>(valueName, num, false);
  1073. }
  1074. public void TJSFuncSetKasizukiPassFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1075. {
  1076. NDebug.Assert(1 == tjs_param.Length, "SetKasizukiPassFlag args count error.");
  1077. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1078. int id = tjs_param[0].AsInteger();
  1079. PlayData.Data data = PlayData.GetData(id);
  1080. data.IsPassed = true;
  1081. }
  1082. public void TJSFuncSetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1083. {
  1084. NDebug.Assert(3 == tjs_param.Length, "SetKasizukiMaidFlag args count error.");
  1085. int num = tjs_param[0].AsInteger();
  1086. string valueName = tjs_param[1].AsString();
  1087. int value = tjs_param[2].AsInteger();
  1088. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1089. NDebug.Assert(maid != null, "[SetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1090. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1091. kasizukiMgr.SetMaidData<int>(maid, valueName, value, false);
  1092. }
  1093. public void TJSFuncGetKasizukiMaidFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1094. {
  1095. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1096. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1097. int num = tjs_param[0].AsInteger();
  1098. string valueName = tjs_param[1].AsString();
  1099. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1100. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1101. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  1102. int maidData = kasizukiMgr.GetMaidData<int>(maid, valueName, false);
  1103. result.SetInteger(maidData);
  1104. }
  1105. public void TJSFuncIsKasizukiCorrectSenarioFlag(TJSVariantRef[] tjs_param, TJSVariantRef result)
  1106. {
  1107. NDebug.Assert(result != null, "error GetKasizukiMaidFlag");
  1108. NDebug.Assert(2 == tjs_param.Length, "GetKasizukiMaidFlag args count error.");
  1109. int num = tjs_param[0].AsInteger();
  1110. int id = tjs_param[1].AsInteger();
  1111. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  1112. NDebug.Assert(maid != null, "[GetKasizukiMaidFlag]\nメイド" + num + "番が見つかりません");
  1113. ManDataType nowManType = (ManDataType)this.GetNowManType();
  1114. bool @bool = PlayData.GetData(id).IsCorrectMaid(maid, nowManType);
  1115. result.SetBool(@bool);
  1116. }
  1117. public static string CreateMaidTmpThumbName(Maid maid)
  1118. {
  1119. NDebug.AssertNull(maid != null);
  1120. return "_tmp_kasizuki_" + maid.status.guid + ".png";
  1121. }
  1122. public const int MAN_ACTIVATE_SLOT = 0;
  1123. private const string STR_SERIALIZE_HEADER = "COM3D2_KASIZUKI";
  1124. private const int SERIALIZE_VERSION = 5;
  1125. private int m_NowOriginSaveDataNumber;
  1126. private int m_NowKasizukiSaveDataIndex = 1;
  1127. private DataArray<int, bool> m_NowHaveItemDic;
  1128. private DataArray<string, string> m_SystemData;
  1129. private Dictionary<string, DataArray<string, string>> m_MaidDataArray;
  1130. private Dictionary<int, KasizukiManager.SaveData> m_SaveDataArray;
  1131. private int m_LatestSaveDataNumber = -1;
  1132. private Dictionary<MPN, MaidProp> m_CachedOriginPlayerDataDic;
  1133. private string m_CachedOriginPlayerName;
  1134. private Color m_CachedOriginPlayerColor;
  1135. public const string STR_TMP_THUMB_NAME = "_tmp_kasizuki_";
  1136. public const string STR_THUMB_NAME = "kasizuki_";
  1137. [CompilerGenerated]
  1138. private static Converter<string, byte[]> <>f__mg$cache0;
  1139. [CompilerGenerated]
  1140. private static Converter<string, byte[]> <>f__mg$cache1;
  1141. [CompilerGenerated]
  1142. private static Converter<string, byte[]> <>f__mg$cache2;
  1143. [CompilerGenerated]
  1144. private static Converter<string, byte[]> <>f__mg$cache3;
  1145. [CompilerGenerated]
  1146. private static Func<BinaryReader, string> <>f__mg$cache4;
  1147. [CompilerGenerated]
  1148. private static Func<BinaryReader, string> <>f__mg$cache5;
  1149. [CompilerGenerated]
  1150. private static Func<BinaryReader, string> <>f__mg$cache6;
  1151. [CompilerGenerated]
  1152. private static Func<BinaryReader, string> <>f__mg$cache7;
  1153. [CompilerGenerated]
  1154. private static Func<BinaryReader, string> <>f__mg$cache8;
  1155. [CompilerGenerated]
  1156. private static Func<BinaryReader, string> <>f__mg$cache9;
  1157. public class SaveDataHeader
  1158. {
  1159. public SaveDataHeader()
  1160. {
  1161. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1162. this.saveDataNumber = -1;
  1163. this.saveDataVersion = -1;
  1164. this.lastManType = 10;
  1165. this.playCount = 0;
  1166. this.strComment = string.Empty;
  1167. }
  1168. public void Serialize(BinaryWriter bw)
  1169. {
  1170. bw.Write(this.saveDataNumber);
  1171. bw.Write(this.saveDataVersion);
  1172. bw.Write(this.strRealTime);
  1173. bw.Write(this.lastManType);
  1174. bw.Write(this.playCount);
  1175. bw.Write(this.strComment);
  1176. }
  1177. public void Deserialize(BinaryReader br)
  1178. {
  1179. this.saveDataNumber = br.ReadInt32();
  1180. this.saveDataVersion = br.ReadInt32();
  1181. this.strRealTime = br.ReadString();
  1182. this.lastManType = br.ReadInt32();
  1183. if (this.saveDataVersion >= 5)
  1184. {
  1185. this.playCount = br.ReadInt32();
  1186. }
  1187. this.strComment = br.ReadString();
  1188. }
  1189. public void UpdateNowTime()
  1190. {
  1191. this.strRealTime = DateTime.Now.ToString("yyyyMMddHHmmss");
  1192. }
  1193. public DateTime GetDateTime()
  1194. {
  1195. return DateTime.ParseExact(this.strRealTime, "yyyyMMddHHmmss", null);
  1196. }
  1197. public string strRealTime;
  1198. public int saveDataNumber;
  1199. public int saveDataVersion;
  1200. public int lastManType;
  1201. public int playCount;
  1202. public string strComment;
  1203. }
  1204. public class SaveData
  1205. {
  1206. public SaveData()
  1207. {
  1208. this.header = new KasizukiManager.SaveDataHeader();
  1209. }
  1210. public void Serialize(Stream stream)
  1211. {
  1212. BinaryWriter binaryWriter = new BinaryWriter(stream);
  1213. this.header.Serialize(binaryWriter);
  1214. byte[] array = Util.CreatePrefix(this.buffer.Length);
  1215. binaryWriter.Write(array);
  1216. binaryWriter.Write(this.buffer);
  1217. binaryWriter.Flush();
  1218. }
  1219. public bool Deserialize(Stream stream)
  1220. {
  1221. if (stream.Position + 1L >= stream.Length)
  1222. {
  1223. return false;
  1224. }
  1225. BinaryReader binaryReader = new BinaryReader(stream);
  1226. this.header.Deserialize(binaryReader);
  1227. int prefix = Util.GetPrefix(binaryReader.BaseStream, binaryReader.BaseStream.Position, true);
  1228. this.buffer = new byte[prefix];
  1229. binaryReader.Read(this.buffer, 0, this.buffer.Length);
  1230. return true;
  1231. }
  1232. public KasizukiManager.SaveDataHeader header;
  1233. public byte[] buffer;
  1234. }
  1235. }
  1236. }