using System; using System.Collections.Generic; using System.Linq; public class FreeModeItemLifeMode : AbstractFreeModeItem { private FreeModeItemLifeMode(CsvParser csv, int y) { int num = 0; this.m_ID = csv.GetCellAsInteger(num++, y); this.m_LifeModeDataID = csv.GetCellAsInteger(num++, y); this.m_Title = csv.GetCellAsString(num++, y); this.m_PlayFileName = csv.GetCellAsString(num++, y); this.m_Text = csv.GetCellAsString(num++, y); List list = new List(); while (num < csv.max_cell_x && csv.IsCellToExistData(num, y)) { list.Add(csv.GetCellAsString(num++, y)); } this.m_ConditionTexts = list.ToArray(); NDebug.Assert(EmpireLifeModeData.Contains(this.m_LifeModeDataID), "ライフモード回想\n項目「ライフモードID」の値が不正です。\nこのIDに対応するライフモードの表データが存在しません。\n値:" + this.m_LifeModeDataID.ToString()); this.m_LifeModeData = EmpireLifeModeData.GetData(this.m_LifeModeDataID); this.m_IsAllEnabledPersonal = true; foreach (KeyValuePair keyValuePair in this.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic) { if (!EmpireLifeModeAPI.GetEnabledPersonalListOfRecollection().Contains(keyValuePair.Value)) { this.m_IsAllEnabledPersonal = false; break; } } if (this.m_IsAllEnabledPersonal && !this.m_LifeModeData.IsCorrectPersonalGP002()) { this.m_IsAllEnabledPersonal = false; } } public static List CreateItemList(bool displayableOnly = true) { FreeModeItemLifeMode.CreateCsvData(); if (displayableOnly) { return new List(from data in FreeModeItemLifeMode.m_DataDic.Values where data.IsDisplayable select data); } return new List(FreeModeItemLifeMode.m_DataDic.Values); } private static void CreateCsvData() { if (FreeModeItemLifeMode.m_DataDic != null) { return; } FreeModeItemLifeMode.m_DataDic = new Dictionary(); HashSet enabledIdList = AbstractFreeModeItem.GetEnabledIdList(); if (enabledIdList == null || enabledIdList.Count <= 0) { return; } string text = "recollection_life_mode.nei"; NDebug.Assert(GameUty.FileSystem.IsExistentFile(text), text + "\nopen failed."); using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text)) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { if (csvParser.IsCellToExistData(0, i)) { int cellAsInteger = csvParser.GetCellAsInteger(0, i); if (enabledIdList.Contains(cellAsInteger)) { FreeModeItemLifeMode freeModeItemLifeMode = new FreeModeItemLifeMode(csvParser, i); if (freeModeItemLifeMode.m_IsAllEnabledPersonal) { FreeModeItemLifeMode.m_DataDic.Add(cellAsInteger, freeModeItemLifeMode); } } } } } } } public override string title { get { return this.m_Title; } } public override string titleTerm { get { return "SceneFreeModeSelect/タイトル/" + this.m_Title; } } public override int item_id { get { return this.m_ID; } } public override string text { get { return this.m_Text; } } public override string textTerm { get { return "SceneFreeModeSelect/説明/" + this.m_Text; } } public override string[] condition_texts { get { return this.m_ConditionTexts; } } public override string[] condition_text_terms { get { string[] array = new string[this.m_ConditionTexts.Length]; for (int i = 0; i < array.Length; i++) { array[i] = "SceneFreeModeSelect/条件文/" + this.m_ConditionTexts[i]; } return array; } } public override bool is_enabled { get { if (GameMain.Instance.LifeModeMgr.GetScenarioExecuteCount(this.m_LifeModeData.ID) <= 0) { return false; } List lifeModeAllMaidList = GameMain.Instance.LifeModeMgr.lifeModeAllMaidList; using (Dictionary.Enumerator enumerator = this.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair personalSlotPair = enumerator.Current; if (!lifeModeAllMaidList.Any((Maid maid) => maid.status.personal.uniqueName == personalSlotPair.Value)) { return false; } } } return true; } } public override string play_file_name { get { return this.m_PlayFileName; } } public override AbstractFreeModeItem.ItemType type { get { return AbstractFreeModeItem.ItemType.LifeMode; } } public bool IsDisplayable { get { return this.m_IsAllEnabledPersonal && this.m_LifeModeData.IsCorrectNTRBlock(); } } public readonly EmpireLifeModeData.Data m_LifeModeData; private readonly int m_ID; private readonly int m_LifeModeDataID; private readonly string m_Title; private readonly string m_PlayFileName; private readonly string m_Text; private readonly string[] m_ConditionTexts; public readonly bool m_IsAllEnabledPersonal; private static Dictionary m_DataDic; private const string STR_MSG = "ライフモード回想"; }