Shop.cs 23 KB

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