using System; using System.Collections.Generic; using MaidStatus; using PlayerStatus; using Schedule; using wf; public class FreeModeItemVip : AbstractFreeModeItem { private FreeModeItemVip(int item_id, MaidStatus.Status maidStatus) { this.item_id_ = item_id; this.vip_data_ = FreeModeItemVip.vip_data_dic_[this.item_id_]; this.file_name_ = FreeModeItemVip.vip_data_filename_dic_[this.item_id_]; if (FreeModeItemVip.vip_subherioin_dic_.ContainsKey(item_id)) { this.subheroin_id_ = FreeModeItemVip.vip_subherioin_dic_[this.item_id_]; } ReadOnlyDictionary night_works_state_dic = GameMain.Instance.CharacterMgr.status.night_works_state_dic; this.is_enabled_ = false; if (night_works_state_dic.ContainsKey(this.vip_data_.id) && night_works_state_dic[this.vip_data_.id].finish) { this.is_enabled_ = true; } } public static List CreateItemVipList(MaidStatus.Status maidStatus) { FreeModeItemVip.CreateCsvData(); List list = new List(); foreach (KeyValuePair keyValuePair in FreeModeItemVip.vip_data_dic_) { if (!DailyMgr.IsLegacy || !ScheduleCSVData.WorkLegacyDisableId.Contains(keyValuePair.Value.id)) { list.Add(new FreeModeItemVip(keyValuePair.Key, maidStatus)); } } return list; } public override int item_id { get { return this.item_id_; } } public override string title { get { return this.vip_data_.name; } } public override string text { get { return this.vip_data_.information; } } public override string[] condition_texts { get { return this.vip_data_.condInfo.ToArray(); } } public override bool is_enabled { get { return this.is_enabled_; } } public override string play_file_name { get { return this.file_name_; } } public override AbstractFreeModeItem.ItemType type { get { return AbstractFreeModeItem.ItemType.Vip; } } public ScheduleCSVData.Yotogi vip_data { get { return this.vip_data_; } } private static void CreateCsvData() { if (FreeModeItemVip.vip_data_dic_ != null) { return; } FreeModeItemVip.vip_data_dic_ = new SortedDictionary(); FreeModeItemVip.personal_enabled_dic_ = new Dictionary>(); FreeModeItemVip.vip_data_filename_dic_ = new SortedDictionary(); FreeModeItemVip.vip_subherioin_dic_ = new SortedDictionary(); foreach (Personal.Data key in Personal.GetAllDatas(false)) { FreeModeItemVip.personal_enabled_dic_.Add(key, new HashSet()); } FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.COM3D); if (GameUty.IsEnabledCompatibilityMode) { FreeModeItemVip.CreateCsvData(AbstractFreeModeItem.GameMode.CM3D2); } } private static void CreateCsvData(AbstractFreeModeItem.GameMode gameMode) { AFileBase afileBase = null; if (gameMode == AbstractFreeModeItem.GameMode.CM3D2) { afileBase = GameUty.FileSystemOld.FileOpen("recollection_vip2.nei"); NDebug.Assert(GameUty.FileSystemOld.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed."); } else if (gameMode == AbstractFreeModeItem.GameMode.COM3D) { afileBase = GameUty.FileSystem.FileOpen("recollection_vip2.nei"); NDebug.Assert(GameUty.FileSystem.IsExistentFile("recollection_vip2.nei"), "recollection_vip2.nei\nopen failed."); } using (afileBase) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, "recollection_vip2.nei\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { if (csvParser.IsCellToExistData(0, i)) { int cellAsInteger = csvParser.GetCellAsInteger(0, i); int cellAsInteger2 = csvParser.GetCellAsInteger(1, i); if (ScheduleCSVData.AllData.ContainsKey(cellAsInteger2)) { NDebug.Assert(ScheduleCSVData.AllData.ContainsKey(cellAsInteger2), "夜仕事VIPの[" + cellAsInteger2 + "]を見つけられませんでした"); NDebug.Assert(!FreeModeItemVip.vip_data_dic_.ContainsKey(cellAsInteger), "ユニークIDの[" + cellAsInteger + "]が重複しています"); ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[cellAsInteger2]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi) { FreeModeItemVip.vip_data_dic_.Add(cellAsInteger, (ScheduleCSVData.Yotogi)scheduleBase); FreeModeItemVip.vip_data_filename_dic_.Add(cellAsInteger, csvParser.GetCellAsString(2, i)); } } } } } } } private static SortedDictionary vip_data_dic_; private static SortedDictionary vip_data_filename_dic_; private static SortedDictionary vip_subherioin_dic_; private bool is_enabled_; private int item_id_; private string file_name_; private int subheroin_id_; private ScheduleCSVData.Yotogi vip_data_; private static Dictionary> personal_enabled_dic_; }