ScenarioData.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using MaidStatus;
  7. using UnityEngine;
  8. [Serializable]
  9. public class ScenarioData
  10. {
  11. public ScenarioData(CsvParser csv, int cy)
  12. {
  13. ScenarioData $this = this;
  14. Action<ScenarioData.PlayableCondition, int> action = delegate(ScenarioData.PlayableCondition condition, int cx)
  15. {
  16. if (csv.IsCellToExistData(cx, cy) && !$this.m_PlayableData.ContainsKey(condition))
  17. {
  18. string cellAsString2 = csv.GetCellAsString(cx, cy);
  19. if (condition == ScenarioData.PlayableCondition.関係 && cellAsString2.Contains(","))
  20. {
  21. HashSet<string> hashSet = new HashSet<string>();
  22. IEnumerator enumerator = Enum.GetValues(typeof(AdditionalRelation)).GetEnumerator();
  23. try
  24. {
  25. while (enumerator.MoveNext())
  26. {
  27. object obj = enumerator.Current;
  28. hashSet.Add(EnumConvert.GetString((AdditionalRelation)obj));
  29. }
  30. }
  31. finally
  32. {
  33. IDisposable disposable;
  34. if ((disposable = (enumerator as IDisposable)) != null)
  35. {
  36. disposable.Dispose();
  37. }
  38. }
  39. foreach (string text in cellAsString2.Split(new char[]
  40. {
  41. ','
  42. }))
  43. {
  44. string text2 = text.Trim();
  45. if (hashSet.Contains(text2))
  46. {
  47. if (!$this.m_PlayableData.ContainsKey(ScenarioData.PlayableCondition.追加関係))
  48. {
  49. $this.m_PlayableData.Add(ScenarioData.PlayableCondition.追加関係, new ScenarioData.PlayableData(text2, ScenarioData.PlayableCondition.追加関係));
  50. }
  51. }
  52. else if (text2 == "嫁")
  53. {
  54. $this.m_PlayableData.Add(ScenarioData.PlayableCondition.特殊関係, new ScenarioData.PlayableData(text2, ScenarioData.PlayableCondition.特殊関係));
  55. }
  56. else if (!$this.m_PlayableData.ContainsKey(condition))
  57. {
  58. $this.m_PlayableData.Add(condition, new ScenarioData.PlayableData(text2, condition));
  59. }
  60. }
  61. }
  62. else
  63. {
  64. $this.m_PlayableData.Add(condition, new ScenarioData.PlayableData(cellAsString2, condition));
  65. }
  66. }
  67. };
  68. for (int i = 0; i < csv.max_cell_x; i++)
  69. {
  70. switch (i)
  71. {
  72. case 0:
  73. this.ID = csv.GetCellAsInteger(i, cy);
  74. break;
  75. case 1:
  76. this.Title = csv.GetCellAsString(i, cy);
  77. break;
  78. case 2:
  79. this.EventContents = csv.GetCellAsString(i, cy);
  80. break;
  81. case 3:
  82. action(ScenarioData.PlayableCondition.好感度, i);
  83. break;
  84. case 4:
  85. action(ScenarioData.PlayableCondition.時間帯, i);
  86. break;
  87. case 5:
  88. action(ScenarioData.PlayableCondition.シナリオ, i);
  89. break;
  90. case 6:
  91. action(ScenarioData.PlayableCondition.属性, i);
  92. break;
  93. case 7:
  94. action(ScenarioData.PlayableCondition.パラメ\u30FCタ, i);
  95. break;
  96. case 8:
  97. action(ScenarioData.PlayableCondition.性癖, i);
  98. break;
  99. case 9:
  100. action(ScenarioData.PlayableCondition.ジョブクラス, i);
  101. break;
  102. case 10:
  103. action(ScenarioData.PlayableCondition.夜伽クラス, i);
  104. break;
  105. case 11:
  106. action(ScenarioData.PlayableCondition.関係, i);
  107. break;
  108. case 12:
  109. action(ScenarioData.PlayableCondition.アイテム, i);
  110. break;
  111. case 13:
  112. action(ScenarioData.PlayableCondition.施設, i);
  113. break;
  114. case 14:
  115. action(ScenarioData.PlayableCondition.NTRブロック, i);
  116. break;
  117. case 15:
  118. this.IconName = csv.GetCellAsString(i, cy);
  119. break;
  120. case 16:
  121. this.ScenarioScript = csv.GetCellAsString(i, cy);
  122. break;
  123. case 17:
  124. {
  125. string cellAsString = csv.GetCellAsString(i, cy);
  126. if (!string.IsNullOrEmpty(cellAsString))
  127. {
  128. this.ScriptLabel = ((cellAsString.IndexOf("*") < 0) ? ("*" + cellAsString) : cellAsString);
  129. }
  130. break;
  131. }
  132. case 18:
  133. this.EventMaidNum = ((!csv.IsCellToExistData(i, cy)) ? 0 : csv.GetCellAsInteger(i, cy));
  134. break;
  135. case 19:
  136. this.IsImportant = (csv.GetCellAsString(i, cy) == "重要");
  137. break;
  138. case 20:
  139. this.IsOncePlayOnly = !csv.IsCellToExistData(i, cy);
  140. break;
  141. case 21:
  142. this.Notification = csv.GetCellAsString(i, cy);
  143. break;
  144. case 22:
  145. this.ConditionText = csv.GetCellAsString(i, cy).Replace("\n", "&").Replace("\"", string.Empty).Split(new char[]
  146. {
  147. '&'
  148. });
  149. break;
  150. case 23:
  151. action(ScenarioData.PlayableCondition.性経験, i);
  152. break;
  153. case 24:
  154. action(ScenarioData.PlayableCondition.契約, i);
  155. break;
  156. case 25:
  157. action(ScenarioData.PlayableCondition.新ボディブロック, i);
  158. break;
  159. case 26:
  160. action(ScenarioData.PlayableCondition.メインキャラとのボディ一致チェック, i);
  161. break;
  162. }
  163. }
  164. this.CheckPlayableCondition(false);
  165. }
  166. public ScenarioData()
  167. {
  168. }
  169. public bool IsOncePlayed { get; private set; }
  170. public bool IsPlayable
  171. {
  172. get
  173. {
  174. return (!this.IsOncePlayOnly || !this.IsOncePlayed) && (this.ConditionCount == 0 || this.CheckPlayableCondition(false));
  175. }
  176. }
  177. public bool ImportantPlayable
  178. {
  179. get
  180. {
  181. return (!this.IsOncePlayOnly || !this.IsOncePlayed) && this.IsImportant && this.CheckPlayableCondition(true);
  182. }
  183. }
  184. private bool m_ContainsConditionScenario
  185. {
  186. get
  187. {
  188. return this.m_PlayableData.ContainsKey(ScenarioData.PlayableCondition.シナリオ);
  189. }
  190. }
  191. public int ConditionCount
  192. {
  193. get
  194. {
  195. return this.m_PlayableData.Count;
  196. }
  197. }
  198. public int EventMaidCount
  199. {
  200. get
  201. {
  202. return this.m_EventMaid.Count;
  203. }
  204. }
  205. public bool NotPlayAgain
  206. {
  207. get
  208. {
  209. return this.IsOncePlayOnly && this.IsOncePlayed;
  210. }
  211. }
  212. public string NotLineTitle
  213. {
  214. get
  215. {
  216. return this.Title.Replace("\n", string.Empty);
  217. }
  218. }
  219. public string TitleTerm
  220. {
  221. get
  222. {
  223. return "SceneScenarioSelect/" + this.ID.ToString() + "/タイトル";
  224. }
  225. }
  226. public string EventContentTerm
  227. {
  228. get
  229. {
  230. return "SceneScenarioSelect/" + this.ID.ToString() + "/内容";
  231. }
  232. }
  233. public string NotificationTerm
  234. {
  235. get
  236. {
  237. return "SceneScenarioSelect/通知時表記/" + this.Notification;
  238. }
  239. }
  240. public string[] ConditionTextTerms
  241. {
  242. get
  243. {
  244. List<string> list = new List<string>();
  245. foreach (string str in this.ConditionText)
  246. {
  247. list.Add("SceneScenarioSelect/条件文/" + str);
  248. }
  249. return list.ToArray();
  250. }
  251. }
  252. public bool IsFixedMaid { get; private set; }
  253. public static bool operator true(ScenarioData data)
  254. {
  255. return data != null;
  256. }
  257. public static bool operator false(ScenarioData data)
  258. {
  259. return data == null;
  260. }
  261. public static bool operator !(ScenarioData data)
  262. {
  263. return data == null;
  264. }
  265. private bool CheckPlayableCondition(bool update_important = false)
  266. {
  267. bool flag = false;
  268. this.m_EventMaid.Clear();
  269. if (this.m_PlayableData == null)
  270. {
  271. return false;
  272. }
  273. this.m_ExistMaidUpdate = false;
  274. bool flag2 = true;
  275. bool flag3 = false;
  276. foreach (ScenarioData.PlayableCondition playableCondition in this.m_PlayableData.Keys)
  277. {
  278. if (!update_important || playableCondition != ScenarioData.PlayableCondition.時間帯)
  279. {
  280. List<Maid> before = new List<Maid>(this.m_EventMaid);
  281. flag = this.CheckPlayableCondition(playableCondition, true);
  282. if (!flag)
  283. {
  284. break;
  285. }
  286. if (!flag2 && flag3 && this.m_ExistMaidUpdate)
  287. {
  288. this.m_EventMaid = (from e in this.m_EventMaid
  289. where before.Contains(e)
  290. select e).ToList<Maid>();
  291. if (this.m_EventMaid.Count == 0)
  292. {
  293. flag = false;
  294. break;
  295. }
  296. }
  297. flag2 = false;
  298. if (!flag3)
  299. {
  300. flag3 = (this.m_EventMaid.Count > 0);
  301. if (this.m_ExistMaidUpdate && this.EventMaidCount == 0)
  302. {
  303. flag = false;
  304. break;
  305. }
  306. }
  307. }
  308. }
  309. flag &= this.IsEnoughEventMaid();
  310. return flag;
  311. }
  312. public bool CheckPlayableCondition(ScenarioData.PlayableCondition condition, bool maid_update = true)
  313. {
  314. if (!this.m_PlayableData.ContainsKey(condition))
  315. {
  316. return false;
  317. }
  318. ScenarioData.PlayableData playableData = this.m_PlayableData[condition];
  319. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  320. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  321. bool and_operator = playableData.StringData.IndexOf("&") >= 0;
  322. bool or_operator = playableData.StringData.IndexOf("|") >= 0;
  323. char c = ',';
  324. if (and_operator && or_operator)
  325. {
  326. Debug.LogError("条件演算子が混在してます");
  327. }
  328. else if (and_operator)
  329. {
  330. c = '&';
  331. }
  332. else if (or_operator)
  333. {
  334. c = '|';
  335. }
  336. bool isOk = and_operator;
  337. Action<bool> set_ok = delegate(bool set_val)
  338. {
  339. if (and_operator)
  340. {
  341. isOk = (isOk && set_val);
  342. }
  343. else
  344. {
  345. isOk = (isOk || set_val);
  346. }
  347. };
  348. Action<Maid> add_maid = delegate(Maid maid)
  349. {
  350. if (maid_update)
  351. {
  352. this.AddEventMaid(maid);
  353. }
  354. set_ok(true);
  355. };
  356. Action<Maid> remove_maid = delegate(Maid maid)
  357. {
  358. if (and_operator && this.m_EventMaid.Contains(maid))
  359. {
  360. set_ok(false);
  361. }
  362. if (maid_update && !or_operator)
  363. {
  364. this.RemoveEventMaid(maid, false);
  365. }
  366. };
  367. Action<Maid, bool> action = delegate(Maid maid, bool check_ok)
  368. {
  369. if (check_ok)
  370. {
  371. add_maid(maid);
  372. }
  373. else
  374. {
  375. remove_maid(maid);
  376. }
  377. };
  378. bool maid_check = false;
  379. Action action2 = delegate()
  380. {
  381. if (!maid_check && maid_update)
  382. {
  383. this.m_EventMaid.Clear();
  384. }
  385. this.m_ExistMaidUpdate = true;
  386. maid_check = true;
  387. };
  388. foreach (string text in playableData.StringData.Split(new char[]
  389. {
  390. c
  391. }))
  392. {
  393. switch (condition)
  394. {
  395. case ScenarioData.PlayableCondition.好感度:
  396. {
  397. int num = int.Parse(text);
  398. action2();
  399. for (int j = 0; j < characterMgr.GetStockMaidCount(); j++)
  400. {
  401. Maid stockMaid = characterMgr.GetStockMaid(j);
  402. action(stockMaid, stockMaid.status.likability >= num);
  403. }
  404. break;
  405. }
  406. case ScenarioData.PlayableCondition.時間帯:
  407. if (text == "昼")
  408. {
  409. set_ok(characterMgr.status.isDaytime);
  410. }
  411. else
  412. {
  413. set_ok(!characterMgr.status.isDaytime);
  414. }
  415. break;
  416. case ScenarioData.PlayableCondition.属性:
  417. {
  418. string[] array2 = text.Split(new char[]
  419. {
  420. '.'
  421. });
  422. action2();
  423. for (int k = 0; k < characterMgr.GetStockMaidCount(); k++)
  424. {
  425. Maid stockMaid2 = characterMgr.GetStockMaid(k);
  426. if (text.IndexOf("NPCキャラ") >= 0)
  427. {
  428. this.IsFixedMaid = true;
  429. if (stockMaid2.status.heroineType == HeroineType.Sub && stockMaid2.status.subCharaData.uniqueName == array2[1])
  430. {
  431. add_maid(stockMaid2);
  432. }
  433. }
  434. else if (text.IndexOf("NPC以外") >= 0)
  435. {
  436. action(stockMaid2, stockMaid2.status.heroineType != HeroineType.Sub);
  437. }
  438. else if (text.IndexOf("移籍") >= 0)
  439. {
  440. if (stockMaid2.status.heroineType == HeroineType.Transfer)
  441. {
  442. if (text != null)
  443. {
  444. if (text == "移籍メイド")
  445. {
  446. add_maid(stockMaid2);
  447. goto IL_463;
  448. }
  449. if (text == "雇用移籍メイド")
  450. {
  451. action(stockMaid2, !stockMaid2.status.mainChara);
  452. goto IL_463;
  453. }
  454. }
  455. string convertPersonal = GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(stockMaid2);
  456. if (text.IndexOf("固定") >= 0)
  457. {
  458. this.IsFixedMaid = true;
  459. if (text == "固定移籍メイド")
  460. {
  461. action(stockMaid2, stockMaid2.status.mainChara && ScenarioData.m_MainMaidList.Contains(convertPersonal));
  462. }
  463. else
  464. {
  465. action(stockMaid2, stockMaid2.status.mainChara && text == "固定移籍" + convertPersonal);
  466. }
  467. }
  468. else if (GameMain.Instance.ScenarioSelectMgr.ExistConvertData(convertPersonal))
  469. {
  470. action(stockMaid2, "移籍" + convertPersonal == text);
  471. }
  472. }
  473. IL_463:;
  474. }
  475. else if (stockMaid2.status.heroineType == HeroineType.Original)
  476. {
  477. if (text != null)
  478. {
  479. if (text == "オリジナルメイド")
  480. {
  481. add_maid(stockMaid2);
  482. goto IL_5A3;
  483. }
  484. if (text == "雇用メイド")
  485. {
  486. action(stockMaid2, !stockMaid2.status.mainChara);
  487. goto IL_5A3;
  488. }
  489. }
  490. string convertPersonal2 = GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(stockMaid2);
  491. if (text.IndexOf("固定") >= 0)
  492. {
  493. this.IsFixedMaid = true;
  494. if (text == "固定メイド")
  495. {
  496. action(stockMaid2, stockMaid2.status.mainChara && ScenarioData.m_MainMaidList.Contains(convertPersonal2));
  497. }
  498. else
  499. {
  500. action(stockMaid2, stockMaid2.status.mainChara && text == "固定" + convertPersonal2);
  501. }
  502. }
  503. else if (GameMain.Instance.ScenarioSelectMgr.ExistConvertData(convertPersonal2))
  504. {
  505. action(stockMaid2, convertPersonal2 == text);
  506. }
  507. }
  508. IL_5A3:;
  509. }
  510. break;
  511. }
  512. case ScenarioData.PlayableCondition.シナリオ:
  513. {
  514. int id = -1;
  515. ScenarioData scenarioData;
  516. if (int.TryParse(text, out id))
  517. {
  518. scenarioData = GameMain.Instance.ScenarioSelectMgr.GetScenarioData(id);
  519. }
  520. else
  521. {
  522. scenarioData = GameMain.Instance.ScenarioSelectMgr.GetScenarioData(text);
  523. }
  524. if (scenarioData != null)
  525. {
  526. action2();
  527. for (int l = 0; l < characterMgr.GetStockMaidCount(); l++)
  528. {
  529. Maid stockMaid3 = characterMgr.GetStockMaid(l);
  530. action(stockMaid3, scenarioData.IsOncePlayed && stockMaid3.status.GetEventEndFlag(scenarioData.ID));
  531. }
  532. }
  533. else if (text.IndexOf("シナリオフラグ") >= 0)
  534. {
  535. set_ok(characterMgr.status.GetFlag(text.Split(new char[]
  536. {
  537. ':'
  538. })[1]) == 1);
  539. }
  540. else if (text.IndexOf("メイドフラグ") >= 0)
  541. {
  542. action2();
  543. for (int m = 0; m < characterMgr.GetStockMaidCount(); m++)
  544. {
  545. Maid stockMaid4 = characterMgr.GetStockMaid(m);
  546. action(stockMaid4, stockMaid4.status.GetFlag(text.Split(new char[]
  547. {
  548. ':'
  549. })[1]) == 1);
  550. }
  551. }
  552. break;
  553. }
  554. case ScenarioData.PlayableCondition.パラメ\u30FCタ:
  555. {
  556. action2();
  557. ParametersPack parametersPack = new ParametersPack();
  558. for (int n = 0; n < characterMgr.GetStockMaidCount(); n++)
  559. {
  560. Maid stockMaid5 = characterMgr.GetStockMaid(n);
  561. parametersPack.Clear();
  562. parametersPack.Parse(text, ',');
  563. action(stockMaid5, parametersPack.GreaterThanOrEqualToStatus(stockMaid5.status));
  564. }
  565. break;
  566. }
  567. case ScenarioData.PlayableCondition.性癖:
  568. action2();
  569. for (int num2 = 0; num2 < characterMgr.GetStockMaidCount(); num2++)
  570. {
  571. Maid stockMaid6 = characterMgr.GetStockMaid(num2);
  572. Propensity.Data[] valueArray = stockMaid6.status.propensitys.GetValueArray();
  573. bool flag = false;
  574. for (int num3 = 0; num3 < valueArray.Count<Propensity.Data>(); num3++)
  575. {
  576. if (valueArray[num3].drawName == text)
  577. {
  578. flag = true;
  579. add_maid(stockMaid6);
  580. break;
  581. }
  582. }
  583. if (!flag)
  584. {
  585. remove_maid(stockMaid6);
  586. }
  587. }
  588. break;
  589. case ScenarioData.PlayableCondition.ジョブクラス:
  590. action2();
  591. for (int num4 = 0; num4 < characterMgr.GetStockMaidCount(); num4++)
  592. {
  593. Maid stockMaid7 = characterMgr.GetStockMaid(num4);
  594. SortedDictionary<int, ClassData<JobClass.Data>> allDatas = stockMaid7.status.jobClass.GetAllDatas();
  595. bool flag2 = false;
  596. for (int num5 = 0; num5 < allDatas.Count<KeyValuePair<int, ClassData<JobClass.Data>>>(); num5++)
  597. {
  598. if (allDatas[num5].data.drawName == text)
  599. {
  600. flag2 = true;
  601. add_maid(stockMaid7);
  602. break;
  603. }
  604. }
  605. if (!flag2)
  606. {
  607. remove_maid(stockMaid7);
  608. }
  609. }
  610. break;
  611. case ScenarioData.PlayableCondition.夜伽クラス:
  612. action2();
  613. for (int num6 = 0; num6 < characterMgr.GetStockMaidCount(); num6++)
  614. {
  615. Maid stockMaid8 = characterMgr.GetStockMaid(num6);
  616. SortedDictionary<int, ClassData<YotogiClass.Data>> allDatas2 = stockMaid8.status.yotogiClass.GetAllDatas();
  617. bool flag3 = false;
  618. for (int num7 = 0; num7 < allDatas2.Count<KeyValuePair<int, ClassData<YotogiClass.Data>>>(); num7++)
  619. {
  620. if (allDatas2[num7].data.drawName == text)
  621. {
  622. flag3 = true;
  623. add_maid(stockMaid8);
  624. break;
  625. }
  626. }
  627. if (!flag3)
  628. {
  629. remove_maid(stockMaid8);
  630. }
  631. }
  632. break;
  633. case ScenarioData.PlayableCondition.関係:
  634. action2();
  635. for (int num8 = 0; num8 < characterMgr.GetStockMaidCount(); num8++)
  636. {
  637. Maid stockMaid9 = characterMgr.GetStockMaid(num8);
  638. action(stockMaid9, EnumConvert.GetString(stockMaid9.status.relation) == text);
  639. }
  640. break;
  641. case ScenarioData.PlayableCondition.追加関係:
  642. action2();
  643. for (int num9 = 0; num9 < characterMgr.GetStockMaidCount(); num9++)
  644. {
  645. Maid stockMaid10 = characterMgr.GetStockMaid(num9);
  646. action(stockMaid10, EnumConvert.GetString(stockMaid10.status.additionalRelation) == text);
  647. }
  648. break;
  649. case ScenarioData.PlayableCondition.特殊関係:
  650. action2();
  651. for (int num10 = 0; num10 < characterMgr.GetStockMaidCount(); num10++)
  652. {
  653. Maid stockMaid11 = characterMgr.GetStockMaid(num10);
  654. action(stockMaid11, EnumConvert.GetString(stockMaid11.status.specialRelation) == text);
  655. }
  656. break;
  657. case ScenarioData.PlayableCondition.アイテム:
  658. {
  659. int facilityPowerUpMaterialID = FacilityDataTable.GetFacilityPowerUpMaterialID(text);
  660. set_ok(facilityMgr.GetFacilityPowerUpItemEnable(facilityPowerUpMaterialID));
  661. break;
  662. }
  663. case ScenarioData.PlayableCondition.施設:
  664. {
  665. string[] array3 = text.Replace("Lv", " ").Split(new char[]
  666. {
  667. ' '
  668. });
  669. int facilityTypeID = -1;
  670. if (!int.TryParse(array3[0], out facilityTypeID))
  671. {
  672. facilityTypeID = FacilityDataTable.GetFacilityTypeID(array3[0]);
  673. }
  674. if (array3.Count<string>() > 1)
  675. {
  676. set_ok(facilityMgr.IsExistTypeFacility(facilityTypeID) && facilityMgr.GetFacilityLevel(facilityTypeID) >= int.Parse(array3[1]));
  677. }
  678. else
  679. {
  680. set_ok(facilityMgr.IsExistTypeFacility(facilityTypeID));
  681. }
  682. break;
  683. }
  684. case ScenarioData.PlayableCondition.NTRブロック:
  685. if (text == "○")
  686. {
  687. set_ok(GameMain.Instance.CharacterMgr.status.lockNTRPlay);
  688. }
  689. else
  690. {
  691. set_ok(!GameMain.Instance.CharacterMgr.status.lockNTRPlay);
  692. }
  693. break;
  694. case ScenarioData.PlayableCondition.性経験:
  695. action2();
  696. for (int num11 = 0; num11 < characterMgr.GetStockMaidCount(); num11++)
  697. {
  698. Maid stockMaid12 = characterMgr.GetStockMaid(num11);
  699. action(stockMaid12, EnumConvert.GetString(stockMaid12.status.seikeiken) == text);
  700. }
  701. break;
  702. case ScenarioData.PlayableCondition.契約:
  703. action2();
  704. for (int num12 = 0; num12 < characterMgr.GetStockMaidCount(); num12++)
  705. {
  706. Maid stockMaid13 = characterMgr.GetStockMaid(num12);
  707. action(stockMaid13, EnumConvert.GetString(stockMaid13.status.contract) == text);
  708. }
  709. break;
  710. case ScenarioData.PlayableCondition.新ボディブロック:
  711. {
  712. action2();
  713. bool flag4 = text == "○" || text == "◯";
  714. for (int num13 = 0; num13 < characterMgr.GetStockMaidCount(); num13++)
  715. {
  716. Maid stockMaid14 = characterMgr.GetStockMaid(num13);
  717. action(stockMaid14, !flag4 || (flag4 && !stockMaid14.IsCrcBody));
  718. }
  719. break;
  720. }
  721. case ScenarioData.PlayableCondition.メインキャラとのボディ一致チェック:
  722. {
  723. action2();
  724. CharacterMgr characterMgr2 = GameMain.Instance.CharacterMgr;
  725. Maid maid3 = null;
  726. for (int num14 = 0; num14 < characterMgr2.GetStockMaidCount(); num14++)
  727. {
  728. Maid stockMaid15 = characterMgr2.GetStockMaid(num14);
  729. if (stockMaid15 != null && stockMaid15.status.mainChara)
  730. {
  731. string convertPersonal3 = GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(stockMaid15);
  732. if (convertPersonal3 == text)
  733. {
  734. maid3 = stockMaid15;
  735. break;
  736. }
  737. }
  738. }
  739. if (!maid3)
  740. {
  741. set_ok(false);
  742. }
  743. else if (this.m_EventMaid.Count > 0)
  744. {
  745. List<Maid> list = new List<Maid>(this.m_EventMaid);
  746. for (int num15 = 0; num15 < list.Count; num15++)
  747. {
  748. Maid maid2 = list[num15];
  749. if (maid2 == maid3)
  750. {
  751. this.m_EventMaid.Remove(maid2);
  752. }
  753. else
  754. {
  755. action(maid2, maid3.IsCrcBody == maid2.IsCrcBody);
  756. }
  757. }
  758. }
  759. else
  760. {
  761. for (int num16 = 0; num16 < characterMgr.GetStockMaidCount(); num16++)
  762. {
  763. Maid stockMaid16 = characterMgr.GetStockMaid(num16);
  764. action(stockMaid16, maid3 != stockMaid16 && maid3.IsCrcBody == stockMaid16.IsCrcBody);
  765. }
  766. }
  767. break;
  768. }
  769. }
  770. if (maid_check && maid_update)
  771. {
  772. if (and_operator)
  773. {
  774. isOk &= (this.m_EventMaid.Count > 0);
  775. }
  776. else
  777. {
  778. isOk |= (this.m_EventMaid.Count > 0);
  779. }
  780. }
  781. }
  782. return isOk;
  783. }
  784. public bool IsEnoughEventMaid()
  785. {
  786. if (!this.IsFixedMaid || this.EventMaidNum > 0)
  787. {
  788. return this.EventMaidNum <= this.m_EventMaid.Count;
  789. }
  790. return this.m_EventMaid.Count != 0;
  791. }
  792. public Maid GetEventMaid(int no)
  793. {
  794. return this.m_EventMaid[no];
  795. }
  796. public List<Maid> GetEventMaidList()
  797. {
  798. return this.m_EventMaid;
  799. }
  800. public bool ExistEventMaid(Maid maid)
  801. {
  802. return this.m_EventMaid.Contains(maid);
  803. }
  804. public void AddEventMaid(Maid maid)
  805. {
  806. if (!this.m_EventMaid.Contains(maid) && !maid.status.GetEventEndFlag(this.ID))
  807. {
  808. this.m_EventMaid.Add(maid);
  809. }
  810. }
  811. public void RemoveEventMaid(List<Maid> maid_list, bool not_again = false)
  812. {
  813. foreach (Maid maid in maid_list)
  814. {
  815. this.RemoveEventMaid(maid, not_again);
  816. }
  817. }
  818. public void RemoveEventMaid(Maid maid, bool not_again = false)
  819. {
  820. if (this.m_EventMaid.Contains(maid))
  821. {
  822. this.m_EventMaid.Remove(maid);
  823. if (not_again)
  824. {
  825. maid.status.SetEventEndFlag(this.ID, true);
  826. }
  827. }
  828. }
  829. public void ScenarioPlay(List<Maid> maid_list)
  830. {
  831. if (!this.IsFixedMaid)
  832. {
  833. for (int i = 0; i < maid_list.Count; i++)
  834. {
  835. GameMain.Instance.CharacterMgr.SetActiveMaid(maid_list[i], i);
  836. }
  837. }
  838. this.RemoveEventMaid(maid_list, this.m_NotMaidAgain);
  839. this.IsOncePlayed = true;
  840. }
  841. public ScenarioData.PlayableData[] GetPlayableDataArray()
  842. {
  843. return this.m_PlayableData.Values.ToArray<ScenarioData.PlayableData>();
  844. }
  845. public ScenarioData.PlayableData GetPlayableData(int index)
  846. {
  847. return this.m_PlayableData.Values.ElementAt(index);
  848. }
  849. public ScenarioData.PlayableData GetPlayableData(ScenarioData.PlayableCondition condition)
  850. {
  851. return (!this.m_PlayableData.ContainsKey(condition)) ? null : this.m_PlayableData[condition];
  852. }
  853. public void Serialize(BinaryWriter writer)
  854. {
  855. writer.Write(this.IsOncePlayed);
  856. }
  857. public void Deserialize(BinaryReader reader)
  858. {
  859. try
  860. {
  861. this.IsOncePlayed = reader.ReadBoolean();
  862. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer >= 1f)
  863. {
  864. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer < 1.2f)
  865. {
  866. reader.ReadInt32();
  867. }
  868. }
  869. else
  870. {
  871. reader.ReadBoolean();
  872. }
  873. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer >= 1.1f && GameMain.Instance.ScenarioSelectMgr.nSaveVer < 1.3f)
  874. {
  875. reader.ReadBoolean();
  876. }
  877. }
  878. catch
  879. {
  880. if (GameMain.Instance.ScenarioSelectMgr.DeserializeFiled)
  881. {
  882. Debug.Log("ScenarioSelectMgr.cs:前のバージョンのデータです(2017/10/24より前)");
  883. }
  884. else
  885. {
  886. Debug.LogError("ScenarioSelectMgr.cs:読み込みエラー");
  887. }
  888. }
  889. }
  890. public void Recet()
  891. {
  892. this.IsOncePlayed = false;
  893. }
  894. public const string TermPrefixNotification = "SceneScenarioSelect/通知時表記/";
  895. private static string[] m_MainMaidList = new string[]
  896. {
  897. "無垢",
  898. "真面目",
  899. "凜デレ",
  900. "純真",
  901. "クーデレ",
  902. "ツンデレ"
  903. };
  904. public readonly int ID;
  905. public readonly Dictionary<ScenarioData.PlayableCondition, ScenarioData.PlayableData> m_PlayableData = new Dictionary<ScenarioData.PlayableCondition, ScenarioData.PlayableData>();
  906. public readonly string Title;
  907. public readonly string EventContents;
  908. public readonly string ScenarioScript;
  909. public readonly string ScriptLabel;
  910. public readonly int EventMaidNum;
  911. public readonly string IconName;
  912. public readonly bool IsImportant;
  913. public readonly bool IsOncePlayOnly;
  914. public readonly string[] ConditionText;
  915. public readonly string Notification;
  916. private List<Maid> m_EventMaid = new List<Maid>();
  917. private bool m_NotMaidAgain = true;
  918. private bool m_ExistMaidUpdate;
  919. public enum PlayableCondition
  920. {
  921. 好感度,
  922. 時間帯,
  923. 属性,
  924. シナリオ,
  925. パラメ\u30FCタ,
  926. 性癖,
  927. ジョブクラス,
  928. 夜伽クラス,
  929. 関係,
  930. 追加関係,
  931. 特殊関係,
  932. アイテム,
  933. 施設,
  934. NTRブロック,
  935. 性経験,
  936. 契約,
  937. 新ボディブロック,
  938. メインキャラとのボディ一致チェック,
  939. MAX
  940. }
  941. public class PlayableData
  942. {
  943. public PlayableData(string data, ScenarioData.PlayableCondition condition)
  944. {
  945. this.Condition = condition;
  946. this.StringData = data.Replace('.', '.').Replace(',', ',').Replace(',', '&');
  947. }
  948. public string[] StrdataArray
  949. {
  950. get
  951. {
  952. return this.StringData.Split(new char[]
  953. {
  954. ','
  955. });
  956. }
  957. }
  958. public readonly string StringData;
  959. public readonly ScenarioData.PlayableCondition Condition;
  960. }
  961. }