using System; using System.Collections.Generic; using MaidStatus; using UnityEngine; using wf; public static class EmpireLifeModeAPI { public static int GetPriorityScenarioType(EmpireLifeModeData.ScenarioType scenarioType) { return EmpireLifeModeAPI.m_ScenarioTypePriorityDic[scenarioType]; } private static void CreateScenarioTypeIconDic() { if (EmpireLifeModeAPI.m_ScenarioTypeIconDic != null && EmpireLifeModeAPI.m_ScenarioTypeIconDic.Count > 0) { return; } EmpireLifeModeAPI.m_ScenarioTypeIconDic = new Dictionary(); Func func = delegate(string strFileName) { if (!string.IsNullOrEmpty(strFileName) && GameUty.FileSystem.IsExistentFile(strFileName + ".tex")) { return ImportCM.CreateTexture(strFileName + ".tex"); } return null; }; EmpireLifeModeAPI.m_ScenarioTypeIconDic.Add(EmpireLifeModeData.ScenarioType.一般, func("life_icon02_exclamation")); EmpireLifeModeAPI.m_ScenarioTypeIconDic.Add(EmpireLifeModeData.ScenarioType.汎用, null); EmpireLifeModeAPI.m_ScenarioTypeIconDic.Add(EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC, func("life_icon01_ster")); EmpireLifeModeAPI.m_ScenarioTypeIconDic.Add(EmpireLifeModeData.ScenarioType.Hシ\u30FCン, func("life_icon03_heart")); EmpireLifeModeAPI.m_ScenarioTypeIconDic.Add(EmpireLifeModeData.ScenarioType.セクハラ, func("life_icon03_heart")); } public static Texture2D GetIconScenarioType(EmpireLifeModeData.ScenarioType scenarioType) { EmpireLifeModeAPI.CreateScenarioTypeIconDic(); return EmpireLifeModeAPI.m_ScenarioTypeIconDic[scenarioType]; } public static void DestroyScenarioTypeIconDic() { if (EmpireLifeModeAPI.m_ScenarioTypeIconDic == null) { return; } Dictionary.ValueCollection values = EmpireLifeModeAPI.m_ScenarioTypeIconDic.Values; using (Dictionary.ValueCollection.Enumerator enumerator = values.GetEnumerator()) { while (enumerator.MoveNext()) { if (enumerator.Current != null) { UnityEngine.Object.DestroyImmediate(enumerator.Current); } } } EmpireLifeModeAPI.m_ScenarioTypeIconDic.Clear(); } public static List GetEnabledFacilityUniqueNameList() { if (EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList == null || EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Count <= 0) { EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList = new List(); foreach (EmpireLifeModeData.Data data in EmpireLifeModeData.GetAllDatas(true)) { foreach (string item in data.dataFacilityUniqueNameArray) { if (!EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Contains(item)) { EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Add(item); } } } } return new List(EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList); } public static List GetEnabledFacilityList() { List enabledFacilityUniqueNameList = EmpireLifeModeAPI.GetEnabledFacilityUniqueNameList(); List list = new List(); foreach (Facility facility in GameMain.Instance.FacilityMgr.GetFacilityArray()) { if (!(facility == null)) { if (enabledFacilityUniqueNameList.Contains(facility.defaultData.name)) { list.Add(facility); } } } return list; } public static int GetMaxMaidCount() { int num = 0; int num2 = 0; foreach (Facility facility in EmpireLifeModeAPI.GetEnabledFacilityList()) { FacilityDataTable.FacilityDefaultData defaultData = facility.defaultData; if (defaultData.isDefaultPlace) { num++; } else { num2++; } } return num * 2 + num2 + 2 * (num2 / 5) + 2 * (num2 / 10) + num2 / 10; } public static List SelectionMaidList(IEnumerable maidList) { List list = new List(); foreach (Maid maid in maidList) { if (!(maid == null)) { if (maid.status.heroineType != HeroineType.Sub) { if (EmpireLifeModeData.Data.personalUniqueNameEnabledList.Contains(maid.status.personal.uniqueName)) { list.Add(maid); } } } } return list; } public static List GetEnabledPersonalListOfRecollection() { List list = new List(); foreach (Personal.Data data in Personal.GetAllDatas(true)) { string uniqueName = data.uniqueName; if (data.oldPersonal) { if (uniqueName == "Pure" || uniqueName == "Cool" || uniqueName == "Pride") { if (GameMain.Instance.CharacterMgr.status.isAvailableTransfer) { list.Add(uniqueName); } } else if (data.single) { list.Add(uniqueName); } else if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path) && data.compatible) { list.Add(uniqueName); } } else { list.Add(uniqueName); } } return list; } public static int GetPriorityScenarioType(this EmpireLifeModeData.Data data) { return EmpireLifeModeAPI.GetPriorityScenarioType(data.dataScenarioType); } public static List GetCorrectMaidList(this EmpireLifeModeData.Data data, IEnumerable maidList) { List list = new List(); foreach (Maid maid in maidList) { if (data.IsCorrectMaid(maid)) { list.Add(maid); } } return list; } public static List GetCorrectFacilityList(this EmpireLifeModeData.Data data) { List list = new List(); foreach (Facility facility in EmpireLifeModeAPI.GetEnabledFacilityList()) { foreach (string b in data.dataFacilityUniqueNameArray) { if (facility.defaultData.name == b) { list.Add(facility); break; } } } return list; } public static bool IsCorrectMaid(this EmpireLifeModeData.Data data, Maid maid) { return data.IsCorrectMaidMainCharaOnly(maid) && data.IsCorrectMaidSeikeiken(maid) && data.IsCorrectMaidPersonalType(maid) && data.IsCorrectMaidFlag(maid) && data.IsCorrectMaidStatus(maid) && data.IsCorrectMaidExecuteCount(maid) && data.IsCorrectMaidContract(maid) && data.IsCorrectMaidRelation(maid); } public static bool IsCorrectUniqueComparisonObject(this EmpireLifeModeData.Data data) { return data.IsCorrectNTRBlock() && data.IsCorrectTimeZone() && data.IsCorrectPlayerFlag() && data.IsCorrectScenarioAnyNumberPlay(); } public static bool IsCorrectScenarioType(this EmpireLifeModeData.Data data, EmpireLifeModeData.ScenarioType scenarioType) { return data.dataScenarioType == scenarioType; } public static bool IsCorrectScenarioAnyNumberPlay(this EmpireLifeModeData.Data data) { return data.dataScenarioAnyNumberPlay || 0 >= GameMain.Instance.LifeModeMgr.GetScenarioExecuteCount(data.ID); } public static bool IsCorrectNTRBlock(this EmpireLifeModeData.Data data) { return data.IsCorrectNTRBlock(GameMain.Instance.CharacterMgr.status.lockNTRPlay); } public static bool IsCorrectNTRBlock(this EmpireLifeModeData.Data data, bool NowNTRBlockingFlag) { if (data.dataNTRBlock == null) { return true; } if (NowNTRBlockingFlag) { return data.dataNTRBlock.Value; } return !data.dataNTRBlock.Value; } public static bool IsCorrectFacility(this EmpireLifeModeData.Data data, string facilityUniqueName) { foreach (string a in data.dataFacilityUniqueNameArray) { if (a == facilityUniqueName) { return true; } } return false; } public static bool IsCorrectTimeZone(this EmpireLifeModeData.Data data) { if (data.dataTimeZone == null) { return true; } ScheduleMgr.ScheduleTime nowTimeZone = (!GameMain.Instance.CharacterMgr.status.isDaytime) ? ScheduleMgr.ScheduleTime.Night : ScheduleMgr.ScheduleTime.DayTime; return data.IsCorrectTimeZone(nowTimeZone); } public static bool IsCorrectTimeZone(this EmpireLifeModeData.Data data, ScheduleMgr.ScheduleTime nowTimeZone) { return data.dataTimeZone == null || nowTimeZone == data.dataTimeZone.Value; } public static bool IsCorrectPlayerFlag(this EmpireLifeModeData.Data data) { if (data.dataFlagPlayer == null) { return true; } foreach (KeyValuePair keyValuePair in data.dataFlagPlayer) { if (GameMain.Instance.CharacterMgr.status.GetFlag(keyValuePair.Key) != keyValuePair.Value) { return false; } } return true; } public static bool IsCorrectMaidFlag(this EmpireLifeModeData.Data data, Maid maid) { if (data.dataFlagMaid == null) { return true; } foreach (KeyValuePair keyValuePair in data.dataFlagMaid) { if (maid.status.GetFlag(keyValuePair.Key) != keyValuePair.Value) { return false; } } return true; } public static bool IsCorrectMaidPersonalType(this EmpireLifeModeData.Data data, Maid maid) { foreach (KeyValuePair keyValuePair in data.dataMaidPersonalUniqueNameAndActiveSlotDic) { string value = keyValuePair.Value; if (value == maid.status.personal.uniqueName) { return true; } } return false; } public static bool IsCorrectMaidMainCharaOnly(this EmpireLifeModeData.Data data, Maid maid) { return data.dataMaidMainCharaOnly == null || maid.status.mainChara == data.dataMaidMainCharaOnly; } public static bool IsCorrectMaidContract(this EmpireLifeModeData.Data data, Maid maid) { return data.IsCorrectContract(maid.status.contract); } public static bool IsCorrectContract(this EmpireLifeModeData.Data data, Contract contract) { return data.dataMaidContract == null || data.dataMaidContract == contract; } public static bool IsCorrectMaidRelation(this EmpireLifeModeData.Data data, Maid maid) { return data.IsCorrectRelation(maid.status.relation); } public static bool IsCorrectRelation(this EmpireLifeModeData.Data data, Relation relation) { return data.dataMaidRelation == null || data.dataMaidRelation == relation; } public static bool IsCorrectMaidStatus(this EmpireLifeModeData.Data data, Maid maid) { return data.dataMaidStatus == null || data.dataMaidStatus.GreaterThanOrEqualToStatus(maid.status); } public static bool IsCorrectMaidSeikeiken(this EmpireLifeModeData.Data data, Maid maid) { if (data.dataMaidSeikeiken == null) { return true; } foreach (Seikeiken seikeiken in data.dataMaidSeikeiken) { if (seikeiken == maid.status.seikeiken) { return true; } } return false; } public static bool IsCorrectMaidExecuteCount(this EmpireLifeModeData.Data data, Maid maid) { if (data.dataScenarioType != EmpireLifeModeData.ScenarioType.一般) { return true; } int maidScenarioExecuteCount = GameMain.Instance.LifeModeMgr.GetMaidScenarioExecuteCount(data.ID, maid); return maidScenarioExecuteCount <= 0; } private static ReadOnlyDictionary m_ScenarioTypePriorityDic = new ReadOnlyDictionary(new Dictionary { { EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC, 4 }, { EmpireLifeModeData.ScenarioType.一般, 3 }, { EmpireLifeModeData.ScenarioType.Hシ\u30FCン, 2 }, { EmpireLifeModeData.ScenarioType.セクハラ, 2 }, { EmpireLifeModeData.ScenarioType.汎用, 1 } }); private static Dictionary m_ScenarioTypeIconDic = null; private static List m_EnabledFacilityUniqueNameList; }