PhotoMaidItemData.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class PhotoMaidItemData
  6. {
  7. private PhotoMaidItemData()
  8. {
  9. }
  10. public static void Create()
  11. {
  12. if (PhotoMaidItemData.item_data_data_ != null)
  13. {
  14. return;
  15. }
  16. PhotoMaidItemData.category_mpn_dic_.Clear();
  17. PhotoMaidItemData.category_mpn_dic_["右手"] = MPN.handitem;
  18. PhotoMaidItemData.category_mpn_dic_["左手"] = MPN.seieki_naka;
  19. PhotoMaidItemData.category_mpn_dic_["上半身"] = MPN.kousoku_upper;
  20. PhotoMaidItemData.category_mpn_dic_["下半身"] = MPN.kousoku_lower;
  21. PhotoMaidItemData.category_mpn_dic_["前穴"] = MPN.accvag;
  22. PhotoMaidItemData.category_mpn_dic_["後穴"] = MPN.accanl;
  23. PhotoMaidItemData.item_data_data_ = new List<PhotoMaidItemData>();
  24. HashSet<int> hashSet = new HashSet<int>();
  25. CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "phot_maid_item_enabled_list", ref hashSet);
  26. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_maid_item_list.nei"))
  27. {
  28. using (CsvParser csvParser = new CsvParser())
  29. {
  30. bool condition = csvParser.Open(afileBase);
  31. NDebug.Assert(condition, "phot_maid_item_list.nei\nopen failed.");
  32. for (int i = 1; i < csvParser.max_cell_y; i++)
  33. {
  34. if (csvParser.IsCellToExistData(0, i) && hashSet.Contains(csvParser.GetCellAsInteger(0, i)))
  35. {
  36. int num = 0;
  37. PhotoMaidItemData photoMaidItemData = new PhotoMaidItemData();
  38. photoMaidItemData.id = (long)csvParser.GetCellAsInteger(num++, i);
  39. photoMaidItemData.category = csvParser.GetCellAsString(num++, i);
  40. photoMaidItemData.name = csvParser.GetCellAsString(num++, i);
  41. photoMaidItemData.call_name = csvParser.GetCellAsString(num++, i);
  42. if (!string.IsNullOrEmpty(photoMaidItemData.call_name))
  43. {
  44. PhotoMaidItemData photoMaidItemData2 = photoMaidItemData;
  45. photoMaidItemData2.call_name += ".menu";
  46. }
  47. photoMaidItemData.init_item = (0 <= photoMaidItemData.call_name.IndexOf("_del"));
  48. string cellAsString = csvParser.GetCellAsString(num++, i);
  49. if (string.IsNullOrEmpty(cellAsString) || PluginData.IsEnabled(cellAsString))
  50. {
  51. PhotoMaidItemData.item_data_data_.Add(photoMaidItemData);
  52. }
  53. }
  54. }
  55. }
  56. }
  57. PhotoMaidItemData.category_list_ = new Dictionary<string, List<PhotoMaidItemData>>();
  58. PhotoMaidItemData.popup_menu_list_ = new List<KeyValuePair<string, UnityEngine.Object>>();
  59. HashSet<string> hashSet2 = new HashSet<string>();
  60. List<PhotoMaidItemData> data = PhotoMaidItemData.data;
  61. for (int j = 0; j < data.Count; j++)
  62. {
  63. if (!PhotoMaidItemData.category_list_.ContainsKey(data[j].category))
  64. {
  65. PhotoMaidItemData.category_list_.Add(data[j].category, new List<PhotoMaidItemData>());
  66. }
  67. PhotoMaidItemData.category_list_[data[j].category].Add(data[j]);
  68. if (!hashSet2.Contains(data[j].category))
  69. {
  70. PhotoMaidItemData.popup_menu_list_.Add(new KeyValuePair<string, UnityEngine.Object>(data[j].category, null));
  71. hashSet2.Add(data[j].category);
  72. }
  73. }
  74. }
  75. public static List<PhotoMaidItemData> data
  76. {
  77. get
  78. {
  79. return PhotoMaidItemData.item_data_data_;
  80. }
  81. }
  82. public static Dictionary<string, List<PhotoMaidItemData>> category_list
  83. {
  84. get
  85. {
  86. return PhotoMaidItemData.category_list_;
  87. }
  88. }
  89. public static List<KeyValuePair<string, UnityEngine.Object>> popup_category_list
  90. {
  91. get
  92. {
  93. return PhotoMaidItemData.popup_menu_list_;
  94. }
  95. }
  96. public static PhotoMaidItemData Get(long id)
  97. {
  98. for (int i = 0; i < PhotoMaidItemData.item_data_data_.Count; i++)
  99. {
  100. if (PhotoMaidItemData.item_data_data_[i].id == id)
  101. {
  102. return PhotoMaidItemData.item_data_data_[i];
  103. }
  104. }
  105. return null;
  106. }
  107. public static void Clear(Maid maid)
  108. {
  109. for (int i = 0; i < PhotoMaidItemData.item_data_data_.Count; i++)
  110. {
  111. if (PhotoMaidItemData.item_data_data_[i].init_item)
  112. {
  113. maid.SetProp(PhotoMaidItemData.category_mpn_dic_[PhotoMaidItemData.item_data_data_[i].category], PhotoMaidItemData.item_data_data_[i].call_name, 0, true, false);
  114. }
  115. }
  116. }
  117. public void Apply(Maid maid)
  118. {
  119. maid.SetProp(PhotoMaidItemData.category_mpn_dic_[this.category], this.call_name, 0, true, false);
  120. maid.AllProcProp();
  121. }
  122. public long id;
  123. public string category;
  124. public string name;
  125. public string call_name;
  126. public bool init_item;
  127. private static Dictionary<string, MPN> category_mpn_dic_ = new Dictionary<string, MPN>();
  128. private static List<PhotoMaidItemData> item_data_data_;
  129. private static Dictionary<string, List<PhotoMaidItemData>> category_list_;
  130. private static List<KeyValuePair<string, UnityEngine.Object>> popup_menu_list_;
  131. }