ScenarioData.cs 21 KB

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