FreeModeItemVip.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 text
  53. {
  54. get
  55. {
  56. return this.vip_data_.information;
  57. }
  58. }
  59. public override string[] condition_texts
  60. {
  61. get
  62. {
  63. return this.vip_data_.condInfo.ToArray();
  64. }
  65. }
  66. public override bool is_enabled
  67. {
  68. get
  69. {
  70. return this.is_enabled_;
  71. }
  72. }
  73. public override string play_file_name
  74. {
  75. get
  76. {
  77. return this.file_name_;
  78. }
  79. }
  80. public override AbstractFreeModeItem.ItemType type
  81. {
  82. get
  83. {
  84. return AbstractFreeModeItem.ItemType.Vip;
  85. }
  86. }
  87. public ScheduleCSVData.Yotogi vip_data
  88. {
  89. get
  90. {
  91. return this.vip_data_;
  92. }
  93. }
  94. private static void CreateCsvData()
  95. {
  96. if (FreeModeItemVip.vip_data_dic_ != null)
  97. {
  98. return;
  99. }
  100. FreeModeItemVip.vip_data_dic_ = new SortedDictionary<int, ScheduleCSVData.Yotogi>();
  101. FreeModeItemVip.personal_enabled_dic_ = new Dictionary<Personal.Data, HashSet<int>>();
  102. FreeModeItemVip.vip_data_filename_dic_ = new SortedDictionary<int, string>();
  103. FreeModeItemVip.vip_subherioin_dic_ = new SortedDictionary<int, int>();
  104. foreach (Personal.Data key in Personal.GetAllDatas(false))
  105. {
  106. FreeModeItemVip.personal_enabled_dic_.Add(key, new HashSet<int>());
  107. }
  108. FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.COM3D);
  109. if (GameUty.IsEnabledCompatibilityMode)
  110. {
  111. FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.CM3D2);
  112. }
  113. }
  114. private static void CreateCsvData(AbstractFreeModeItem.GameMode gameMode)
  115. {
  116. AFileBase afileBase = null;
  117. if (gameMode == AbstractFreeModeItem.GameMode.CM3D2)
  118. {
  119. afileBase = GameUty.FileSystemOld.FileOpen("recollection_vip2.nei");
  120. NDebug.Assert(GameUty.FileSystemOld.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed.");
  121. }
  122. else if (gameMode == AbstractFreeModeItem.GameMode.COM3D)
  123. {
  124. afileBase = GameUty.FileSystem.FileOpen("recollection_vip2.nei");
  125. NDebug.Assert(GameUty.FileSystem.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed.");
  126. }
  127. using (afileBase)
  128. {
  129. using (CsvParser csvParser = new CsvParser())
  130. {
  131. bool condition = csvParser.Open(afileBase);
  132. NDebug.Assert(condition, "recollection_vip2.nei\nopen failed.");
  133. for (int i = 1; i < csvParser.max_cell_y; i++)
  134. {
  135. if (csvParser.IsCellToExistData(0, i))
  136. {
  137. int cellAsInteger = csvParser.GetCellAsInteger(0, i);
  138. int cellAsInteger2 = csvParser.GetCellAsInteger(1, i);
  139. if (ScheduleCSVData.AllData.ContainsKey(cellAsInteger2))
  140. {
  141. NDebug.Assert(ScheduleCSVData.AllData.ContainsKey(cellAsInteger2), "夜仕事VIPの[" + cellAsInteger2 + "]を見つけられませんでした");
  142. NDebug.Assert(!FreeModeItemVip.vip_data_dic_.ContainsKey(cellAsInteger), "ユニークIDの[" + cellAsInteger + "]が重複しています");
  143. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[cellAsInteger2];
  144. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
  145. {
  146. FreeModeItemVip.vip_data_dic_.Add(cellAsInteger, (ScheduleCSVData.Yotogi)scheduleBase);
  147. FreeModeItemVip.vip_data_filename_dic_.Add(cellAsInteger, csvParser.GetCellAsString(2, i));
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. }
  155. private static SortedDictionary<int, ScheduleCSVData.Yotogi> vip_data_dic_;
  156. private static SortedDictionary<int, string> vip_data_filename_dic_;
  157. private static SortedDictionary<int, int> vip_subherioin_dic_;
  158. private bool is_enabled_;
  159. private int item_id_;
  160. private string file_name_;
  161. private int subheroin_id_;
  162. private ScheduleCSVData.Yotogi vip_data_;
  163. private static Dictionary<Personal.Data, HashSet<int>> personal_enabled_dic_;
  164. }