Shop.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using PlayerStatus;
  5. using UnityEngine;
  6. using wf;
  7. public class Shop
  8. {
  9. public static void CreateData()
  10. {
  11. if (0 < Shop.item_data_dic_.Count)
  12. {
  13. return;
  14. }
  15. Shop.sub_category_dressingbutton_enabled_ = new Dictionary<string, bool>();
  16. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("game_in_shop_category_list.nei"))
  17. {
  18. using (CsvParser csvParser = new CsvParser())
  19. {
  20. bool condition = csvParser.Open(afileBase);
  21. NDebug.Assert(condition, "game_in_shop_category_list.nei\nopen failed.");
  22. for (int i = 1; i < csvParser.max_cell_y; i++)
  23. {
  24. if (csvParser.IsCellToExistData(0, i))
  25. {
  26. string cellAsString = csvParser.GetCellAsString(0, i);
  27. string cellAsString2 = csvParser.GetCellAsString(1, i);
  28. if (!Shop.sub_category_dressingbutton_enabled_.ContainsKey(cellAsString2))
  29. {
  30. Shop.sub_category_dressingbutton_enabled_.Add(cellAsString2, csvParser.GetCellAsString(2, i) == "〇");
  31. }
  32. List<string> list = null;
  33. for (int j = 0; j < Shop.category_name_list_.Count; j++)
  34. {
  35. if (Shop.category_name_list_[j].Key == cellAsString)
  36. {
  37. list = Shop.category_name_list_[j].Value;
  38. break;
  39. }
  40. }
  41. if (list == null)
  42. {
  43. list = new List<string>();
  44. Shop.category_name_list_.Add(new KeyValuePair<string, List<string>>(cellAsString, list));
  45. }
  46. bool flag = true;
  47. for (int k = 0; k < list.Count; k++)
  48. {
  49. if (list[k] == cellAsString2)
  50. {
  51. flag = false;
  52. break;
  53. }
  54. }
  55. if (flag)
  56. {
  57. list.Add(cellAsString2);
  58. }
  59. }
  60. }
  61. }
  62. }
  63. HashSet<int> hashSet = new HashSet<int>();
  64. CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "game_in_shop_itemlist", ref hashSet);
  65. using (AFileBase afileBase2 = GameUty.FileSystem.FileOpen("game_in_shop_item_setting.nei"))
  66. {
  67. using (CsvParser csvParser2 = new CsvParser())
  68. {
  69. bool condition2 = csvParser2.Open(afileBase2);
  70. NDebug.Assert(condition2, "game_in_shop_item_setting.nei\nopen failed.");
  71. for (int l = 1; l < csvParser2.max_cell_y; l++)
  72. {
  73. if (csvParser2.IsCellToExistData(0, l) && hashSet.Contains(csvParser2.GetCellAsInteger(0, l)))
  74. {
  75. Shop.ItemData itemData = new Shop.ItemData(csvParser2, l);
  76. Shop.item_data_dic_.Add(itemData.id, itemData);
  77. }
  78. }
  79. }
  80. }
  81. using (AFileBase afileBase3 = GameUty.FileSystem.FileOpen("game_in_shop_item_groups_setting.nei"))
  82. {
  83. using (CsvParser csvParser3 = new CsvParser())
  84. {
  85. bool condition3 = csvParser3.Open(afileBase3);
  86. NDebug.Assert(condition3, "game_in_shop_item_groups_setting.nei\nopen failed.");
  87. for (int m = 1; m < csvParser3.max_cell_y; m++)
  88. {
  89. if (csvParser3.IsCellToExistData(0, m) && hashSet.Contains(csvParser3.GetCellAsInteger(0, m)))
  90. {
  91. Shop.ItemDataGroup itemDataGroup = new Shop.ItemDataGroup(csvParser3, m);
  92. Shop.item_data_dic_.Add(itemDataGroup.id, itemDataGroup);
  93. Shop.item_data_group_dic_.Add(itemDataGroup.id, itemDataGroup);
  94. }
  95. }
  96. }
  97. }
  98. if (GameUty.FileSystem.IsExistentFile("game_in_shop_event_item_setting.nei"))
  99. {
  100. using (AFileBase afileBase4 = GameUty.FileSystem.FileOpen("game_in_shop_event_item_setting.nei"))
  101. {
  102. using (CsvParser csvParser4 = new CsvParser())
  103. {
  104. bool condition4 = csvParser4.Open(afileBase4);
  105. NDebug.Assert(condition4, "game_in_shop_event_item_setting.nei\nopen failed.");
  106. for (int n = 1; n < csvParser4.max_cell_y; n++)
  107. {
  108. if (csvParser4.IsCellToExistData(0, n) && hashSet.Contains(csvParser4.GetCellAsInteger(0, n)))
  109. {
  110. Shop.ItemDataEvent itemDataEvent = new Shop.ItemDataEvent(csvParser4, n);
  111. Shop.item_data_dic_.Add(itemDataEvent.id, itemDataEvent);
  112. }
  113. }
  114. }
  115. }
  116. }
  117. using (AFileBase afileBase5 = GameUty.FileSystem.FileOpen("game_in_shop_setcard_setting.nei"))
  118. {
  119. using (CsvParser csvParser5 = new CsvParser())
  120. {
  121. bool condition5 = csvParser5.Open(afileBase5);
  122. NDebug.Assert(condition5, "game_in_shop_setcard_setting.nei\nopen failed.");
  123. for (int num = 1; num < csvParser5.max_cell_y; num++)
  124. {
  125. if (csvParser5.IsCellToExistData(0, num))
  126. {
  127. int num2 = 0;
  128. string cellAsString3 = csvParser5.GetCellAsString(num2++, num);
  129. string[] array = cellAsString3.Split(new char[]
  130. {
  131. ','
  132. });
  133. for (int num3 = 0; num3 < array.Length; num3++)
  134. {
  135. array[num3] = array[num3].ToLower() + ".menu";
  136. }
  137. HashSet<int> hashSet2 = new HashSet<int>();
  138. while (num2 < csvParser5.max_cell_x)
  139. {
  140. if (!csvParser5.IsCellToExistData(num2, num))
  141. {
  142. break;
  143. }
  144. int num4 = int.Parse(csvParser5.GetCellAsString(num2, num));
  145. if (!Shop.item_data_dic_.ContainsKey(num4))
  146. {
  147. Debug.LogWarning("ショップアイテムID[" + num4 + "]は存在しません");
  148. hashSet2.Clear();
  149. break;
  150. }
  151. hashSet2.Add(num4);
  152. num2++;
  153. }
  154. if (0 < hashSet2.Count)
  155. {
  156. Shop.set_card_list_.Add(new KeyValuePair<string[], HashSet<int>>(array, hashSet2));
  157. }
  158. }
  159. }
  160. }
  161. }
  162. using (AFileBase afileBase6 = GameUty.FileSystem.FileOpen("game_in_shop_bg_setting.nei"))
  163. {
  164. using (CsvParser csvParser6 = new CsvParser())
  165. {
  166. bool condition6 = csvParser6.Open(afileBase6);
  167. NDebug.Assert(condition6, "game_in_shop_bg_setting.nei\nopen failed.");
  168. for (int num5 = 1; num5 < csvParser6.max_cell_y; num5++)
  169. {
  170. if (csvParser6.IsCellToExistData(0, num5))
  171. {
  172. Shop.BGData bgdata = new Shop.BGData(csvParser6, num5);
  173. NDebug.Assert(!Shop.bg_data_dic_.ContainsKey(bgdata.id), "ショップ背景設定id[" + bgdata.id + "]は重複しています");
  174. Shop.bg_data_dic_.Add(bgdata.id, bgdata);
  175. }
  176. }
  177. }
  178. }
  179. }
  180. public static void CheckClubGradeShopLineup(int clubGrade)
  181. {
  182. if (Shop.club_grade_datas_ == null)
  183. {
  184. Shop.club_grade_datas_ = new List<List<int>>();
  185. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("game_in_shop_clubgrade_setting.nei"))
  186. {
  187. using (CsvParser csvParser = new CsvParser())
  188. {
  189. bool condition = csvParser.Open(afileBase);
  190. NDebug.Assert(condition, "file open error[game_in_shop_clubgrade_setting.nei]");
  191. int num = 0;
  192. for (int i = 1; i < csvParser.max_cell_y; i++)
  193. {
  194. if (csvParser.IsCellToExistData(0, i))
  195. {
  196. List<int> list = new List<int>();
  197. int num2 = 1;
  198. string cellAsString = csvParser.GetCellAsString(num2++, i);
  199. if (!string.IsNullOrEmpty(cellAsString))
  200. {
  201. string[] array = cellAsString.Split(new char[]
  202. {
  203. ','
  204. });
  205. for (int j = 0; j < array.Length; j++)
  206. {
  207. list.Add(int.Parse(array[j].Trim()));
  208. }
  209. }
  210. Shop.club_grade_datas_.Add(list);
  211. num++;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. Status status = GameMain.Instance.CharacterMgr.status;
  218. for (int k = 0; k < clubGrade; k++)
  219. {
  220. for (int l = 0; l < Shop.club_grade_datas_[k].Count; l++)
  221. {
  222. int shopItemId = Shop.club_grade_datas_[k][l];
  223. status.AddShopLineup(shopItemId);
  224. }
  225. }
  226. }
  227. public static void CheckBuildingShopLineup()
  228. {
  229. if (Shop.building_datas_ == null)
  230. {
  231. Shop.building_datas_ = new List<KeyValuePair<List<int>, List<int>>>();
  232. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("game_in_shop_building_setting.nei"))
  233. {
  234. using (CsvParser csvParser = new CsvParser())
  235. {
  236. bool condition = csvParser.Open(afileBase);
  237. NDebug.Assert(condition, "file open error[game_in_shop_building_setting.nei]");
  238. int num = 0;
  239. for (int i = 1; i < csvParser.max_cell_y; i++)
  240. {
  241. if (csvParser.IsCellToExistData(0, i))
  242. {
  243. List<int> list = new List<int>();
  244. int num2 = 0;
  245. string cellAsString = csvParser.GetCellAsString(num2++, i);
  246. if (!string.IsNullOrEmpty(cellAsString))
  247. {
  248. string[] array = cellAsString.Split(new char[]
  249. {
  250. ','
  251. });
  252. for (int j = 0; j < array.Length; j++)
  253. {
  254. list.Add(int.Parse(array[j].Trim()));
  255. }
  256. }
  257. if (list.Count != 0)
  258. {
  259. List<int> list2 = new List<int>();
  260. string cellAsString2 = csvParser.GetCellAsString(num2++, i);
  261. if (!string.IsNullOrEmpty(cellAsString2))
  262. {
  263. string[] array2 = cellAsString2.Split(new char[]
  264. {
  265. ','
  266. });
  267. for (int k = 0; k < array2.Length; k++)
  268. {
  269. list2.Add(int.Parse(array2[k].Trim()));
  270. }
  271. }
  272. Shop.building_datas_.Add(new KeyValuePair<List<int>, List<int>>(list, list2));
  273. num++;
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  281. Status status = GameMain.Instance.CharacterMgr.status;
  282. foreach (KeyValuePair<List<int>, List<int>> keyValuePair in Shop.building_datas_)
  283. {
  284. List<int> key = keyValuePair.Key;
  285. List<int> value = keyValuePair.Value;
  286. bool flag = false;
  287. foreach (int facilityTypeID in key)
  288. {
  289. flag |= facilityMgr.IsFacilityBuildFlag(facilityTypeID);
  290. }
  291. if (flag)
  292. {
  293. foreach (int shopItemId in value)
  294. {
  295. status.AddShopLineup(shopItemId);
  296. }
  297. }
  298. }
  299. }
  300. public static void CheckGroupItemData()
  301. {
  302. Status status = GameMain.Instance.CharacterMgr.status;
  303. foreach (KeyValuePair<int, Shop.ItemDataGroup> keyValuePair in Shop.item_data_group_dic_)
  304. {
  305. if (!status.IsShopLineupItem(keyValuePair.Key))
  306. {
  307. List<int> need_id_list = keyValuePair.Value.need_id_list;
  308. bool flag = true;
  309. for (int i = 0; i < need_id_list.Count; i++)
  310. {
  311. if (!status.IsShopLineupItem(need_id_list[i]))
  312. {
  313. flag = false;
  314. break;
  315. }
  316. }
  317. if (flag)
  318. {
  319. status.AddShopLineup(keyValuePair.Key);
  320. }
  321. }
  322. }
  323. }
  324. public static void ResetEventItem(int item_id)
  325. {
  326. if (!Shop.item_data_dic_.ContainsKey(item_id) || Shop.item_data_dic_[item_id].type != Shop.ItemDataBase.Type.Event)
  327. {
  328. Debug.LogWarning("ショップアイテム[" + item_id + "]はイベントアイテムではありません");
  329. return;
  330. }
  331. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic_[item_id] as Shop.ItemDataEvent;
  332. if (itemDataEvent.is_have_item)
  333. {
  334. itemDataEvent.Reset();
  335. }
  336. }
  337. public static bool BuyEventItem(int item_id, bool free_buy)
  338. {
  339. if (!Shop.item_data_dic_.ContainsKey(item_id) || Shop.item_data_dic_[item_id].type != Shop.ItemDataBase.Type.Event)
  340. {
  341. Debug.LogWarning("ショップアイテム[" + item_id + "]はイベントアイテムではありません");
  342. return false;
  343. }
  344. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic_[item_id] as Shop.ItemDataEvent;
  345. if (itemDataEvent.is_have_item || !itemDataEvent.is_enabled_buy_item)
  346. {
  347. return false;
  348. }
  349. if (!free_buy)
  350. {
  351. long num = GameMain.Instance.CharacterMgr.status.money - (long)itemDataEvent.price;
  352. if (num < 0L)
  353. {
  354. return false;
  355. }
  356. GameMain.Instance.CharacterMgr.status.money += (long)(itemDataEvent.price * -1);
  357. }
  358. itemDataEvent.ExecBuy();
  359. return true;
  360. }
  361. public static Dictionary<int, Shop.ItemDataBase> item_data_dic
  362. {
  363. get
  364. {
  365. return Shop.item_data_dic_;
  366. }
  367. }
  368. public static Dictionary<int, Shop.ItemDataGroup> item_data_group_dic
  369. {
  370. get
  371. {
  372. return Shop.item_data_group_dic_;
  373. }
  374. }
  375. public static List<KeyValuePair<string, List<string>>> category_name_list
  376. {
  377. get
  378. {
  379. return Shop.category_name_list_;
  380. }
  381. }
  382. public static Dictionary<string, bool> sub_category_dressingbutton_enabled
  383. {
  384. get
  385. {
  386. return Shop.sub_category_dressingbutton_enabled_;
  387. }
  388. }
  389. public static List<KeyValuePair<string[], HashSet<int>>> set_card_list
  390. {
  391. get
  392. {
  393. return Shop.set_card_list_;
  394. }
  395. }
  396. public static Dictionary<int, Shop.BGData> bg_data_dic
  397. {
  398. get
  399. {
  400. return Shop.bg_data_dic_;
  401. }
  402. }
  403. private static Dictionary<int, Shop.ItemDataBase> item_data_dic_ = new Dictionary<int, Shop.ItemDataBase>();
  404. private static Dictionary<int, Shop.ItemDataGroup> item_data_group_dic_ = new Dictionary<int, Shop.ItemDataGroup>();
  405. private static List<KeyValuePair<string, List<string>>> category_name_list_ = new List<KeyValuePair<string, List<string>>>();
  406. private static Dictionary<string, bool> sub_category_dressingbutton_enabled_ = new Dictionary<string, bool>();
  407. private static List<KeyValuePair<string[], HashSet<int>>> set_card_list_ = new List<KeyValuePair<string[], HashSet<int>>>();
  408. private static Dictionary<int, Shop.BGData> bg_data_dic_ = new Dictionary<int, Shop.BGData>();
  409. private static List<List<int>> club_grade_datas_;
  410. private static List<KeyValuePair<List<int>, List<int>>> building_datas_;
  411. public abstract class ItemDataBase
  412. {
  413. public ItemDataBase(CsvParser csv, int line_y, bool is_event_item_csv)
  414. {
  415. int num = 0;
  416. this.id = csv.GetCellAsInteger(num++, line_y);
  417. this.valid_bg_id_list = new HashSet<int>();
  418. string[] array = csv.GetCellAsString(num++, line_y).Split(new char[]
  419. {
  420. ','
  421. });
  422. for (int i = 0; i < array.Length; i++)
  423. {
  424. this.valid_bg_id_list.Add(int.Parse(array[i]));
  425. }
  426. this.name = csv.GetCellAsString(num++, line_y);
  427. this.icon_file = csv.GetCellAsString(num++, line_y) + ".tex";
  428. this.detail_text = csv.GetCellAsString(num++, line_y);
  429. this.detail_text = this.detail_text.Replace("《改行》", "\n");
  430. if (!is_event_item_csv)
  431. {
  432. string cellAsString = csv.GetCellAsString(num++, line_y);
  433. if (!string.IsNullOrEmpty(cellAsString))
  434. {
  435. this.SetMaskMode((TBody.MaskMode)Enum.Parse(typeof(TBody.MaskMode), cellAsString));
  436. }
  437. else
  438. {
  439. this.SetMaskMode(TBody.MaskMode.None);
  440. }
  441. this.main_category = csv.GetCellAsString(num++, line_y);
  442. this.sub_category = csv.GetCellAsString(num++, line_y);
  443. }
  444. else
  445. {
  446. this.main_category = csv.GetCellAsString(num++, line_y);
  447. this.sub_category = csv.GetCellAsString(num++, line_y);
  448. }
  449. }
  450. public abstract int price { get; }
  451. public abstract string[] item_menu_array { get; }
  452. public abstract string[] trial_wear_item_menu_array { get; }
  453. public abstract bool is_have_item { get; }
  454. public abstract bool is_enabled_buy_item { get; }
  455. public abstract bool enabled_mask_mode { get; }
  456. public abstract TBody.MaskMode mask_mode { get; }
  457. public abstract Shop.ItemDataBase.Type type { get; }
  458. protected abstract void SetMaskMode(TBody.MaskMode setting_mask_mode);
  459. public readonly int id;
  460. public readonly HashSet<int> valid_bg_id_list;
  461. public readonly string name;
  462. public readonly string main_category;
  463. public readonly string sub_category;
  464. public readonly string detail_text;
  465. public readonly string icon_file;
  466. public enum Type
  467. {
  468. Parts,
  469. Event
  470. }
  471. }
  472. public class ItemData : Shop.ItemDataBase
  473. {
  474. public ItemData(CsvParser csv, int line_y) : base(csv, line_y, false)
  475. {
  476. int i = 8;
  477. this.price_ = csv.GetCellAsInteger(i++, line_y);
  478. List<string> list = new List<string>();
  479. while (i < csv.max_cell_x)
  480. {
  481. if (csv.IsCellToExistData(i, line_y))
  482. {
  483. string cellAsString = csv.GetCellAsString(i, line_y);
  484. if (!string.IsNullOrEmpty(cellAsString))
  485. {
  486. list.Add(cellAsString.ToLower() + ".menu");
  487. }
  488. }
  489. i++;
  490. }
  491. this.item_menu_array_ = list.ToArray();
  492. }
  493. public override int price
  494. {
  495. get
  496. {
  497. return this.price_;
  498. }
  499. }
  500. public override string[] item_menu_array
  501. {
  502. get
  503. {
  504. return this.item_menu_array_;
  505. }
  506. }
  507. public override string[] trial_wear_item_menu_array
  508. {
  509. get
  510. {
  511. return new string[]
  512. {
  513. this.item_menu_array_[0]
  514. };
  515. }
  516. }
  517. public override bool is_have_item
  518. {
  519. get
  520. {
  521. Status status = GameMain.Instance.CharacterMgr.status;
  522. return status.IsShopLineupItem(this.id) && status.shopLineups.Get(this.id) == ShopItemStatus.Purchased;
  523. }
  524. }
  525. public override bool is_enabled_buy_item
  526. {
  527. get
  528. {
  529. return true;
  530. }
  531. }
  532. public override bool enabled_mask_mode
  533. {
  534. get
  535. {
  536. return true;
  537. }
  538. }
  539. public override Shop.ItemDataBase.Type type
  540. {
  541. get
  542. {
  543. return Shop.ItemDataBase.Type.Parts;
  544. }
  545. }
  546. public override TBody.MaskMode mask_mode
  547. {
  548. get
  549. {
  550. return this.mask_mode_;
  551. }
  552. }
  553. protected override void SetMaskMode(TBody.MaskMode setting_mask_mode)
  554. {
  555. this.mask_mode_ = setting_mask_mode;
  556. }
  557. protected readonly int price_;
  558. protected readonly string[] item_menu_array_;
  559. protected TBody.MaskMode mask_mode_;
  560. }
  561. public class ItemDataGroup : Shop.ItemDataBase
  562. {
  563. public ItemDataGroup(CsvParser csv, int line_y) : base(csv, line_y, false)
  564. {
  565. for (int i = 8; i < csv.max_cell_x; i++)
  566. {
  567. if (csv.IsCellToExistData(i, line_y))
  568. {
  569. this.need_id_list_.Add(csv.GetCellAsInteger(i, line_y));
  570. }
  571. }
  572. }
  573. public override int price
  574. {
  575. get
  576. {
  577. List<Shop.ItemDataBase> notHaveItemData = this.GetNotHaveItemData();
  578. int num = 0;
  579. for (int i = 0; i < notHaveItemData.Count; i++)
  580. {
  581. num += notHaveItemData[i].price;
  582. }
  583. return num;
  584. }
  585. }
  586. public override string[] item_menu_array
  587. {
  588. get
  589. {
  590. List<Shop.ItemDataBase> notHaveItemData = this.GetNotHaveItemData();
  591. List<string> list = new List<string>();
  592. for (int i = 0; i < notHaveItemData.Count; i++)
  593. {
  594. string[] item_menu_array = notHaveItemData[i].item_menu_array;
  595. for (int j = 0; j < item_menu_array.Length; j++)
  596. {
  597. list.Add(item_menu_array[j]);
  598. }
  599. }
  600. return list.ToArray();
  601. }
  602. }
  603. public override string[] trial_wear_item_menu_array
  604. {
  605. get
  606. {
  607. Status status = GameMain.Instance.CharacterMgr.status;
  608. List<Shop.ItemDataBase> list = new List<Shop.ItemDataBase>();
  609. for (int i = 0; i < this.need_id_list_.Count; i++)
  610. {
  611. list.Add(Shop.item_data_dic[this.need_id_list_[i]]);
  612. }
  613. List<string> list2 = new List<string>();
  614. for (int j = 0; j < list.Count; j++)
  615. {
  616. string[] trial_wear_item_menu_array = list[j].trial_wear_item_menu_array;
  617. for (int k = 0; k < trial_wear_item_menu_array.Length; k++)
  618. {
  619. list2.Add(trial_wear_item_menu_array[k]);
  620. }
  621. }
  622. return list2.ToArray();
  623. }
  624. }
  625. public override bool is_have_item
  626. {
  627. get
  628. {
  629. Status status = GameMain.Instance.CharacterMgr.status;
  630. return status.IsShopLineupItem(this.id) && (status.shopLineups.Get(this.id) == ShopItemStatus.Purchased || this.GetNotHaveItemData().Count == 0);
  631. }
  632. }
  633. public override bool is_enabled_buy_item
  634. {
  635. get
  636. {
  637. return true;
  638. }
  639. }
  640. private List<Shop.ItemDataBase> GetNotHaveItemData()
  641. {
  642. Status status = GameMain.Instance.CharacterMgr.status;
  643. List<Shop.ItemDataBase> list = new List<Shop.ItemDataBase>();
  644. for (int i = 0; i < this.need_id_list_.Count; i++)
  645. {
  646. if (status.IsShopLineupItem(this.need_id_list_[i]) && status.shopLineups.Get(this.need_id_list_[i]) != ShopItemStatus.Purchased)
  647. {
  648. list.Add(Shop.item_data_dic[this.need_id_list_[i]]);
  649. }
  650. }
  651. return list;
  652. }
  653. public override bool enabled_mask_mode
  654. {
  655. get
  656. {
  657. return true;
  658. }
  659. }
  660. public override Shop.ItemDataBase.Type type
  661. {
  662. get
  663. {
  664. return Shop.ItemDataBase.Type.Parts;
  665. }
  666. }
  667. public override TBody.MaskMode mask_mode
  668. {
  669. get
  670. {
  671. return this.mask_mode_;
  672. }
  673. }
  674. public List<int> need_id_list
  675. {
  676. get
  677. {
  678. return this.need_id_list_;
  679. }
  680. }
  681. protected override void SetMaskMode(TBody.MaskMode setting_mask_mode)
  682. {
  683. this.mask_mode_ = setting_mask_mode;
  684. }
  685. private List<int> need_id_list_ = new List<int>();
  686. private TBody.MaskMode mask_mode_;
  687. }
  688. public class ItemDataEvent : Shop.ItemDataBase
  689. {
  690. public ItemDataEvent(CsvParser csv, int line_y) : base(csv, line_y, true)
  691. {
  692. int cell_x = 7;
  693. this.price_ = csv.GetCellAsInteger(cell_x++, line_y);
  694. this.target_flag_name_ = csv.GetCellAsString(cell_x++, line_y);
  695. string cellAsString = csv.GetCellAsString(cell_x++, line_y);
  696. if (!string.IsNullOrEmpty(cellAsString))
  697. {
  698. string[] array = cellAsString.Split(new char[]
  699. {
  700. ','
  701. });
  702. foreach (string s in array)
  703. {
  704. int num = int.Parse(s);
  705. if (!this.overlap_check_id_list_.Contains(num) && this.id != num)
  706. {
  707. this.overlap_check_id_list_.Add(num);
  708. }
  709. }
  710. }
  711. while (csv.IsCellToExistData(cell_x, line_y))
  712. {
  713. cellAsString = csv.GetCellAsString(cell_x++, line_y);
  714. this.free_text_list_.Add(cellAsString);
  715. }
  716. }
  717. public void ExecBuy()
  718. {
  719. GameMain.Instance.CharacterMgr.status.AddHaveItem(this.target_flag_name_);
  720. }
  721. public void Reset()
  722. {
  723. GameMain.Instance.CharacterMgr.status.RemoveHaveItem(this.target_flag_name_);
  724. }
  725. public override int price
  726. {
  727. get
  728. {
  729. return this.price_;
  730. }
  731. }
  732. public override string[] item_menu_array
  733. {
  734. get
  735. {
  736. return this.dummy_array_;
  737. }
  738. }
  739. public override string[] trial_wear_item_menu_array
  740. {
  741. get
  742. {
  743. return this.dummy_array_;
  744. }
  745. }
  746. public override bool is_have_item
  747. {
  748. get
  749. {
  750. return GameMain.Instance.CharacterMgr.status.IsHaveItem(this.target_flag_name_);
  751. }
  752. }
  753. public override bool is_enabled_buy_item
  754. {
  755. get
  756. {
  757. foreach (int key in this.overlap_check_id_list_)
  758. {
  759. if (Shop.item_data_dic.ContainsKey(key))
  760. {
  761. if (Shop.item_data_dic[key].is_have_item)
  762. {
  763. return false;
  764. }
  765. }
  766. }
  767. return true;
  768. }
  769. }
  770. public override bool enabled_mask_mode
  771. {
  772. get
  773. {
  774. return false;
  775. }
  776. }
  777. public override TBody.MaskMode mask_mode
  778. {
  779. get
  780. {
  781. return TBody.MaskMode.None;
  782. }
  783. }
  784. protected override void SetMaskMode(TBody.MaskMode setting_mask_mode)
  785. {
  786. }
  787. public override Shop.ItemDataBase.Type type
  788. {
  789. get
  790. {
  791. return Shop.ItemDataBase.Type.Event;
  792. }
  793. }
  794. public string target_flag_name
  795. {
  796. get
  797. {
  798. return this.target_flag_name_;
  799. }
  800. }
  801. public List<string> free_text
  802. {
  803. get
  804. {
  805. return this.free_text_list_;
  806. }
  807. }
  808. private int price_;
  809. private string target_flag_name_;
  810. private HashSet<int> overlap_check_id_list_ = new HashSet<int>();
  811. private string[] dummy_array_ = new string[0];
  812. private List<string> free_text_list_ = new List<string>();
  813. }
  814. public class BGData
  815. {
  816. public BGData(CsvParser csv, int line_y)
  817. {
  818. int num = 0;
  819. this.id = csv.GetCellAsInteger(num++, line_y);
  820. this.bg_prefab_name = csv.GetCellAsString(num++, line_y);
  821. this.use_stage_data = null;
  822. string cellAsString = csv.GetCellAsString(num++, line_y);
  823. if (!string.IsNullOrEmpty(cellAsString) && YotogiStage.IsEnabled(cellAsString))
  824. {
  825. this.use_stage_data = YotogiStage.GetData(cellAsString);
  826. }
  827. this.plya_bgm_name = csv.GetCellAsString(num++, line_y);
  828. if (string.IsNullOrEmpty(Path.GetExtension(this.plya_bgm_name)))
  829. {
  830. this.plya_bgm_name += ".ogg";
  831. }
  832. }
  833. public void ChangeBg(Maid maid)
  834. {
  835. GameMain.Instance.BgMgr.ChangeBg(this.bg_prefab_name);
  836. YotogiSkillSelectWaitMotion.ApplyEnvSetting(maid, this.use_stage_data);
  837. }
  838. public void PlayBGM(float fade_time = 0.5f)
  839. {
  840. GameMain.Instance.SoundMgr.PlayBGM(this.plya_bgm_name, fade_time, true);
  841. }
  842. public readonly int id;
  843. public readonly YotogiStage.Data use_stage_data;
  844. public readonly string bg_prefab_name;
  845. public readonly string plya_bgm_name;
  846. }
  847. }