ScenarioData.cs 23 KB

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