123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- 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<string> list = new List<string>();
- 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<int, string> keyValuePair in this.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic)
- {
- if (!EmpireLifeModeAPI.GetEnabledPersonalListOfRecollection().Contains(keyValuePair.Value))
- {
- this.m_IsAllEnabledPersonal = false;
- break;
- }
- }
- }
- public static List<FreeModeItemLifeMode> CreateItemList(bool displayableOnly = true)
- {
- FreeModeItemLifeMode.CreateCsvData();
- if (displayableOnly)
- {
- return new List<FreeModeItemLifeMode>(from data in FreeModeItemLifeMode.m_DataDic.Values
- where data.IsDisplayable
- select data);
- }
- return new List<FreeModeItemLifeMode>(FreeModeItemLifeMode.m_DataDic.Values);
- }
- private static void CreateCsvData()
- {
- if (FreeModeItemLifeMode.m_DataDic != null)
- {
- return;
- }
- FreeModeItemLifeMode.m_DataDic = new Dictionary<int, FreeModeItemLifeMode>();
- HashSet<int> 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<Maid> lifeModeAllMaidList = GameMain.Instance.LifeModeMgr.lifeModeAllMaidList;
- using (Dictionary<int, string>.Enumerator enumerator = this.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- KeyValuePair<int, string> 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<int, FreeModeItemLifeMode> m_DataDic;
- private const string STR_MSG = "ライフモード回想";
- }
|