FreeModeItemVip.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using PlayerStatus;
  5. using Schedule;
  6. using wf;
  7. public class FreeModeItemVip : AbstractFreeModeItem
  8. {
  9. private FreeModeItemVip(int item_id, MaidStatus.Status maidStatus)
  10. {
  11. this.item_id_ = item_id;
  12. this.vip_data_ = FreeModeItemVip.vip_data_dic_[this.item_id_];
  13. this.file_name_ = FreeModeItemVip.vip_data_filename_dic_[this.item_id_];
  14. if (FreeModeItemVip.vip_subherioin_dic_.ContainsKey(item_id))
  15. {
  16. this.subheroin_id_ = FreeModeItemVip.vip_subherioin_dic_[this.item_id_];
  17. }
  18. ReadOnlyDictionary<int, NightWorkState> night_works_state_dic = GameMain.Instance.CharacterMgr.status.night_works_state_dic;
  19. this.is_enabled_ = false;
  20. if (night_works_state_dic.ContainsKey(this.vip_data_.id) && night_works_state_dic[this.vip_data_.id].finish)
  21. {
  22. this.is_enabled_ = true;
  23. }
  24. }
  25. public static List<FreeModeItemVip> CreateItemVipList(MaidStatus.Status maidStatus)
  26. {
  27. FreeModeItemVip.CreateCsvData();
  28. List<FreeModeItemVip> list = new List<FreeModeItemVip>();
  29. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in FreeModeItemVip.vip_data_dic_)
  30. {
  31. if (!DailyMgr.IsLegacy || !ScheduleCSVData.WorkLegacyDisableId.Contains(keyValuePair.Value.id))
  32. {
  33. list.Add(new FreeModeItemVip(keyValuePair.Key, maidStatus));
  34. }
  35. }
  36. return list;
  37. }
  38. public override int item_id
  39. {
  40. get
  41. {
  42. return this.item_id_;
  43. }
  44. }
  45. public override string title
  46. {
  47. get
  48. {
  49. return this.vip_data_.name;
  50. }
  51. }
  52. public override string titleTerm
  53. {
  54. get
  55. {
  56. return "SceneDaily/スケジュール/項目/" + this.vip_data_.name;
  57. }
  58. }
  59. public override string text
  60. {
  61. get
  62. {
  63. return this.vip_data_.information;
  64. }
  65. }
  66. public override string textTerm
  67. {
  68. get
  69. {
  70. return "SceneDaily/スケジュール/条件文/" + this.vip_data_.name;
  71. }
  72. }
  73. public override string[] condition_texts
  74. {
  75. get
  76. {
  77. return this.vip_data_.condInfo.ToArray();
  78. }
  79. }
  80. public override string[] condition_text_terms
  81. {
  82. get
  83. {
  84. List<string> list = new List<string>();
  85. foreach (string str in this.vip_data_.condInfo)
  86. {
  87. list.Add("SceneDaily/スケジュール/条件文/" + str);
  88. }
  89. return list.ToArray();
  90. }
  91. }
  92. public override bool is_enabled
  93. {
  94. get
  95. {
  96. return this.is_enabled_;
  97. }
  98. }
  99. public override string play_file_name
  100. {
  101. get
  102. {
  103. return this.file_name_;
  104. }
  105. }
  106. public override AbstractFreeModeItem.ItemType type
  107. {
  108. get
  109. {
  110. return AbstractFreeModeItem.ItemType.Vip;
  111. }
  112. }
  113. public ScheduleCSVData.Yotogi vip_data
  114. {
  115. get
  116. {
  117. return this.vip_data_;
  118. }
  119. }
  120. private static void CreateCsvData()
  121. {
  122. if (FreeModeItemVip.vip_data_dic_ != null)
  123. {
  124. return;
  125. }
  126. FreeModeItemVip.vip_data_dic_ = new SortedDictionary<int, ScheduleCSVData.Yotogi>();
  127. FreeModeItemVip.personal_enabled_dic_ = new Dictionary<Personal.Data, HashSet<int>>();
  128. FreeModeItemVip.vip_data_filename_dic_ = new SortedDictionary<int, string>();
  129. FreeModeItemVip.vip_subherioin_dic_ = new SortedDictionary<int, int>();
  130. foreach (Personal.Data key in Personal.GetAllDatas(false))
  131. {
  132. FreeModeItemVip.personal_enabled_dic_.Add(key, new HashSet<int>());
  133. }
  134. FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.COM3D);
  135. if (GameUty.IsEnabledCompatibilityMode)
  136. {
  137. FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.CM3D2);
  138. }
  139. }
  140. private static void CreateCsvData(AbstractFreeModeItem.GameMode gameMode)
  141. {
  142. AFileBase afileBase = null;
  143. if (gameMode == AbstractFreeModeItem.GameMode.CM3D2)
  144. {
  145. afileBase = GameUty.FileSystemOld.FileOpen("recollection_vip2.nei");
  146. NDebug.Assert(GameUty.FileSystemOld.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed.");
  147. }
  148. else if (gameMode == AbstractFreeModeItem.GameMode.COM3D)
  149. {
  150. afileBase = GameUty.FileSystem.FileOpen("recollection_vip2.nei");
  151. NDebug.Assert(GameUty.FileSystem.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed.");
  152. }
  153. using (afileBase)
  154. {
  155. using (CsvParser csvParser = new CsvParser())
  156. {
  157. bool condition = csvParser.Open(afileBase);
  158. NDebug.Assert(condition, "recollection_vip2.nei\nopen failed.");
  159. for (int i = 1; i < csvParser.max_cell_y; i++)
  160. {
  161. if (csvParser.IsCellToExistData(0, i))
  162. {
  163. int cellAsInteger = csvParser.GetCellAsInteger(0, i);
  164. int cellAsInteger2 = csvParser.GetCellAsInteger(1, i);
  165. if (ScheduleCSVData.AllData.ContainsKey(cellAsInteger2))
  166. {
  167. NDebug.Assert(ScheduleCSVData.AllData.ContainsKey(cellAsInteger2), "夜仕事VIPの[" + cellAsInteger2 + "]を見つけられませんでした");
  168. NDebug.Assert(!FreeModeItemVip.vip_data_dic_.ContainsKey(cellAsInteger), "ユニークIDの[" + cellAsInteger + "]が重複しています");
  169. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[cellAsInteger2];
  170. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
  171. {
  172. FreeModeItemVip.vip_data_dic_.Add(cellAsInteger, (ScheduleCSVData.Yotogi)scheduleBase);
  173. FreeModeItemVip.vip_data_filename_dic_.Add(cellAsInteger, csvParser.GetCellAsString(2, i));
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. private static SortedDictionary<int, ScheduleCSVData.Yotogi> vip_data_dic_;
  182. private static SortedDictionary<int, string> vip_data_filename_dic_;
  183. private static SortedDictionary<int, int> vip_subherioin_dic_;
  184. private bool is_enabled_;
  185. private int item_id_;
  186. private string file_name_;
  187. private int subheroin_id_;
  188. private ScheduleCSVData.Yotogi vip_data_;
  189. private static Dictionary<Personal.Data, HashSet<int>> personal_enabled_dic_;
  190. }