123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- 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<EmpireLifeModeData.ScenarioType, Texture2D>();
- Func<string, Texture2D> 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<EmpireLifeModeData.ScenarioType, Texture2D>.ValueCollection values = EmpireLifeModeAPI.m_ScenarioTypeIconDic.Values;
- using (Dictionary<EmpireLifeModeData.ScenarioType, Texture2D>.ValueCollection.Enumerator enumerator = values.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- if (enumerator.Current != null)
- {
- UnityEngine.Object.DestroyImmediate(enumerator.Current);
- }
- }
- }
- EmpireLifeModeAPI.m_ScenarioTypeIconDic.Clear();
- }
- public static List<string> GetEnabledFacilityUniqueNameList()
- {
- if (EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList == null || EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Count <= 0)
- {
- EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList = new List<string>();
- foreach (EmpireLifeModeData.Data data in EmpireLifeModeData.GetAllDatas(true))
- {
- if (data.IsCorrectPersonalGP002())
- {
- foreach (string item in data.dataFacilityUniqueNameArray)
- {
- if (!EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Contains(item))
- {
- EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList.Add(item);
- }
- }
- }
- }
- }
- return new List<string>(EmpireLifeModeAPI.m_EnabledFacilityUniqueNameList);
- }
- public static List<Facility> GetEnabledFacilityList()
- {
- List<string> enabledFacilityUniqueNameList = EmpireLifeModeAPI.GetEnabledFacilityUniqueNameList();
- List<Facility> list = new List<Facility>();
- 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<Maid> SelectionMaidList(IEnumerable<Maid> maidList)
- {
- List<Maid> list = new List<Maid>();
- 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<string> GetEnabledPersonalListOfRecollection()
- {
- List<string> list = new List<string>();
- 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<Maid> GetCorrectMaidList(this EmpireLifeModeData.Data data, IEnumerable<Maid> maidList)
- {
- List<Maid> list = new List<Maid>();
- foreach (Maid maid in maidList)
- {
- if (data.IsCorrectMaid(maid))
- {
- list.Add(maid);
- }
- }
- return list;
- }
- public static List<Facility> GetCorrectFacilityList(this EmpireLifeModeData.Data data)
- {
- List<Facility> list = new List<Facility>();
- 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() && data.IsCorrectPersonalGP002();
- }
- 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<string, int> keyValuePair in data.dataFlagPlayer)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(keyValuePair.Key) != keyValuePair.Value)
- {
- return false;
- }
- }
- return true;
- }
- public static bool IsCorrectPersonalGP002(this EmpireLifeModeData.Data data)
- {
- return data.IsEnableGP002PersonalCheck;
- }
- public static bool IsCorrectMaidFlag(this EmpireLifeModeData.Data data, Maid maid)
- {
- if (data.dataFlagMaid == null)
- {
- return true;
- }
- foreach (KeyValuePair<string, int> 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<int, string> 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<EmpireLifeModeData.ScenarioType, int> m_ScenarioTypePriorityDic = new ReadOnlyDictionary<EmpireLifeModeData.ScenarioType, int>(new Dictionary<EmpireLifeModeData.ScenarioType, int>
- {
- {
- EmpireLifeModeData.ScenarioType.スト\u30FCリ\u30FC,
- 4
- },
- {
- EmpireLifeModeData.ScenarioType.一般,
- 3
- },
- {
- EmpireLifeModeData.ScenarioType.Hシ\u30FCン,
- 2
- },
- {
- EmpireLifeModeData.ScenarioType.セクハラ,
- 2
- },
- {
- EmpireLifeModeData.ScenarioType.汎用,
- 1
- }
- });
- private static Dictionary<EmpireLifeModeData.ScenarioType, Texture2D> m_ScenarioTypeIconDic = null;
- private static List<string> m_EnabledFacilityUniqueNameList;
- }
|