using System; using System.Collections.Generic; public abstract class AbstractFreeModeItem { public abstract string title { get; } public abstract string titleTerm { get; } public abstract int item_id { get; } public abstract string text { get; } public abstract string textTerm { get; } public abstract string[] condition_texts { get; } public abstract string[] condition_text_terms { get; } public virtual bool isEnabled(Maid maid) { return this.is_enabled; } public abstract string play_file_name { get; } public abstract AbstractFreeModeItem.ItemType type { get; } protected abstract bool is_enabled { get; } protected static HashSet GetEnabledIdList() { if (AbstractFreeModeItem.enabled_id_list_ != null) { return AbstractFreeModeItem.enabled_id_list_; } AbstractFreeModeItem.enabled_id_list_ = new HashSet(); AbstractFreeModeItem.enabled_id_list_ = AbstractFreeModeItem.ReadIdList(false); return AbstractFreeModeItem.enabled_id_list_; } protected static HashSet GetEnabledOldIdList() { if (AbstractFreeModeItem.enabledOld_id_list_ != null) { return AbstractFreeModeItem.enabledOld_id_list_; } AbstractFreeModeItem.enabledOld_id_list_ = new HashSet(); AbstractFreeModeItem.enabledOld_id_list_ = AbstractFreeModeItem.ReadIdList(true); return AbstractFreeModeItem.enabledOld_id_list_; } protected static HashSet ReadIdList(bool useOld) { HashSet enabled_id_list = new HashSet(); AFileSystemBase fileSystemBase; if (useOld) { fileSystemBase = GameUty.FileSystemOld; } else { fileSystemBase = GameUty.FileSystem; } Func func = delegate(string file_name) { file_name += ".nei"; if (!fileSystemBase.IsExistentFile(file_name)) { return false; } using (AFileBase afileBase = fileSystemBase.FileOpen(file_name)) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, file_name + "\nopen failed."); for (int j = 1; j < csvParser.max_cell_y; j++) { if (csvParser.IsCellToExistData(0, j)) { int cellAsInteger = csvParser.GetCellAsInteger(0, j); if (!enabled_id_list.Contains(cellAsInteger)) { enabled_id_list.Add(cellAsInteger); } } } } } return true; }; List list; if (useOld) { list = GameUty.PathListOld; } else { list = GameUty.PathList; } if (func("recollection_enabled_id_list")) { for (int i = 0; i < list.Count; i++) { func("recollection_enabled_id_list_" + list[i]); } } return enabled_id_list; } public static bool EmptyEnableList(bool useOld) { if (useOld) { AbstractFreeModeItem.GetEnabledOldIdList(); if (AbstractFreeModeItem.enabledOld_id_list_ == null || AbstractFreeModeItem.enabledOld_id_list_.Count == 0) { return false; } } else { AbstractFreeModeItem.GetEnabledIdList(); if (AbstractFreeModeItem.enabled_id_list_ == null || AbstractFreeModeItem.enabled_id_list_.Count == 0) { return false; } } return true; } private static HashSet enabled_id_list_; private static HashSet enabledOld_id_list_; public enum ItemType { MainStory, Vip, Normal, LifeMode } public enum GameMode { CM3D2, COM3D } }