ScenarioData.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  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. }
  151. }
  152. this.CheckPlayableCondition(false);
  153. }
  154. public ScenarioData()
  155. {
  156. }
  157. public bool IsOncePlayed { get; private set; }
  158. public bool IsPlayable
  159. {
  160. get
  161. {
  162. return (!this.IsOncePlayOnly || !this.IsOncePlayed) && (this.ConditionCount == 0 || this.CheckPlayableCondition(false));
  163. }
  164. }
  165. public bool ImportantPlayable
  166. {
  167. get
  168. {
  169. return (!this.IsOncePlayOnly || !this.IsOncePlayed) && this.IsImportant && this.CheckPlayableCondition(true);
  170. }
  171. }
  172. private bool m_ContainsConditionScenario
  173. {
  174. get
  175. {
  176. return this.m_PlayableData.ContainsKey(ScenarioData.PlayableCondition.シナリオ);
  177. }
  178. }
  179. public int ConditionCount
  180. {
  181. get
  182. {
  183. return this.m_PlayableData.Count;
  184. }
  185. }
  186. public int EventMaidCount
  187. {
  188. get
  189. {
  190. return this.m_EventMaid.Count;
  191. }
  192. }
  193. public bool NotPlayAgain
  194. {
  195. get
  196. {
  197. return this.IsOncePlayOnly && this.IsOncePlayed;
  198. }
  199. }
  200. public string NotLineTitle
  201. {
  202. get
  203. {
  204. return this.Title.Replace("\n", string.Empty);
  205. }
  206. }
  207. public string TitleTerm
  208. {
  209. get
  210. {
  211. return "SceneScenarioSelect/" + this.ID.ToString() + "/タイトル";
  212. }
  213. }
  214. public string EventContentTerm
  215. {
  216. get
  217. {
  218. return "SceneScenarioSelect/" + this.ID.ToString() + "/内容";
  219. }
  220. }
  221. public string NotificationTerm
  222. {
  223. get
  224. {
  225. return "SceneScenarioSelect/通知時表記/" + this.Notification;
  226. }
  227. }
  228. public string[] ConditionTextTerms
  229. {
  230. get
  231. {
  232. List<string> list = new List<string>();
  233. foreach (string str in this.ConditionText)
  234. {
  235. list.Add("SceneScenarioSelect/条件文/" + str);
  236. }
  237. return list.ToArray();
  238. }
  239. }
  240. public bool IsFixedMaid { get; private set; }
  241. public static bool operator true(ScenarioData data)
  242. {
  243. return data != null;
  244. }
  245. public static bool operator false(ScenarioData data)
  246. {
  247. return data == null;
  248. }
  249. public static bool operator !(ScenarioData data)
  250. {
  251. return data == null;
  252. }
  253. private bool CheckPlayableCondition(bool update_important = false)
  254. {
  255. bool flag = false;
  256. this.m_EventMaid.Clear();
  257. if (this.m_PlayableData == null)
  258. {
  259. return false;
  260. }
  261. this.m_ExistMaidUpdate = false;
  262. bool flag2 = true;
  263. bool flag3 = false;
  264. foreach (ScenarioData.PlayableCondition playableCondition in this.m_PlayableData.Keys)
  265. {
  266. if (!update_important || playableCondition != ScenarioData.PlayableCondition.時間帯)
  267. {
  268. List<Maid> before = new List<Maid>(this.m_EventMaid);
  269. flag = this.CheckPlayableCondition(playableCondition, true);
  270. if (!flag)
  271. {
  272. break;
  273. }
  274. if (!flag2 && flag3 && this.m_ExistMaidUpdate)
  275. {
  276. this.m_EventMaid = (from e in this.m_EventMaid
  277. where before.Contains(e)
  278. select e).ToList<Maid>();
  279. if (this.m_EventMaid.Count == 0)
  280. {
  281. flag = false;
  282. break;
  283. }
  284. }
  285. flag2 = false;
  286. if (!flag3)
  287. {
  288. flag3 = (this.m_EventMaid.Count > 0);
  289. if (this.m_ExistMaidUpdate && this.EventMaidCount == 0)
  290. {
  291. flag = false;
  292. break;
  293. }
  294. }
  295. }
  296. }
  297. flag &= this.IsEnoughEventMaid();
  298. return flag;
  299. }
  300. public bool CheckPlayableCondition(ScenarioData.PlayableCondition condition, bool maid_update = true)
  301. {
  302. if (!this.m_PlayableData.ContainsKey(condition))
  303. {
  304. return false;
  305. }
  306. ScenarioData.PlayableData playableData = this.m_PlayableData[condition];
  307. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  308. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  309. bool and_operator = playableData.StringData.IndexOf("&") >= 0;
  310. bool flag = playableData.StringData.IndexOf("|") >= 0;
  311. char c = ',';
  312. if (and_operator && flag)
  313. {
  314. Debug.LogError("条件演算子が混在してます");
  315. }
  316. else if (and_operator)
  317. {
  318. c = '&';
  319. }
  320. else if (flag)
  321. {
  322. c = '|';
  323. }
  324. bool isOk = and_operator;
  325. Action<bool> set_ok = delegate(bool set_val)
  326. {
  327. if (and_operator)
  328. {
  329. isOk = (isOk && set_val);
  330. }
  331. else
  332. {
  333. isOk = (isOk || set_val);
  334. }
  335. };
  336. Action<Maid> add_maid = delegate(Maid maid)
  337. {
  338. if (maid_update)
  339. {
  340. this.AddEventMaid(maid);
  341. }
  342. set_ok(true);
  343. };
  344. Action<Maid> remove_maid = delegate(Maid maid)
  345. {
  346. if (and_operator && this.m_EventMaid.Contains(maid))
  347. {
  348. set_ok(false);
  349. }
  350. if (maid_update)
  351. {
  352. this.RemoveEventMaid(maid, false);
  353. }
  354. };
  355. Action<Maid, bool> action = delegate(Maid maid, bool check_ok)
  356. {
  357. if (check_ok)
  358. {
  359. add_maid(maid);
  360. }
  361. else
  362. {
  363. remove_maid(maid);
  364. }
  365. };
  366. bool maid_check = false;
  367. Action action2 = delegate()
  368. {
  369. if (!maid_check && maid_update)
  370. {
  371. this.m_EventMaid.Clear();
  372. }
  373. this.m_ExistMaidUpdate = true;
  374. maid_check = true;
  375. };
  376. foreach (string text in playableData.StringData.Split(new char[]
  377. {
  378. c
  379. }))
  380. {
  381. switch (condition)
  382. {
  383. case ScenarioData.PlayableCondition.好感度:
  384. {
  385. int num = int.Parse(text);
  386. action2();
  387. for (int j = 0; j < characterMgr.GetStockMaidCount(); j++)
  388. {
  389. Maid stockMaid = characterMgr.GetStockMaid(j);
  390. action(stockMaid, stockMaid.status.likability >= num);
  391. }
  392. break;
  393. }
  394. case ScenarioData.PlayableCondition.時間帯:
  395. if (text == "昼")
  396. {
  397. set_ok(characterMgr.status.isDaytime);
  398. }
  399. else
  400. {
  401. set_ok(!characterMgr.status.isDaytime);
  402. }
  403. break;
  404. case ScenarioData.PlayableCondition.属性:
  405. {
  406. string[] array2 = text.Split(new char[]
  407. {
  408. '.'
  409. });
  410. action2();
  411. for (int k = 0; k < characterMgr.GetStockMaidCount(); k++)
  412. {
  413. Maid stockMaid2 = characterMgr.GetStockMaid(k);
  414. if (text.IndexOf("NPCキャラ") >= 0)
  415. {
  416. this.IsFixedMaid = true;
  417. if (stockMaid2.status.heroineType == HeroineType.Sub && stockMaid2.status.subCharaData.uniqueName == array2[1])
  418. {
  419. add_maid(stockMaid2);
  420. }
  421. }
  422. else if (text.IndexOf("NPC以外") >= 0)
  423. {
  424. action(stockMaid2, stockMaid2.status.heroineType != HeroineType.Sub);
  425. }
  426. else if (text.IndexOf("移籍") >= 0)
  427. {
  428. if (stockMaid2.status.heroineType == HeroineType.Transfer)
  429. {
  430. if (text != null)
  431. {
  432. if (text == "移籍メイド")
  433. {
  434. add_maid(stockMaid2);
  435. goto IL_447;
  436. }
  437. if (text == "雇用移籍メイド")
  438. {
  439. action(stockMaid2, !stockMaid2.status.mainChara);
  440. goto IL_447;
  441. }
  442. }
  443. string convertPersonal = GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(stockMaid2);
  444. if (text.IndexOf("固定") >= 0)
  445. {
  446. this.IsFixedMaid = true;
  447. if (text == "固定移籍メイド")
  448. {
  449. action(stockMaid2, stockMaid2.status.mainChara && ScenarioData.m_MainMaidList.Contains(convertPersonal));
  450. }
  451. else
  452. {
  453. action(stockMaid2, stockMaid2.status.mainChara && text == "固定移籍" + convertPersonal);
  454. }
  455. }
  456. else if (GameMain.Instance.ScenarioSelectMgr.ExistConvertData(convertPersonal))
  457. {
  458. action(stockMaid2, "移籍" + convertPersonal == text);
  459. }
  460. }
  461. IL_447:;
  462. }
  463. else if (stockMaid2.status.heroineType == HeroineType.Original)
  464. {
  465. if (text != null)
  466. {
  467. if (text == "オリジナルメイド")
  468. {
  469. add_maid(stockMaid2);
  470. goto IL_587;
  471. }
  472. if (text == "雇用メイド")
  473. {
  474. action(stockMaid2, !stockMaid2.status.mainChara);
  475. goto IL_587;
  476. }
  477. }
  478. string convertPersonal2 = GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(stockMaid2);
  479. if (text.IndexOf("固定") >= 0)
  480. {
  481. this.IsFixedMaid = true;
  482. if (text == "固定メイド")
  483. {
  484. action(stockMaid2, stockMaid2.status.mainChara && ScenarioData.m_MainMaidList.Contains(convertPersonal2));
  485. }
  486. else
  487. {
  488. action(stockMaid2, stockMaid2.status.mainChara && text == "固定" + convertPersonal2);
  489. }
  490. }
  491. else if (GameMain.Instance.ScenarioSelectMgr.ExistConvertData(convertPersonal2))
  492. {
  493. action(stockMaid2, convertPersonal2 == text);
  494. }
  495. }
  496. IL_587:;
  497. }
  498. break;
  499. }
  500. case ScenarioData.PlayableCondition.シナリオ:
  501. {
  502. int id = -1;
  503. ScenarioData scenarioData;
  504. if (int.TryParse(text, out id))
  505. {
  506. scenarioData = GameMain.Instance.ScenarioSelectMgr.GetScenarioData(id);
  507. }
  508. else
  509. {
  510. scenarioData = GameMain.Instance.ScenarioSelectMgr.GetScenarioData(text);
  511. }
  512. if (scenarioData != null)
  513. {
  514. action2();
  515. for (int l = 0; l < characterMgr.GetStockMaidCount(); l++)
  516. {
  517. Maid stockMaid3 = characterMgr.GetStockMaid(l);
  518. action(stockMaid3, scenarioData.IsOncePlayed && stockMaid3.status.GetEventEndFlag(scenarioData.ID));
  519. }
  520. }
  521. else if (text.IndexOf("シナリオフラグ") >= 0)
  522. {
  523. set_ok(characterMgr.status.GetFlag(text.Split(new char[]
  524. {
  525. ':'
  526. })[1]) == 1);
  527. }
  528. else if (text.IndexOf("メイドフラグ") >= 0)
  529. {
  530. action2();
  531. for (int m = 0; m < characterMgr.GetStockMaidCount(); m++)
  532. {
  533. Maid stockMaid4 = characterMgr.GetStockMaid(m);
  534. action(stockMaid4, stockMaid4.status.GetFlag(text.Split(new char[]
  535. {
  536. ':'
  537. })[1]) == 1);
  538. }
  539. }
  540. break;
  541. }
  542. case ScenarioData.PlayableCondition.パラメ\u30FCタ:
  543. {
  544. action2();
  545. ParametersPack parametersPack = new ParametersPack();
  546. for (int n = 0; n < characterMgr.GetStockMaidCount(); n++)
  547. {
  548. Maid stockMaid5 = characterMgr.GetStockMaid(n);
  549. parametersPack.Clear();
  550. parametersPack.Parse(text, ',');
  551. action(stockMaid5, parametersPack.GreaterThanOrEqualToStatus(stockMaid5.status));
  552. }
  553. break;
  554. }
  555. case ScenarioData.PlayableCondition.性癖:
  556. action2();
  557. for (int num2 = 0; num2 < characterMgr.GetStockMaidCount(); num2++)
  558. {
  559. Maid stockMaid6 = characterMgr.GetStockMaid(num2);
  560. Propensity.Data[] valueArray = stockMaid6.status.propensitys.GetValueArray();
  561. bool flag2 = false;
  562. for (int num3 = 0; num3 < valueArray.Count<Propensity.Data>(); num3++)
  563. {
  564. if (valueArray[num3].drawName == text)
  565. {
  566. flag2 = true;
  567. add_maid(stockMaid6);
  568. break;
  569. }
  570. }
  571. if (!flag2)
  572. {
  573. remove_maid(stockMaid6);
  574. }
  575. }
  576. break;
  577. case ScenarioData.PlayableCondition.ジョブクラス:
  578. action2();
  579. for (int num4 = 0; num4 < characterMgr.GetStockMaidCount(); num4++)
  580. {
  581. Maid stockMaid7 = characterMgr.GetStockMaid(num4);
  582. SortedDictionary<int, ClassData<JobClass.Data>> allDatas = stockMaid7.status.jobClass.GetAllDatas();
  583. bool flag3 = false;
  584. for (int num5 = 0; num5 < allDatas.Count<KeyValuePair<int, ClassData<JobClass.Data>>>(); num5++)
  585. {
  586. if (allDatas[num5].data.drawName == text)
  587. {
  588. flag3 = true;
  589. add_maid(stockMaid7);
  590. break;
  591. }
  592. }
  593. if (!flag3)
  594. {
  595. remove_maid(stockMaid7);
  596. }
  597. }
  598. break;
  599. case ScenarioData.PlayableCondition.夜伽クラス:
  600. action2();
  601. for (int num6 = 0; num6 < characterMgr.GetStockMaidCount(); num6++)
  602. {
  603. Maid stockMaid8 = characterMgr.GetStockMaid(num6);
  604. SortedDictionary<int, ClassData<YotogiClass.Data>> allDatas2 = stockMaid8.status.yotogiClass.GetAllDatas();
  605. bool flag4 = false;
  606. for (int num7 = 0; num7 < allDatas2.Count<KeyValuePair<int, ClassData<YotogiClass.Data>>>(); num7++)
  607. {
  608. if (allDatas2[num7].data.drawName == text)
  609. {
  610. flag4 = true;
  611. add_maid(stockMaid8);
  612. break;
  613. }
  614. }
  615. if (!flag4)
  616. {
  617. remove_maid(stockMaid8);
  618. }
  619. }
  620. break;
  621. case ScenarioData.PlayableCondition.関係:
  622. action2();
  623. for (int num8 = 0; num8 < characterMgr.GetStockMaidCount(); num8++)
  624. {
  625. Maid stockMaid9 = characterMgr.GetStockMaid(num8);
  626. action(stockMaid9, EnumConvert.GetString(stockMaid9.status.relation) == text);
  627. }
  628. break;
  629. case ScenarioData.PlayableCondition.追加関係:
  630. action2();
  631. for (int num9 = 0; num9 < characterMgr.GetStockMaidCount(); num9++)
  632. {
  633. Maid stockMaid10 = characterMgr.GetStockMaid(num9);
  634. action(stockMaid10, EnumConvert.GetString(stockMaid10.status.additionalRelation) == text);
  635. }
  636. break;
  637. case ScenarioData.PlayableCondition.特殊関係:
  638. action2();
  639. for (int num10 = 0; num10 < characterMgr.GetStockMaidCount(); num10++)
  640. {
  641. Maid stockMaid11 = characterMgr.GetStockMaid(num10);
  642. action(stockMaid11, EnumConvert.GetString(stockMaid11.status.specialRelation) == text);
  643. }
  644. break;
  645. case ScenarioData.PlayableCondition.アイテム:
  646. {
  647. int facilityPowerUpMaterialID = FacilityDataTable.GetFacilityPowerUpMaterialID(text);
  648. set_ok(facilityMgr.GetFacilityPowerUpItemEnable(facilityPowerUpMaterialID));
  649. break;
  650. }
  651. case ScenarioData.PlayableCondition.施設:
  652. {
  653. string[] array3 = text.Replace("Lv", " ").Split(new char[]
  654. {
  655. ' '
  656. });
  657. int facilityTypeID = -1;
  658. if (!int.TryParse(array3[0], out facilityTypeID))
  659. {
  660. facilityTypeID = FacilityDataTable.GetFacilityTypeID(array3[0]);
  661. }
  662. if (array3.Count<string>() > 1)
  663. {
  664. set_ok(facilityMgr.IsExistTypeFacility(facilityTypeID) && facilityMgr.GetFacilityLevel(facilityTypeID) >= int.Parse(array3[1]));
  665. }
  666. else
  667. {
  668. set_ok(facilityMgr.IsExistTypeFacility(facilityTypeID));
  669. }
  670. break;
  671. }
  672. case ScenarioData.PlayableCondition.NTRブロック:
  673. if (text == "○")
  674. {
  675. set_ok(GameMain.Instance.CharacterMgr.status.lockNTRPlay);
  676. }
  677. else
  678. {
  679. set_ok(!GameMain.Instance.CharacterMgr.status.lockNTRPlay);
  680. }
  681. break;
  682. }
  683. if (maid_check)
  684. {
  685. if (and_operator)
  686. {
  687. isOk &= (this.m_EventMaid.Count > 0);
  688. }
  689. else
  690. {
  691. isOk |= (this.m_EventMaid.Count > 0);
  692. }
  693. }
  694. }
  695. return isOk;
  696. }
  697. public bool IsEnoughEventMaid()
  698. {
  699. if (!this.IsFixedMaid)
  700. {
  701. return this.EventMaidNum <= this.m_EventMaid.Count;
  702. }
  703. return this.m_EventMaid.Count != 0;
  704. }
  705. public Maid GetEventMaid(int no)
  706. {
  707. return this.m_EventMaid[no];
  708. }
  709. public List<Maid> GetEventMaidList()
  710. {
  711. return this.m_EventMaid;
  712. }
  713. public bool ExistEventMaid(Maid maid)
  714. {
  715. return this.m_EventMaid.Contains(maid);
  716. }
  717. public void AddEventMaid(Maid maid)
  718. {
  719. if (!this.m_EventMaid.Contains(maid) && !maid.status.GetEventEndFlag(this.ID))
  720. {
  721. this.m_EventMaid.Add(maid);
  722. }
  723. }
  724. public void RemoveEventMaid(List<Maid> maid_list, bool not_again = false)
  725. {
  726. foreach (Maid maid in maid_list)
  727. {
  728. this.RemoveEventMaid(maid, not_again);
  729. }
  730. }
  731. public void RemoveEventMaid(Maid maid, bool not_again = false)
  732. {
  733. if (this.m_EventMaid.Contains(maid))
  734. {
  735. this.m_EventMaid.Remove(maid);
  736. if (not_again)
  737. {
  738. maid.status.SetEventEndFlag(this.ID, true);
  739. }
  740. }
  741. }
  742. public void ScenarioPlay(List<Maid> maid_list)
  743. {
  744. if (!this.IsFixedMaid)
  745. {
  746. for (int i = 0; i < maid_list.Count; i++)
  747. {
  748. GameMain.Instance.CharacterMgr.SetActiveMaid(maid_list[i], i);
  749. }
  750. }
  751. this.RemoveEventMaid(maid_list, this.m_NotMaidAgain);
  752. this.IsOncePlayed = true;
  753. }
  754. public ScenarioData.PlayableData[] GetPlayableDataArray()
  755. {
  756. return this.m_PlayableData.Values.ToArray<ScenarioData.PlayableData>();
  757. }
  758. public ScenarioData.PlayableData GetPlayableData(int index)
  759. {
  760. return this.m_PlayableData.Values.ElementAt(index);
  761. }
  762. public ScenarioData.PlayableData GetPlayableData(ScenarioData.PlayableCondition condition)
  763. {
  764. return (!this.m_PlayableData.ContainsKey(condition)) ? null : this.m_PlayableData[condition];
  765. }
  766. public void Serialize(BinaryWriter writer)
  767. {
  768. writer.Write(this.IsOncePlayed);
  769. }
  770. public void Deserialize(BinaryReader reader)
  771. {
  772. try
  773. {
  774. this.IsOncePlayed = reader.ReadBoolean();
  775. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer >= 1f)
  776. {
  777. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer < 1.2f)
  778. {
  779. reader.ReadInt32();
  780. }
  781. }
  782. else
  783. {
  784. reader.ReadBoolean();
  785. }
  786. if (GameMain.Instance.ScenarioSelectMgr.nSaveVer >= 1.1f && GameMain.Instance.ScenarioSelectMgr.nSaveVer < 1.3f)
  787. {
  788. reader.ReadBoolean();
  789. }
  790. }
  791. catch
  792. {
  793. if (GameMain.Instance.ScenarioSelectMgr.DeserializeFiled)
  794. {
  795. Debug.Log("ScenarioSelectMgr.cs:前のバージョンのデータです(2017/10/24より前)");
  796. }
  797. else
  798. {
  799. Debug.LogError("ScenarioSelectMgr.cs:読み込みエラー");
  800. }
  801. }
  802. }
  803. public void Recet()
  804. {
  805. this.IsOncePlayed = false;
  806. }
  807. public const string TermPrefixNotification = "SceneScenarioSelect/通知時表記/";
  808. private static string[] m_MainMaidList = new string[]
  809. {
  810. "無垢",
  811. "真面目",
  812. "凜デレ",
  813. "純真",
  814. "クーデレ",
  815. "ツンデレ"
  816. };
  817. public readonly int ID;
  818. public readonly Dictionary<ScenarioData.PlayableCondition, ScenarioData.PlayableData> m_PlayableData = new Dictionary<ScenarioData.PlayableCondition, ScenarioData.PlayableData>();
  819. public readonly string Title;
  820. public readonly string EventContents;
  821. public readonly string ScenarioScript;
  822. public readonly string ScriptLabel;
  823. public readonly int EventMaidNum;
  824. public readonly string IconName;
  825. public readonly bool IsImportant;
  826. public readonly bool IsOncePlayOnly;
  827. public readonly string[] ConditionText;
  828. public readonly string Notification;
  829. private List<Maid> m_EventMaid = new List<Maid>();
  830. private bool m_NotMaidAgain = true;
  831. private bool m_ExistMaidUpdate;
  832. public enum PlayableCondition
  833. {
  834. 好感度,
  835. 時間帯,
  836. 属性,
  837. シナリオ,
  838. パラメ\u30FCタ,
  839. 性癖,
  840. ジョブクラス,
  841. 夜伽クラス,
  842. 関係,
  843. 追加関係,
  844. 特殊関係,
  845. アイテム,
  846. 施設,
  847. NTRブロック,
  848. MAX
  849. }
  850. public class PlayableData
  851. {
  852. public PlayableData(string data, ScenarioData.PlayableCondition condition)
  853. {
  854. this.Condition = condition;
  855. this.StringData = data.Replace('.', '.').Replace(',', ',').Replace(',', '&');
  856. }
  857. public string[] StrdataArray
  858. {
  859. get
  860. {
  861. return this.StringData.Split(new char[]
  862. {
  863. ','
  864. });
  865. }
  866. }
  867. public readonly string StringData;
  868. public readonly ScenarioData.PlayableCondition Condition;
  869. }
  870. }