using System; using System.Collections; using System.Collections.Generic; using System.IO; using MaidStatus; using wf; public static class EmpireLifeModeData { public static int Count { get { EmpireLifeModeData.CreateData(); return EmpireLifeModeData.commonIdManager.idMap.Count; } } public static bool Contains(int id) { EmpireLifeModeData.CreateData(); return EmpireLifeModeData.commonIdManager.idMap.ContainsKey(id); } public static int uniqueNameToId(string name) { EmpireLifeModeData.CreateData(); NDebug.Assert(EmpireLifeModeData.commonIdManager.nameMap.ContainsKey(name), "エンパイアライフモード.csv\nユニーク名[" + name + "]をIDに変換できませんでした"); return EmpireLifeModeData.commonIdManager.nameMap[name]; } public static string IdToUniqueName(int id) { EmpireLifeModeData.CreateData(); NDebug.Assert(EmpireLifeModeData.commonIdManager.idMap.ContainsKey(id), "エンパイアライフモード.csv\nID[" + id + "]をユニーク名に変換できませんでした"); return EmpireLifeModeData.commonIdManager.idMap[id].Key; } public static EmpireLifeModeData.Data GetData(int id) { EmpireLifeModeData.CreateData(); NDebug.Assert(EmpireLifeModeData.basicDatas.ContainsKey(id), "エンパイアライフモード.csv\nID[" + id + "]のデータは存在しません"); return EmpireLifeModeData.basicDatas[id]; } public static EmpireLifeModeData.Data GetData(string uniqueName) { return EmpireLifeModeData.GetData(EmpireLifeModeData.uniqueNameToId(uniqueName)); } public static bool IsEnabled(int id) { EmpireLifeModeData.CreateData(); return EmpireLifeModeData.commonIdManager.enabledIdList.Contains(id); } public static bool IsEnabled(string uniqueName) { EmpireLifeModeData.CreateData(); return EmpireLifeModeData.commonIdManager.enabledIdList.Contains(EmpireLifeModeData.uniqueNameToId(uniqueName)); } public static List GetAllDatas(bool onlyEnabled) { EmpireLifeModeData.CreateData(); List list = new List(); foreach (KeyValuePair> keyValuePair in EmpireLifeModeData.commonIdManager.idMap) { if (!onlyEnabled || EmpireLifeModeData.commonIdManager.enabledIdList.Contains(keyValuePair.Key)) { list.Add(EmpireLifeModeData.basicDatas[keyValuePair.Key]); } } return list; } public static List GetDatas(Func customCheckFunction, bool isOnlyEnabled = true) { EmpireLifeModeData.CreateData(); List list = new List(); foreach (KeyValuePair> keyValuePair in EmpireLifeModeData.commonIdManager.idMap) { if (!isOnlyEnabled || EmpireLifeModeData.commonIdManager.enabledIdList.Contains(keyValuePair.Key)) { EmpireLifeModeData.Data data = EmpireLifeModeData.basicDatas[keyValuePair.Key]; if (customCheckFunction(data)) { list.Add(data); } } } return list; } public static void CreateData() { if (EmpireLifeModeData.commonIdManager != null) { return; } EmpireLifeModeData.commonIdManager = new CsvCommonIdManager("empire_life_mode", "エンパイアライフモード.csv", CsvCommonIdManager.Type.IdAndUniqueName, null); EmpireLifeModeData.basicDatas = new Dictionary(); string[] array = new string[] { "list" }; KeyValuePair[] array2 = new KeyValuePair[array.Length]; for (int i = 0; i < array2.Length; i++) { string text = "empire_life_mode_" + array[i] + ".nei"; AFileBase afileBase = GameUty.FileSystem.FileOpen(text); CsvParser csvParser = new CsvParser(); bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); array2[i] = new KeyValuePair(afileBase, csvParser); } foreach (KeyValuePair> keyValuePair in EmpireLifeModeData.commonIdManager.idMap) { int key = keyValuePair.Key; EmpireLifeModeData.Data value = new EmpireLifeModeData.Data(key, array2[0].Value); EmpireLifeModeData.basicDatas.Add(key, value); } foreach (KeyValuePair keyValuePair2 in array2) { keyValuePair2.Value.Dispose(); keyValuePair2.Key.Dispose(); } } public static void Clear() { if (EmpireLifeModeData.commonIdManager != null) { EmpireLifeModeData.commonIdManager = null; } } private const string csvTopCommonName = "empire_life_mode"; private const string typeNameForErrorLog = "エンパイアライフモード.csv"; private static CsvCommonIdManager commonIdManager; private static Dictionary basicDatas; public enum ScenarioType { 一般, 汎用, スト\u30FCリ\u30FC, Hシ\u30FCン, セクハラ } public class Data { public Data(int uniqueID, CsvParser csv) { for (int i = 1; i < csv.max_cell_y; i++) { if (csv.IsCellToExistData(0, i) && csv.GetCellAsInteger(0, i) == uniqueID) { string text = (i + 1).ToString() + "行目"; int num = 1; this.ID = uniqueID; this.strUniqueName = csv.GetCellAsString(num++, i); this.rawDataScenarioType = csv.GetCellAsString(num++, i); this.rawDataScenarioAnyNumberPlay = csv.GetCellAsString(num++, i); this.rawDataScenarioFileName = csv.GetCellAsString(num++, i); this.rawDataScenarioFileLabel = csv.GetCellAsString(num++, i); this.rawDataNTRBlock = csv.GetCellAsString(num++, i); this.rawDataFacilityUniqueName = csv.GetCellAsString(num++, i); this.rawDataFacilityCostumeChange = csv.GetCellAsString(num++, i); this.rawDataTimeZone = csv.GetCellAsString(num++, i); this.rawDataFlagPlayer = csv.GetCellAsString(num++, i); this.rawDataFlagMaid = csv.GetCellAsString(num++, i); this.rawDataMaidPersonalTypeSlot0 = csv.GetCellAsString(num++, i); this.rawDataMaidPersonalTypeSlot1 = csv.GetCellAsString(num++, i); this.rawDataMaidPersonalTypeSlot2 = csv.GetCellAsString(num++, i); this.rawDataMaidMainCharaOnly = csv.GetCellAsString(num++, i); this.rawDataMaidContract = csv.GetCellAsString(num++, i); this.rawDataMaidRelation = csv.GetCellAsString(num++, i); this.rawDataMaidStatus = csv.GetCellAsString(num++, i); this.rawDataMaidSeikeikenNoNo = csv.GetCellAsString(num++, i); this.rawDataMaidSeikeikenYesNo = csv.GetCellAsString(num++, i); this.rawDataMaidSeikeikenNoYes = csv.GetCellAsString(num++, i); this.rawDataMaidSeikeikenYesYes = csv.GetCellAsString(num++, i); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataScenarioType), "エンパイアライフモード.csv\n項目「種類」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataScenarioAnyNumberPlay), "エンパイアライフモード.csv\n項目「何度でも再生できるか」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataScenarioFileName), "エンパイアライフモード.csv\n項目「シナリオファイル」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataFacilityUniqueName), "エンパイアライフモード.csv\n項目「施設」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataFacilityCostumeChange), "エンパイアライフモード.csv\n項目「施設コスチュームの適用」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataMaidPersonalTypeSlot0 + this.rawDataMaidPersonalTypeSlot1 + this.rawDataMaidPersonalTypeSlot2), "エンパイアライフモード.csv\n項目「メイド性格」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataMaidSeikeikenNoNo), "エンパイアライフモード.csv\n項目「経験無し」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataMaidSeikeikenYesNo), "エンパイアライフモード.csv\n項目「前穴」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataMaidSeikeikenNoYes), "エンパイアライフモード.csv\n項目「後ろ穴」が指定されていません。\n\n表:" + text); NDebug.Assert(!string.IsNullOrEmpty(this.rawDataMaidSeikeikenYesYes), "エンパイアライフモード.csv\n項目「両方」が指定されていません。\n\n表:" + text); try { this.dataScenarioType = (EmpireLifeModeData.ScenarioType)Enum.Parse(typeof(EmpireLifeModeData.ScenarioType), this.rawDataScenarioType); } catch (Exception ex) { NDebug.Assert("エンパイアライフモード.csv\n項目「種類」の変換に失敗しました。\n\n表:" + text + "\n値:" + this.rawDataScenarioType, false); } if (this.rawDataScenarioAnyNumberPlay == "○" || this.rawDataScenarioAnyNumberPlay == "◯") { this.dataScenarioAnyNumberPlay = true; } else if (this.rawDataScenarioAnyNumberPlay == "×") { this.dataScenarioAnyNumberPlay = false; } else { NDebug.Assert("エンパイアライフモード.csv\n項目「何度でも再生できるか」に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataScenarioAnyNumberPlay, false); } this.dataScenarioFileName = Path.ChangeExtension(this.rawDataScenarioFileName, ".ks"); if (string.IsNullOrEmpty(this.rawDataScenarioFileLabel)) { this.dataScenarioFileLabel = "*top"; } else { this.dataScenarioFileLabel = ((this.rawDataScenarioFileLabel.IndexOf("*") >= 0) ? this.rawDataScenarioFileLabel : ("*" + this.rawDataScenarioFileLabel)); } if (string.IsNullOrEmpty(this.rawDataNTRBlock)) { this.dataNTRBlock = null; } else if (this.rawDataNTRBlock == "○" || this.rawDataNTRBlock == "◯") { this.dataNTRBlock = new bool?(true); } else if (this.rawDataNTRBlock == "×") { this.dataNTRBlock = new bool?(false); } else { NDebug.Assert("エンパイアライフモード.csv\n項目「NTRブロック」の値に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataNTRBlock, false); } this.dataFacilityUniqueNameArray = this.rawDataFacilityUniqueName.Split(new char[] { ',' }); for (int j = 0; j < this.dataFacilityUniqueNameArray.Length; j++) { string text2 = this.dataFacilityUniqueNameArray[j] = this.dataFacilityUniqueNameArray[j].Trim(); NDebug.Assert(FacilityDataTable.GetFacilityDefaultData(text2, true) != null, "エンパイアライフモード.csv\n項目「施設」の値「" + text2 + "」は正しくない情報です。\n\n表:" + text); } if (this.rawDataFacilityCostumeChange == "○" || this.rawDataFacilityCostumeChange == "◯") { this.dataFacilityCostumeChange = true; } else if (this.rawDataFacilityCostumeChange == "×") { this.dataFacilityCostumeChange = false; } else { NDebug.Assert("エンパイアライフモード.csv\n項目「施設コスチュームの適用」の値に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataFacilityCostumeChange, false); } if (string.IsNullOrEmpty(this.rawDataTimeZone)) { this.dataTimeZone = null; } else if (this.rawDataTimeZone == "昼") { this.dataTimeZone = new ScheduleMgr.ScheduleTime?(ScheduleMgr.ScheduleTime.DayTime); } else if (this.rawDataTimeZone == "夜") { this.dataTimeZone = new ScheduleMgr.ScheduleTime?(ScheduleMgr.ScheduleTime.Night); } else { NDebug.Assert("エンパイアライフモード.csv\n項目「時間帯」の値に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataTimeZone, false); } if (string.IsNullOrEmpty(this.rawDataFlagPlayer)) { this.dataFlagPlayer = null; } else { this.dataFlagPlayer = new Dictionary(); foreach (string text3 in this.rawDataFlagPlayer.Split(new char[] { ',' })) { string[] array2 = text3.Split(new char[] { ':' }); NDebug.Assert(array2.Length == 2, "エンパイアライフモード.csv\n項目「プレイヤーフラグ」の書式に問題がありました。\n\n表:" + text + "\n値:" + text3); NDebug.Assert(!this.dataFlagPlayer.ContainsKey(array2[0]), "エンパイアライフモード.csv\n項目「プレイヤーフラグ」で、フラグ名が重複しました。\n\n表:" + text + "\nフラグ名:" + array2[0]); int value; if (!int.TryParse(array2[1], out value)) { NDebug.Assert("エンパイアライフモード.csv\n項目「プレイヤーフラグ」で、フラグの値を整数値に変換できませんでした。\n\n表:" + text + "\n値: " + text3, false); } this.dataFlagPlayer.Add(array2[0], value); } } if (string.IsNullOrEmpty(this.rawDataFlagMaid)) { this.dataFlagMaid = null; } else { this.dataFlagMaid = new Dictionary(); foreach (string text4 in this.rawDataFlagMaid.Split(new char[] { ',' })) { string[] array4 = text4.Split(new char[] { ':' }); NDebug.Assert(array4.Length == 2, "エンパイアライフモード.csv\n項目「メイドフラグ」の書式に問題がありました。\n\n表:" + text + "\n値:" + text4); NDebug.Assert(!this.dataFlagMaid.ContainsKey(array4[0]), "エンパイアライフモード.csv\n項目「メイドフラグ」で、フラグ名が重複しました。\n\n表:" + text + "\nフラグ名:" + array4[0]); int value2; if (!int.TryParse(array4[1], out value2)) { NDebug.Assert("エンパイアライフモード.csv\n項目「メイドフラグ」で、フラグの値を整数値に変換できませんでした。\n\n表:" + text + "\n値: " + text4, false); } this.dataFlagMaid.Add(array4[0], value2); } } this.dataMaidPersonalUniqueNameAndActiveSlotDic = new Dictionary(); if (!string.IsNullOrEmpty(this.rawDataMaidPersonalTypeSlot0)) { string value3; if (!EmpireLifeModeData.Data.personalUniqueNameDic.TryGetValue(this.rawDataMaidPersonalTypeSlot0, out value3)) { NDebug.Assert("エンパイアライフモード.csv\n項目「メイド性格」の値で、性格ユニーク名への変換に失敗しました。\n\n表:" + text + "\n値:" + this.rawDataMaidPersonalTypeSlot0, false); } this.dataMaidPersonalUniqueNameAndActiveSlotDic.Add(0, value3); } if (!string.IsNullOrEmpty(this.rawDataMaidPersonalTypeSlot1)) { string value4; if (!EmpireLifeModeData.Data.personalUniqueNameDic.TryGetValue(this.rawDataMaidPersonalTypeSlot1, out value4)) { NDebug.Assert("エンパイアライフモード.csv\n項目「メイド性格」の値で、性格ユニーク名への変換に失敗しました。\n\n表:" + text + "\n値:" + this.rawDataMaidPersonalTypeSlot1, false); } this.dataMaidPersonalUniqueNameAndActiveSlotDic.Add(1, value4); } if (!string.IsNullOrEmpty(this.rawDataMaidPersonalTypeSlot2)) { string value5; if (!EmpireLifeModeData.Data.personalUniqueNameDic.TryGetValue(this.rawDataMaidPersonalTypeSlot2, out value5)) { NDebug.Assert("エンパイアライフモード.csv\n項目「メイド性格」の値で、性格ユニーク名への変換に失敗しました。\n\n表:" + text + "\n値:" + this.rawDataMaidPersonalTypeSlot2, false); } this.dataMaidPersonalUniqueNameAndActiveSlotDic.Add(2, value5); } if (string.IsNullOrEmpty(this.rawDataMaidMainCharaOnly)) { this.dataMaidMainCharaOnly = null; } else if (this.rawDataMaidMainCharaOnly == "○" || this.rawDataMaidMainCharaOnly == "◯") { this.dataMaidMainCharaOnly = new bool?(true); } else if (this.rawDataMaidMainCharaOnly == "×") { this.dataMaidMainCharaOnly = new bool?(false); } else { NDebug.Assert(string.Concat(new object[] { "エンパイアライフモード.csv\n項目「初期メイドフラグ」の値に、想定外の文字が入りました。\n\n表:", text, "\n値:", this.dataMaidMainCharaOnly }), false); } if (string.IsNullOrEmpty(this.rawDataMaidContract)) { this.dataMaidContract = null; } else { Contract value6; if (!EmpireLifeModeData.Data.contractTypeDic.TryGetValue(this.rawDataMaidContract, out value6)) { NDebug.Assert("エンパイアライフモード.csv\n項目「契約状態」の値に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataMaidContract, false); } this.dataMaidContract = new Contract?(value6); } if (string.IsNullOrEmpty(this.rawDataMaidRelation)) { this.dataMaidRelation = null; } else { Relation value7; if (!EmpireLifeModeData.Data.relationTypeDic.TryGetValue(this.rawDataMaidRelation, out value7)) { NDebug.Assert("エンパイアライフモード.csv\n項目「関係状態」の値に、想定外の文字が入りました。\n\n表:" + text + "\n値:" + this.rawDataMaidRelation, false); } this.dataMaidRelation = new Relation?(value7); } if (string.IsNullOrEmpty(this.rawDataMaidStatus)) { this.dataMaidStatus = null; } else { this.dataMaidStatus = new ParametersPack(); this.dataMaidStatus.Parse(this.rawDataMaidStatus.Replace(':', '='), ','); } List list = new List(); if (this.rawDataMaidSeikeikenNoNo == "○" || this.rawDataMaidSeikeikenNoNo == "◯") { list.Add(Seikeiken.No_No); } if (this.rawDataMaidSeikeikenYesNo == "○" || this.rawDataMaidSeikeikenYesNo == "◯") { list.Add(Seikeiken.Yes_No); } if (this.rawDataMaidSeikeikenNoYes == "○" || this.rawDataMaidSeikeikenNoYes == "◯") { list.Add(Seikeiken.No_Yes); } if (this.rawDataMaidSeikeikenYesYes == "○" || this.rawDataMaidSeikeikenYesYes == "◯") { list.Add(Seikeiken.Yes_Yes); } this.dataMaidSeikeiken = list.ToArray(); break; } } } private static Dictionary personalUniqueNameDic { get { if (EmpireLifeModeData.Data.m_PersonalUniqueNameDic == null) { EmpireLifeModeData.Data.m_PersonalUniqueNameDic = new Dictionary(); foreach (Personal.Data data in Personal.GetAllDatas(false)) { EmpireLifeModeData.Data.m_PersonalUniqueNameDic.Add(data.drawName, data.uniqueName); } } return EmpireLifeModeData.Data.m_PersonalUniqueNameDic; } } private static Dictionary contractTypeDic { get { if (EmpireLifeModeData.Data.m_ContractTypeDic == null) { EmpireLifeModeData.Data.m_ContractTypeDic = new Dictionary(); IEnumerator enumerator = Enum.GetValues(typeof(Contract)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Contract contract = (Contract)obj; string @string = EnumConvert.GetString(contract); EmpireLifeModeData.Data.m_ContractTypeDic.Add(@string, contract); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } return EmpireLifeModeData.Data.m_ContractTypeDic; } } private static Dictionary relationTypeDic { get { if (EmpireLifeModeData.Data.m_RelationTypeDic == null) { EmpireLifeModeData.Data.m_RelationTypeDic = new Dictionary(); IEnumerator enumerator = Enum.GetValues(typeof(Relation)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Relation relation = (Relation)obj; string @string = EnumConvert.GetString(relation); EmpireLifeModeData.Data.m_RelationTypeDic.Add(@string, relation); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } return EmpireLifeModeData.Data.m_RelationTypeDic; } } public static List personalUniqueNameEnabledList { get { if (EmpireLifeModeData.Data.m_PersonalUniqueNameEnabledList == null) { EmpireLifeModeData.Data.m_PersonalUniqueNameEnabledList = new List(); List allDatas = EmpireLifeModeData.GetAllDatas(true); int count = allDatas.Count; for (int i = 0; i < count; i++) { using (Dictionary.ValueCollection.Enumerator enumerator = allDatas[i].dataMaidPersonalUniqueNameAndActiveSlotDic.Values.GetEnumerator()) { while (enumerator.MoveNext()) { if (!EmpireLifeModeData.Data.m_PersonalUniqueNameEnabledList.Contains(enumerator.Current)) { EmpireLifeModeData.Data.m_PersonalUniqueNameEnabledList.Add(enumerator.Current); } } } } } return EmpireLifeModeData.Data.m_PersonalUniqueNameEnabledList; } } public readonly int ID; public readonly string strUniqueName; public readonly string rawDataScenarioType; public readonly string rawDataScenarioAnyNumberPlay; public readonly string rawDataScenarioFileName; public readonly string rawDataScenarioFileLabel; public readonly string rawDataNTRBlock; public readonly string rawDataFacilityUniqueName; public readonly string rawDataFacilityCostumeChange; public readonly string rawDataTimeZone; public readonly string rawDataFlagPlayer; public readonly string rawDataFlagMaid; public readonly string rawDataMaidPersonalTypeSlot0; public readonly string rawDataMaidPersonalTypeSlot1; public readonly string rawDataMaidPersonalTypeSlot2; public readonly string rawDataMaidMainCharaOnly; public readonly string rawDataMaidContract; public readonly string rawDataMaidRelation; public readonly string rawDataMaidStatus; public readonly string rawDataMaidSeikeikenNoNo; public readonly string rawDataMaidSeikeikenYesNo; public readonly string rawDataMaidSeikeikenNoYes; public readonly string rawDataMaidSeikeikenYesYes; public readonly EmpireLifeModeData.ScenarioType dataScenarioType; public readonly bool dataScenarioAnyNumberPlay; public readonly string dataScenarioFileName; public readonly string dataScenarioFileLabel; public readonly bool? dataNTRBlock; public readonly string[] dataFacilityUniqueNameArray; public readonly bool dataFacilityCostumeChange; public readonly ScheduleMgr.ScheduleTime? dataTimeZone; public readonly Dictionary dataFlagPlayer; public readonly Dictionary dataFlagMaid; public readonly Dictionary dataMaidPersonalUniqueNameAndActiveSlotDic; public readonly bool? dataMaidMainCharaOnly; public readonly Contract? dataMaidContract; public readonly Relation? dataMaidRelation; public readonly ParametersPack dataMaidStatus; public readonly Seikeiken[] dataMaidSeikeiken; private static Dictionary m_PersonalUniqueNameDic; private static Dictionary m_ContractTypeDic; private static Dictionary m_RelationTypeDic; private static List m_PersonalUniqueNameEnabledList; } }