123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- 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 abstract bool is_enabled { get; }
- public abstract string play_file_name { get; }
- public abstract AbstractFreeModeItem.ItemType type { get; }
- protected static HashSet<int> GetEnabledIdList()
- {
- if (AbstractFreeModeItem.enabled_id_list_ != null)
- {
- return AbstractFreeModeItem.enabled_id_list_;
- }
- AbstractFreeModeItem.enabled_id_list_ = new HashSet<int>();
- AbstractFreeModeItem.enabled_id_list_ = AbstractFreeModeItem.ReadIdList(false);
- return AbstractFreeModeItem.enabled_id_list_;
- }
- protected static HashSet<int> GetEnabledOldIdList()
- {
- if (AbstractFreeModeItem.enabledOld_id_list_ != null)
- {
- return AbstractFreeModeItem.enabledOld_id_list_;
- }
- AbstractFreeModeItem.enabledOld_id_list_ = new HashSet<int>();
- AbstractFreeModeItem.enabledOld_id_list_ = AbstractFreeModeItem.ReadIdList(true);
- return AbstractFreeModeItem.enabledOld_id_list_;
- }
- protected static HashSet<int> ReadIdList(bool useOld)
- {
- HashSet<int> enabled_id_list = new HashSet<int>();
- AFileSystemBase fileSystemBase;
- if (useOld)
- {
- fileSystemBase = GameUty.FileSystemOld;
- }
- else
- {
- fileSystemBase = GameUty.FileSystem;
- }
- Func<string, bool> 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<string> 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<int> enabled_id_list_;
- private static HashSet<int> enabledOld_id_list_;
- public enum ItemType
- {
- MainStory,
- Vip,
- Normal
- }
- public enum GameMode
- {
- CM3D2,
- COM3D
- }
- }
|