FacilityDataTable.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using Schedule;
  5. using UnityEngine;
  6. using wf;
  7. public static class FacilityDataTable
  8. {
  9. public static void Init()
  10. {
  11. FacilityDataTable.m_FacilityMaterialCategoryNameArray = new Dictionary<int, string>();
  12. FacilityDataTable.ReadCSV("facility_material_category.nei", delegate(CsvParser csv)
  13. {
  14. for (int i = 1; i < csv.max_cell_y; i++)
  15. {
  16. if (!csv.IsCellToExistData(0, i))
  17. {
  18. break;
  19. }
  20. int num = 0;
  21. int cellAsInteger = csv.GetCellAsInteger(num++, i);
  22. string cellAsString = csv.GetCellAsString(num++, i);
  23. FacilityDataTable.m_FacilityMaterialCategoryNameArray.Add(cellAsInteger, cellAsString);
  24. }
  25. });
  26. FacilityDataTable.m_FacilityParameterNameArray = new Dictionary<int, string>();
  27. FacilityDataTable.ReadCSV("facility_parameters.nei", delegate(CsvParser csv)
  28. {
  29. for (int i = 1; i < csv.max_cell_y; i++)
  30. {
  31. if (!csv.IsCellToExistData(0, i))
  32. {
  33. break;
  34. }
  35. int num = 0;
  36. int cellAsInteger = csv.GetCellAsInteger(num++, i);
  37. string cellAsString = csv.GetCellAsString(num++, i);
  38. FacilityDataTable.m_FacilityParameterNameArray.Add(cellAsInteger, cellAsString);
  39. }
  40. });
  41. FacilityDataTable.m_FacilityCostumeEnableMPN = new List<MPN>();
  42. FacilityDataTable.ReadCSV("facility_costume_mpn_enable_list.nei", delegate(CsvParser csv)
  43. {
  44. List<MPN> list = new List<MPN>();
  45. for (int i = 1; i < csv.max_cell_y; i++)
  46. {
  47. if (!csv.IsCellToExistData(0, i))
  48. {
  49. break;
  50. }
  51. string cellAsString = csv.GetCellAsString(0, i);
  52. MPN item = MPN.null_mpn;
  53. try
  54. {
  55. item = (MPN)Enum.Parse(typeof(MPN), cellAsString);
  56. }
  57. catch (Exception e)
  58. {
  59. NDebug.AssertParseError("MPN", e);
  60. }
  61. FacilityDataTable.m_FacilityCostumeEnableMPN.Add(item);
  62. }
  63. });
  64. FacilityDataTable.m_FacilityDefaultCostumeArray = new Dictionary<int, Dictionary<MPN, KeyValuePair<bool, string>>>();
  65. FacilityDataTable.m_FacilityDefaultCostumeThumbnailArray = new Dictionary<int, string>();
  66. FacilityDataTable.ReadCSV("facility_default_costume.nei", delegate(CsvParser csv)
  67. {
  68. int i = 1;
  69. int j = 4;
  70. while (i < csv.max_cell_x)
  71. {
  72. Dictionary<MPN, KeyValuePair<bool, string>> dictionary = new Dictionary<MPN, KeyValuePair<bool, string>>();
  73. int cellAsInteger = csv.GetCellAsInteger(i, 3);
  74. for (j = 4; j < csv.max_cell_y; j++)
  75. {
  76. if (!csv.IsCellToExistData(0, j))
  77. {
  78. break;
  79. }
  80. string cellAsString = csv.GetCellAsString(0, j);
  81. string text = csv.GetCellAsString(i, j);
  82. MPN mpn = MPN.null_mpn;
  83. try
  84. {
  85. mpn = (MPN)Enum.Parse(typeof(MPN), cellAsString);
  86. }
  87. catch (Exception ex)
  88. {
  89. FacilityDataTable.m_FacilityDefaultCostumeThumbnailArray.Add(cellAsInteger, text);
  90. break;
  91. }
  92. bool key = !string.IsNullOrEmpty(text);
  93. if (!string.IsNullOrEmpty(text) && text.ToLower() != "del")
  94. {
  95. text += ".menu";
  96. }
  97. else if (!CM3.dicDelItem.TryGetValue(mpn, out text))
  98. {
  99. Debug.LogWarningFormat("[FacilityDataTable]MPN[{0}]のDelPropの取得に失敗しました", new object[]
  100. {
  101. mpn
  102. });
  103. }
  104. dictionary.Add(mpn, new KeyValuePair<bool, string>(key, text));
  105. }
  106. FacilityDataTable.m_FacilityDefaultCostumeArray.Add(cellAsInteger, dictionary);
  107. i++;
  108. }
  109. });
  110. FacilityDataTable.m_FacilityBusinessTypeDataArray = new Dictionary<int, FacilityDataTable.BusinessTypeData>();
  111. FacilityDataTable.ReadCSVBusinessTypeData();
  112. FacilityDataTable.m_FacilityDefaultDataArray = new Dictionary<int, FacilityDataTable.FacilityDefaultData>();
  113. FacilityDataTable.m_FacilityRecipeDataArray = new Dictionary<int, FacilityDataTable.FacilityRecipeData>();
  114. FacilityDataTable.m_FacilityMaterialDataArray = new Dictionary<int, FacilityDataTable.FacilityMaterialData>();
  115. FacilityDataTable.ReadCSVFacilityDefaultData();
  116. FacilityDataTable.ReadCSVFacilityPowerUpData();
  117. FacilityDataTable.ReadCSVFacilityMaterialData();
  118. }
  119. private static CsvParser GetCSV(string name)
  120. {
  121. if (!GameUty.FileSystem.IsExistentFile(name))
  122. {
  123. Debug.LogWarning(string.Format("[FacilityDataTable]csv「{0}」が見つからない", name));
  124. return null;
  125. }
  126. AFileBase file = GameUty.FileSystem.FileOpen(name);
  127. CsvParser csvParser = new CsvParser();
  128. if (!csvParser.Open(file))
  129. {
  130. Debug.LogError(string.Format("[FacilityDataTable]csv「{0}」を開くのに失敗", name));
  131. }
  132. return csvParser;
  133. }
  134. private static void ReadCSV(string fileName, Action<CsvParser> callback)
  135. {
  136. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(fileName))
  137. {
  138. using (CsvParser csvParser = new CsvParser())
  139. {
  140. bool condition = csvParser.Open(afileBase);
  141. NDebug.Assert(condition, fileName + "\nopen failed.");
  142. callback(csvParser);
  143. }
  144. }
  145. }
  146. private static void ReadCSVFacilityDefaultData()
  147. {
  148. CsvParser csv = FacilityDataTable.GetCSV("facility_power_up.nei");
  149. Dictionary<int, int[]> dictionary = new Dictionary<int, int[]>();
  150. for (int i = 1; i < csv.max_cell_y; i++)
  151. {
  152. int cell_x = 0;
  153. int cellAsInteger = csv.GetCellAsInteger(cell_x++, i);
  154. string text = string.Empty;
  155. int[] array = null;
  156. if (csv.IsCellToExistData(cell_x, i))
  157. {
  158. text = csv.GetCellAsString(cell_x++, i);
  159. }
  160. if (!string.IsNullOrEmpty(text))
  161. {
  162. string[] array2 = text.Split(new char[]
  163. {
  164. ','
  165. });
  166. array = new int[array2.Length];
  167. for (int j = 0; j < array.Length; j++)
  168. {
  169. array[j] = int.Parse(array2[j]);
  170. }
  171. }
  172. dictionary.Add(cellAsInteger, array);
  173. }
  174. Dictionary<int, List<int>> dictionary2 = new Dictionary<int, List<int>>();
  175. CsvParser csv2 = FacilityDataTable.GetCSV("facility_level_table.nei");
  176. for (int k = 1; k < csv2.max_cell_y; k++)
  177. {
  178. int num = 0;
  179. if (!csv2.IsCellToExistData(0, k))
  180. {
  181. break;
  182. }
  183. int cellAsInteger2 = csv2.GetCellAsInteger(num++, k);
  184. num++;
  185. List<int> list = new List<int>();
  186. for (int l = 0; l < 5; l++)
  187. {
  188. if (csv2.IsCellToExistData(num, k))
  189. {
  190. list.Add(csv2.GetCellAsInteger(num, k));
  191. }
  192. else
  193. {
  194. list.Add(l * 100);
  195. }
  196. num++;
  197. }
  198. dictionary2.Add(cellAsInteger2, list);
  199. }
  200. HashSet<int> enableList = new HashSet<int>();
  201. string[] array3 = new string[]
  202. {
  203. "facility_enabled_list"
  204. };
  205. foreach (string fileName in array3)
  206. {
  207. CsvCommonIdManager.ReadEnabledIdList(GameUty.FileSystem, GameUty.PathList, fileName, ref enableList);
  208. }
  209. CsvParser csv3 = FacilityDataTable.GetCSV("facility.nei");
  210. for (int n = 1; n < csv3.max_cell_y; n++)
  211. {
  212. if (!csv3.IsCellToExistData(0, n))
  213. {
  214. break;
  215. }
  216. FacilityDataTable.FacilityDefaultData facilityDefaultData = new FacilityDataTable.FacilityDefaultData(csv3, dictionary, dictionary2, enableList, n);
  217. FacilityDataTable.m_FacilityDefaultDataArray.Add(facilityDefaultData.ID, facilityDefaultData);
  218. }
  219. }
  220. private static void ReadCSVFacilityPowerUpData()
  221. {
  222. CsvParser csv = FacilityDataTable.GetCSV("facility_power_up_list.nei");
  223. for (int i = 1; i < csv.max_cell_y; i++)
  224. {
  225. if (!csv.IsCellToExistData(0, i))
  226. {
  227. break;
  228. }
  229. FacilityDataTable.FacilityRecipeData facilityRecipeData = new FacilityDataTable.FacilityRecipeData(csv, i);
  230. FacilityDataTable.m_FacilityRecipeDataArray.Add(facilityRecipeData.ID, facilityRecipeData);
  231. }
  232. }
  233. private static void ReadCSVFacilityMaterialData()
  234. {
  235. CsvParser csv = FacilityDataTable.GetCSV("facility_material.nei");
  236. for (int i = 1; i < csv.max_cell_y; i++)
  237. {
  238. if (!csv.IsCellToExistData(0, i))
  239. {
  240. break;
  241. }
  242. FacilityDataTable.FacilityMaterialData facilityMaterialData = new FacilityDataTable.FacilityMaterialData(csv, i);
  243. FacilityDataTable.m_FacilityMaterialDataArray.Add(facilityMaterialData.ID, facilityMaterialData);
  244. }
  245. }
  246. private static void ReadCSVBusinessTypeData()
  247. {
  248. CsvParser csv = FacilityDataTable.GetCSV("facility_business_type.nei");
  249. for (int i = 1; i < csv.max_cell_y; i++)
  250. {
  251. if (!csv.IsCellToExistData(0, i))
  252. {
  253. break;
  254. }
  255. FacilityDataTable.BusinessTypeData businessTypeData = new FacilityDataTable.BusinessTypeData(csv, i);
  256. FacilityDataTable.m_FacilityBusinessTypeDataArray.Add(businessTypeData.ID, businessTypeData);
  257. }
  258. }
  259. public static FacilityDataTable.FacilityDefaultData GetFacilityDefaultData(int facilityTypeID, bool enableDataOnly = true)
  260. {
  261. if (FacilityDataTable.m_FacilityDefaultDataArray == null)
  262. {
  263. Debug.LogError("[FacilityDataTable]施設の基本情報の配列が未初期化です");
  264. return null;
  265. }
  266. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID))
  267. {
  268. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID[{0}]は存在しないデータです", facilityTypeID));
  269. return null;
  270. }
  271. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData)
  272. {
  273. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID[{0}]は有効ではありません", facilityTypeID));
  274. return null;
  275. }
  276. return FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID];
  277. }
  278. public static int GetFacilityTypeID(string facilityName)
  279. {
  280. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(facilityName, true);
  281. if (facilityDefaultData != null)
  282. {
  283. return facilityDefaultData.ID;
  284. }
  285. return -1;
  286. }
  287. public static FacilityDataTable.FacilityDefaultData GetFacilityDefaultData(string facilityDefaultName, bool enableDataOnly = true)
  288. {
  289. if (FacilityDataTable.m_FacilityDefaultDataArray == null)
  290. {
  291. NDebug.Assert("[FacilityDataTable]施設の基本情報の配列が未初期化です", false);
  292. return null;
  293. }
  294. foreach (KeyValuePair<int, FacilityDataTable.FacilityDefaultData> keyValuePair in FacilityDataTable.m_FacilityDefaultDataArray)
  295. {
  296. if (!(keyValuePair.Value.name != facilityDefaultName))
  297. {
  298. if (enableDataOnly && !keyValuePair.Value.isEnableData)
  299. {
  300. Debug.Log(string.Format("[FacilityDataTable]施設名[{0}]は有効ではありません", facilityDefaultName));
  301. return null;
  302. }
  303. return keyValuePair.Value;
  304. }
  305. }
  306. Debug.LogWarning(string.Format("施設名[{0}]は存在しないデータです", facilityDefaultName));
  307. return null;
  308. }
  309. public static Dictionary<int, ScheduleCSVData.Work> GetAllWorkData(bool enableDataOnly = true)
  310. {
  311. if (FacilityDataTable.m_FacilityDefaultDataArray == null)
  312. {
  313. Debug.LogError("[FacilityDataTable]施設の基本情報の配列が未初期化です");
  314. return null;
  315. }
  316. Dictionary<int, ScheduleCSVData.Work> dictionary = new Dictionary<int, ScheduleCSVData.Work>();
  317. List<FacilityDataTable.FacilityDefaultData> list = new List<FacilityDataTable.FacilityDefaultData>(FacilityDataTable.m_FacilityDefaultDataArray.Values);
  318. for (int i = 0; i < list.Count; i++)
  319. {
  320. if (!enableDataOnly || list[i].isEnableData)
  321. {
  322. if (list[i].workData != null)
  323. {
  324. if (list[i].workData.id > 0)
  325. {
  326. if (dictionary.ContainsKey(list[i].workData.id))
  327. {
  328. NDebug.Assert("[営業施設と強化素材.xlsx]施設のスケジュールID" + list[i].workData.id + "が重複しています", false);
  329. return null;
  330. }
  331. dictionary.Add(list[i].workData.id, list[i].workData);
  332. }
  333. }
  334. }
  335. }
  336. return dictionary;
  337. }
  338. public static FacilityDataTable.FacilityRecipeData GetFacilityRecipeData(int recipeID)
  339. {
  340. if (FacilityDataTable.m_FacilityRecipeDataArray == null)
  341. {
  342. Debug.LogError("[FacilityDataTable]施設強化レシピの基本情報の配列が未初期化です");
  343. return null;
  344. }
  345. if (!FacilityDataTable.m_FacilityRecipeDataArray.ContainsKey(recipeID))
  346. {
  347. Debug.LogFormat("[FacilityDataTable]施設強化レシピID[{0}]は存在しないデータです", new object[]
  348. {
  349. recipeID
  350. });
  351. return null;
  352. }
  353. return FacilityDataTable.m_FacilityRecipeDataArray[recipeID];
  354. }
  355. public static Facility.FacilityStatus GetFacilityStatus(int facilityTypeID, bool enableDataOnly = true)
  356. {
  357. if (FacilityDataTable.m_FacilityDefaultDataArray == null)
  358. {
  359. Debug.LogError("[FacilityDataTable]施設の基本情報の配列が未初期化です");
  360. return null;
  361. }
  362. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID))
  363. {
  364. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID[{0}]は存在しないデータです", facilityTypeID));
  365. return null;
  366. }
  367. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID];
  368. if (enableDataOnly && !facilityDefaultData.isEnableData)
  369. {
  370. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID[{0}]は有効ではありません", facilityTypeID));
  371. return null;
  372. }
  373. return new Facility.FacilityStatus
  374. {
  375. name = facilityDefaultData.name,
  376. termName = facilityDefaultData.termName,
  377. typeID = facilityDefaultData.ID,
  378. parameter = new Facility.FacilityParameter(facilityDefaultData.income, facilityDefaultData.valuation, facilityDefaultData.experienceValue)
  379. };
  380. }
  381. public static Facility.PowerUpRecipe GetFacilityPowerUpRecipe(int recipeID)
  382. {
  383. if (FacilityDataTable.m_FacilityRecipeDataArray == null)
  384. {
  385. Debug.LogError("[FacilityDataTable]強化レシピ情報の配列が未初期化です");
  386. return null;
  387. }
  388. if (!FacilityDataTable.m_FacilityRecipeDataArray.ContainsKey(recipeID))
  389. {
  390. Debug.Log(string.Format("[FacilityDataTable]施設強化レシピID[{0}]は存在しないデータです", recipeID));
  391. return null;
  392. }
  393. FacilityDataTable.FacilityRecipeData facilityRecipeData = FacilityDataTable.m_FacilityRecipeDataArray[recipeID];
  394. return new Facility.PowerUpRecipe
  395. {
  396. id = facilityRecipeData.ID,
  397. materialCategoryIDArray = facilityRecipeData.materialIDArray,
  398. name = facilityRecipeData.name,
  399. parameter = new Facility.FacilityParameter(facilityRecipeData.income, facilityRecipeData.valuation, facilityRecipeData.experienceValue)
  400. };
  401. }
  402. public static Facility.PowerUpMaterial GetFacilityPowerUpMaterial(int materialID)
  403. {
  404. if (FacilityDataTable.m_FacilityMaterialDataArray == null)
  405. {
  406. Debug.LogError("[FacilityDataTable]強化素材の情報の配列が未初期化です");
  407. return null;
  408. }
  409. if (!FacilityDataTable.m_FacilityMaterialDataArray.ContainsKey(materialID))
  410. {
  411. Debug.Log(string.Format("[FacilityDataTable]強化素材ID[{0}]は存在しないデータです", materialID));
  412. return null;
  413. }
  414. FacilityDataTable.FacilityMaterialData facilityMaterialData = FacilityDataTable.m_FacilityMaterialDataArray[materialID];
  415. return new Facility.PowerUpMaterial
  416. {
  417. id = facilityMaterialData.ID,
  418. categoryID = facilityMaterialData.categoryID,
  419. name = facilityMaterialData.name,
  420. parameter = new Facility.FacilityParameter(facilityMaterialData.income, facilityMaterialData.valuation, facilityMaterialData.experienceValue)
  421. };
  422. }
  423. public static Facility.PowerUpMaterial GetFacilityPowerUpMaterial(string materialName)
  424. {
  425. if (FacilityDataTable.m_FacilityMaterialDataArray == null)
  426. {
  427. Debug.LogError("[FacilityDataTable]強化素材の情報の配列が未初期化です");
  428. return null;
  429. }
  430. foreach (KeyValuePair<int, FacilityDataTable.FacilityMaterialData> keyValuePair in FacilityDataTable.m_FacilityMaterialDataArray)
  431. {
  432. if (!(keyValuePair.Value.name != materialName))
  433. {
  434. return FacilityDataTable.GetFacilityPowerUpMaterial(keyValuePair.Value.ID);
  435. }
  436. }
  437. NDebug.Warning(string.Format("強化素材「{0}」の情報は存在しません", materialName));
  438. return null;
  439. }
  440. public static int GetFacilityPowerUpMaterialID(string materialName)
  441. {
  442. Facility.PowerUpMaterial facilityPowerUpMaterial = FacilityDataTable.GetFacilityPowerUpMaterial(materialName);
  443. if (facilityPowerUpMaterial != null)
  444. {
  445. return facilityPowerUpMaterial.id;
  446. }
  447. return -1;
  448. }
  449. public static Facility.FacilityStatus[] GetFacilityStatusArray(bool enableDataOnly = true)
  450. {
  451. if (FacilityDataTable.m_FacilityDefaultDataArray == null)
  452. {
  453. Debug.LogError("[FacilityDataTable]施設の基本情報の配列が未初期化です");
  454. return null;
  455. }
  456. List<Facility.FacilityStatus> list = new List<Facility.FacilityStatus>();
  457. List<FacilityDataTable.FacilityDefaultData> list2 = new List<FacilityDataTable.FacilityDefaultData>(FacilityDataTable.m_FacilityDefaultDataArray.Values);
  458. for (int i = 0; i < list2.Count; i++)
  459. {
  460. if (!enableDataOnly || list2[i].isEnableData)
  461. {
  462. list.Add(FacilityDataTable.GetFacilityStatus(list2[i].ID, true));
  463. }
  464. }
  465. return list.ToArray();
  466. }
  467. public static int[] GetFacilityPowerUpMaterialIDArray()
  468. {
  469. if (FacilityDataTable.m_FacilityMaterialDataArray == null)
  470. {
  471. Debug.LogError("[FacilityDataTable]施設の強化素材情報の配列が未初期化です");
  472. return null;
  473. }
  474. List<int> list = new List<int>(FacilityDataTable.m_FacilityMaterialDataArray.Keys);
  475. return list.ToArray();
  476. }
  477. public static Facility.PowerUpRecipe[] GetFacilityPowerUpRecipeArray()
  478. {
  479. if (FacilityDataTable.m_FacilityRecipeDataArray == null)
  480. {
  481. Debug.LogError("[FacilityDataTable]施設強化レシピ情報の配列が未初期化です");
  482. return null;
  483. }
  484. List<Facility.PowerUpRecipe> list = new List<Facility.PowerUpRecipe>();
  485. List<FacilityDataTable.FacilityRecipeData> list2 = new List<FacilityDataTable.FacilityRecipeData>(FacilityDataTable.m_FacilityRecipeDataArray.Values);
  486. for (int i = 0; i < list2.Count; i++)
  487. {
  488. list.Add(FacilityDataTable.GetFacilityPowerUpRecipe(list2[i].ID));
  489. }
  490. return list.ToArray();
  491. }
  492. public static bool IsExistFacilityData(int facilityTypeID, bool enableDataOnly = true)
  493. {
  494. return FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID) && (!enableDataOnly || FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData);
  495. }
  496. public static bool IsExistPowerUpMaterial(int materialID)
  497. {
  498. return FacilityDataTable.m_FacilityMaterialDataArray.ContainsKey(materialID);
  499. }
  500. public static Facility.PowerUpMaterial[] GetFacilityPowerUpMaterialArray(int materialCategoryID)
  501. {
  502. List<Facility.PowerUpMaterial> list = new List<Facility.PowerUpMaterial>();
  503. List<FacilityDataTable.FacilityMaterialData> list2 = new List<FacilityDataTable.FacilityMaterialData>(FacilityDataTable.m_FacilityMaterialDataArray.Values);
  504. for (int i = 0; i < list2.Count; i++)
  505. {
  506. if (list2[i].categoryID == materialCategoryID)
  507. {
  508. list.Add(FacilityDataTable.GetFacilityPowerUpMaterial(list2[i].ID));
  509. }
  510. }
  511. return list.ToArray();
  512. }
  513. public static int GetFacilityPowerUpMaterialCount()
  514. {
  515. return FacilityDataTable.m_FacilityMaterialDataArray.Count;
  516. }
  517. public static bool IsExistFacilityPowerUpRecipe(int facilityTypeID, bool enableDataOnly = true)
  518. {
  519. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID))
  520. {
  521. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityTypeID));
  522. return false;
  523. }
  524. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData)
  525. {
  526. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityTypeID));
  527. return false;
  528. }
  529. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID];
  530. return facilityDefaultData.powerUpRecipeIDArray != null;
  531. }
  532. public static int[] GetFacilityPowerUpRecipeIDArray(int facilityTypeID, bool enableDataOnly = true)
  533. {
  534. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID))
  535. {
  536. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityTypeID));
  537. return null;
  538. }
  539. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData)
  540. {
  541. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityTypeID));
  542. return null;
  543. }
  544. return FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].powerUpRecipeIDArray;
  545. }
  546. public static string GetFacilityPowerUpMaterialCategoryName(int categoryID)
  547. {
  548. if (!FacilityDataTable.m_FacilityMaterialCategoryNameArray.ContainsKey(categoryID))
  549. {
  550. Debug.LogWarning(string.Format("[FacilityDataTable]素材カテゴリID「{0}」のデータは存在しない", categoryID));
  551. return null;
  552. }
  553. return FacilityDataTable.m_FacilityMaterialCategoryNameArray[categoryID];
  554. }
  555. public static int[] GetFacilityPowerUpMaterialCategoryIDArray()
  556. {
  557. List<int> list = new List<int>(FacilityDataTable.m_FacilityMaterialCategoryNameArray.Keys);
  558. return list.ToArray();
  559. }
  560. public static string GetFacilityParameterName(int parameterID)
  561. {
  562. if (!FacilityDataTable.m_FacilityParameterNameArray.ContainsKey(parameterID))
  563. {
  564. Debug.LogWarning(string.Format("[FacilityDataTable]施設パラメータID「{0}」のデータは存在しない", parameterID));
  565. return null;
  566. }
  567. return FacilityDataTable.m_FacilityParameterNameArray[parameterID];
  568. }
  569. public static bool GetFacilityCanBeUsedBusiness(int facilityID, bool enableDataOnly = true)
  570. {
  571. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityID))
  572. {
  573. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityID));
  574. return false;
  575. }
  576. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isEnableData)
  577. {
  578. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityID));
  579. return false;
  580. }
  581. return FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isBusiness;
  582. }
  583. public static bool GetFacilityCanBeDestroy(int facilityID, bool enableDataOnly = true)
  584. {
  585. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityID))
  586. {
  587. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityID));
  588. return false;
  589. }
  590. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isEnableData)
  591. {
  592. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityID));
  593. return false;
  594. }
  595. return FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isRemoval;
  596. }
  597. public static bool GetFacilityDefaultPlacement(int facilityID, bool enableDataOnly = true)
  598. {
  599. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityID))
  600. {
  601. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityID));
  602. return false;
  603. }
  604. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isEnableData)
  605. {
  606. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityID));
  607. return false;
  608. }
  609. return FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isDefaultPlace;
  610. }
  611. public static int GetFacilityDefaultCost(int facilityID, bool enableDataOnly = true)
  612. {
  613. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityID))
  614. {
  615. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityID));
  616. return 0;
  617. }
  618. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityID].isEnableData)
  619. {
  620. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityID));
  621. return 0;
  622. }
  623. return FacilityDataTable.m_FacilityDefaultDataArray[facilityID].cost;
  624. }
  625. public static Sprite GetFacilityThumbnail(int facilityTypeID, bool enableDataOnly = true)
  626. {
  627. if (!FacilityDataTable.m_FacilityDefaultDataArray.ContainsKey(facilityTypeID))
  628. {
  629. Debug.LogWarning(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは存在しない", facilityTypeID));
  630. return null;
  631. }
  632. if (FacilityDataTable.m_FacilityThumbnailCacheDic == null)
  633. {
  634. FacilityDataTable.m_FacilityThumbnailCacheDic = new Dictionary<int, Sprite>();
  635. }
  636. Sprite sprite;
  637. if (FacilityDataTable.m_FacilityThumbnailCacheDic.TryGetValue(facilityTypeID, out sprite))
  638. {
  639. return sprite;
  640. }
  641. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID];
  642. if (enableDataOnly && !facilityDefaultData.isEnableData)
  643. {
  644. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityTypeID));
  645. return null;
  646. }
  647. string text = facilityDefaultData.imageThumbnailName + ".tex";
  648. if (string.IsNullOrEmpty(text))
  649. {
  650. Debug.Log(string.Format("施設の種類ID[{0}]にはサムネイル画像情報がありません", facilityTypeID));
  651. return null;
  652. }
  653. if (!GameUty.FileSystem.IsExistentFile(text))
  654. {
  655. Debug.Log(string.Format("施設『{0}』のサムネイル画像「{1}」が見つかりませんでした", facilityDefaultData.name, text));
  656. return null;
  657. }
  658. Texture2D tex = ImportCM.CreateTexture(text);
  659. sprite = uGUIUtility.CreateSprite(tex);
  660. FacilityDataTable.m_FacilityThumbnailCacheDic.Add(facilityTypeID, sprite);
  661. return sprite;
  662. }
  663. public static Dictionary<MPN, KeyValuePair<bool, string>> GetFacilityDefaultCostume(int facilityTypeID, bool enableDataOnly = true, bool newBody = false)
  664. {
  665. if (!FacilityDataTable.m_FacilityDefaultCostumeArray.ContainsKey(facilityTypeID))
  666. {
  667. return null;
  668. }
  669. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData)
  670. {
  671. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityTypeID));
  672. return null;
  673. }
  674. Dictionary<MPN, KeyValuePair<bool, string>> dictionary = FacilityDataTable.m_FacilityDefaultCostumeArray[facilityTypeID];
  675. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  676. if (newBody)
  677. {
  678. if (!dictionary.ContainsKey(MPN.acchead) || dictionary[MPN.acchead].Value.Contains("_del"))
  679. {
  680. dictionary[MPN.acchead] = new KeyValuePair<bool, string>(true, CM3.dicDelItem[MPN.acchead]);
  681. if (Array.FindIndex<MPN>(facilityCostumeEnableMPN, (MPN m) => m == MPN.acchead) == -1)
  682. {
  683. Array.Resize<MPN>(ref facilityCostumeEnableMPN, facilityCostumeEnableMPN.Length + 1);
  684. facilityCostumeEnableMPN[facilityCostumeEnableMPN.Length - 1] = MPN.acchead;
  685. }
  686. }
  687. if (!dictionary.ContainsKey(MPN.acckubi) || dictionary[MPN.acckubi].Value.Contains("_del"))
  688. {
  689. dictionary[MPN.acckubi] = new KeyValuePair<bool, string>(true, CM3.dicDelItem[MPN.acckubi]);
  690. if (Array.FindIndex<MPN>(facilityCostumeEnableMPN, (MPN m) => m == MPN.acckubi) == -1)
  691. {
  692. Array.Resize<MPN>(ref facilityCostumeEnableMPN, facilityCostumeEnableMPN.Length + 1);
  693. facilityCostumeEnableMPN[facilityCostumeEnableMPN.Length - 1] = MPN.acckubi;
  694. }
  695. }
  696. }
  697. Dictionary<MPN, KeyValuePair<bool, string>> dictionary2 = new Dictionary<MPN, KeyValuePair<bool, string>>();
  698. foreach (MPN key in facilityCostumeEnableMPN)
  699. {
  700. if (dictionary.ContainsKey(key))
  701. {
  702. dictionary2.Add(key, dictionary[key]);
  703. }
  704. }
  705. return dictionary2;
  706. }
  707. public static string GetFacilityDefaultCostumeThumbnailName(int facilityTypeID, bool enableDataOnly = true)
  708. {
  709. if (!FacilityDataTable.m_FacilityDefaultCostumeThumbnailArray.ContainsKey(facilityTypeID))
  710. {
  711. return null;
  712. }
  713. if (enableDataOnly && !FacilityDataTable.m_FacilityDefaultDataArray[facilityTypeID].isEnableData)
  714. {
  715. Debug.Log(string.Format("[FacilityDataTable]施設の種類ID「{0}」のデータは有効ではありません", facilityTypeID));
  716. return null;
  717. }
  718. return FacilityDataTable.m_FacilityDefaultCostumeThumbnailArray[facilityTypeID];
  719. }
  720. public static MPN[] GetFacilityCostumeEnableMPN()
  721. {
  722. return FacilityDataTable.m_FacilityCostumeEnableMPN.ToArray();
  723. }
  724. public static bool IsEnableFacilityCostumeMPN(MPN mpn)
  725. {
  726. return FacilityDataTable.m_FacilityCostumeEnableMPN.Contains(mpn);
  727. }
  728. public static int[] GetFacilityBusinessTypeIDArray(bool isExclusionEmptyData = true)
  729. {
  730. List<int> list = null;
  731. if (isExclusionEmptyData)
  732. {
  733. list = new List<int>();
  734. foreach (KeyValuePair<int, FacilityDataTable.BusinessTypeData> keyValuePair in FacilityDataTable.m_FacilityBusinessTypeDataArray)
  735. {
  736. if (keyValuePair.Key != 9999)
  737. {
  738. list.Add(keyValuePair.Key);
  739. }
  740. }
  741. }
  742. else
  743. {
  744. list = new List<int>(FacilityDataTable.m_FacilityBusinessTypeDataArray.Keys);
  745. }
  746. return list.ToArray();
  747. }
  748. public static FacilityDataTable.BusinessTypeData[] GetFacilityBusinessTypeDataArray(bool isExclusionEmptyData = true)
  749. {
  750. List<FacilityDataTable.BusinessTypeData> list = null;
  751. if (isExclusionEmptyData)
  752. {
  753. list = new List<FacilityDataTable.BusinessTypeData>();
  754. foreach (KeyValuePair<int, FacilityDataTable.BusinessTypeData> keyValuePair in FacilityDataTable.m_FacilityBusinessTypeDataArray)
  755. {
  756. if (keyValuePair.Key != 9999)
  757. {
  758. list.Add(keyValuePair.Value);
  759. }
  760. }
  761. }
  762. else
  763. {
  764. list = new List<FacilityDataTable.BusinessTypeData>(FacilityDataTable.m_FacilityBusinessTypeDataArray.Values);
  765. }
  766. return list.ToArray();
  767. }
  768. public static FacilityDataTable.BusinessTypeData GetFacilityBusinessTypeData(int businessTypeID)
  769. {
  770. if (!FacilityDataTable.m_FacilityBusinessTypeDataArray.ContainsKey(businessTypeID))
  771. {
  772. Debug.LogWarningFormat("[FacilityDataTable]事業の種類ID「{0}」に対応する情報がありません", new object[]
  773. {
  774. businessTypeID
  775. });
  776. return null;
  777. }
  778. return FacilityDataTable.m_FacilityBusinessTypeDataArray[businessTypeID];
  779. }
  780. public static bool IsExistFacilityBusinessTypeData(int businessTypeID)
  781. {
  782. return FacilityDataTable.m_FacilityBusinessTypeDataArray.ContainsKey(businessTypeID);
  783. }
  784. public static FacilityDataTable.BusinessTypeData GetFacilityBusinessTypeData(string businessName)
  785. {
  786. foreach (KeyValuePair<int, FacilityDataTable.BusinessTypeData> keyValuePair in FacilityDataTable.m_FacilityBusinessTypeDataArray)
  787. {
  788. if (!(keyValuePair.Value.name != businessName))
  789. {
  790. return keyValuePair.Value;
  791. }
  792. }
  793. Debug.LogWarningFormat("[FacilityDataTable]事業の名前「{0}」に対応する情報がありません", new object[]
  794. {
  795. businessName
  796. });
  797. return null;
  798. }
  799. private static Dictionary<int, FacilityDataTable.FacilityDefaultData> m_FacilityDefaultDataArray;
  800. private static Dictionary<int, FacilityDataTable.FacilityRecipeData> m_FacilityRecipeDataArray;
  801. private static Dictionary<int, FacilityDataTable.FacilityMaterialData> m_FacilityMaterialDataArray;
  802. private static Dictionary<int, FacilityDataTable.BusinessTypeData> m_FacilityBusinessTypeDataArray;
  803. private static Dictionary<int, string> m_FacilityMaterialCategoryNameArray;
  804. private static Dictionary<int, string> m_FacilityParameterNameArray;
  805. private static Dictionary<int, Dictionary<MPN, KeyValuePair<bool, string>>> m_FacilityDefaultCostumeArray;
  806. private static Dictionary<int, string> m_FacilityDefaultCostumeThumbnailArray;
  807. private static List<MPN> m_FacilityCostumeEnableMPN;
  808. private static Dictionary<int, Sprite> m_FacilityThumbnailCacheDic = new Dictionary<int, Sprite>();
  809. public enum BusinessType
  810. {
  811. 接待系 = 100,
  812. 営業系 = 200,
  813. アイドル系 = 300,
  814. 無し = 9999
  815. }
  816. public class FacilityDefaultData
  817. {
  818. public FacilityDefaultData(CsvParser csv, Dictionary<int, int[]> recipeIDArray, Dictionary<int, List<int>> levelTableList, HashSet<int> enableList, int y)
  819. {
  820. int num = 0;
  821. this.ID = csv.GetCellAsInteger(num++, y);
  822. int cellAsInteger = csv.GetCellAsInteger(num++, y);
  823. this.name = csv.GetCellAsString(num++, y);
  824. csv.GetCellAsString(num++, y);
  825. this.businessTypeName = csv.GetCellAsString(num++, y);
  826. this.businessTypeID = FacilityDataTable.GetFacilityBusinessTypeData(this.businessTypeName).ID;
  827. this.upwardFacilityID = csv.GetCellAsInteger(num++, y);
  828. this.fileName = csv.GetCellAsString(num++, y);
  829. this.fileNameNight = csv.GetCellAsString(num++, y);
  830. this.rank = csv.GetCellAsInteger(num++, y);
  831. string cellAsString = csv.GetCellAsString(num++, y);
  832. this.cost = csv.GetCellAsInteger(num++, y);
  833. this.income = csv.GetCellAsInteger(num++, y);
  834. this.valuation = csv.GetCellAsInteger(num++, y);
  835. this.experienceValue = csv.GetCellAsInteger(num++, y);
  836. this.isBusiness = (csv.GetCellAsString(num++, y) == "〇");
  837. this.isDefaultPlace = (csv.GetCellAsString(num++, y) == "〇");
  838. this.isRemoval = (csv.GetCellAsString(num++, y) == "〇");
  839. string cellAsString2 = csv.GetCellAsString(num++, y);
  840. this.imageThumbnailName = csv.GetCellAsString(num++, y);
  841. string cellAsString3 = csv.GetCellAsString(num++, y);
  842. this.minMaidCount = csv.GetCellAsInteger(num++, y);
  843. this.maxMaidCount = csv.GetCellAsInteger(num++, y);
  844. this.heroineMagnification = csv.GetCellAsInteger(num++, y);
  845. string cellAsString4 = csv.GetCellAsString(num++, y);
  846. this.isEnableData = enableList.Contains(this.ID);
  847. if (string.IsNullOrEmpty(cellAsString2))
  848. {
  849. this.isEnableNTR = true;
  850. this.isOnlyNTR = false;
  851. }
  852. else if (cellAsString2 == "×")
  853. {
  854. this.isEnableNTR = false;
  855. this.isOnlyNTR = false;
  856. }
  857. else if (cellAsString2 == "〇" || cellAsString2 == "○")
  858. {
  859. this.isEnableNTR = true;
  860. this.isOnlyNTR = true;
  861. }
  862. if (recipeIDArray.ContainsKey(this.ID))
  863. {
  864. this.powerUpRecipeIDArray = recipeIDArray[this.ID];
  865. }
  866. else
  867. {
  868. this.powerUpRecipeIDArray = null;
  869. }
  870. string[] array = cellAsString.Split(new char[]
  871. {
  872. ','
  873. });
  874. this.staffRankArray = new int[4];
  875. for (int i = 0; i < this.staffRankArray.Length; i++)
  876. {
  877. try
  878. {
  879. int.TryParse(array[i], out this.staffRankArray[i]);
  880. }
  881. catch (Exception ex)
  882. {
  883. this.staffRankArray[i] = 0;
  884. }
  885. }
  886. if (levelTableList.ContainsKey(this.ID))
  887. {
  888. this.levelTable = levelTableList[this.ID];
  889. }
  890. else
  891. {
  892. this.levelTable = new List<int>();
  893. this.levelTable.Add(0);
  894. this.levelTable.Add(100);
  895. this.levelTable.Add(200);
  896. this.levelTable.Add(300);
  897. this.levelTable.Add(400);
  898. }
  899. try
  900. {
  901. this.businessType = (FacilityDataTable.BusinessType)Enum.Parse(typeof(FacilityDataTable.BusinessType), this.businessTypeName);
  902. }
  903. catch (Exception e)
  904. {
  905. NDebug.AssertParseError("BusinessType", e);
  906. }
  907. if (cellAsInteger < 0)
  908. {
  909. return;
  910. }
  911. this.workData = new ScheduleCSVData.Work();
  912. this.workData.type = ScheduleTaskCtrl.TaskType.Work;
  913. this.workData.id = cellAsInteger;
  914. this.workData.name = csv.GetCellAsString(num++, y);
  915. this.workData.icon = cellAsString3;
  916. string cellAsString5 = csv.GetCellAsString(num++, y);
  917. if (!string.IsNullOrEmpty(cellAsString5) && Enum.IsDefined(typeof(ScheduleCSVData.TrainingType), cellAsString5))
  918. {
  919. this.workData.trainingType = (ScheduleCSVData.TrainingType)Enum.Parse(typeof(ScheduleCSVData.TrainingType), cellAsString5, false);
  920. }
  921. this.workData.study_rate = csv.GetCellAsInteger(num++, y);
  922. this.workData.reception = csv.GetCellAsInteger(num++, y);
  923. this.workData.care = csv.GetCellAsInteger(num++, y);
  924. this.workData.lovely = csv.GetCellAsInteger(num++, y);
  925. this.workData.elegance = csv.GetCellAsInteger(num++, y);
  926. this.workData.charm = csv.GetCellAsInteger(num++, y);
  927. this.workData.teach_rate = csv.GetCellAsInteger(num++, y);
  928. this.workData.cooking = csv.GetCellAsInteger(num++, y);
  929. this.workData.vocal = csv.GetCellAsInteger(num++, y);
  930. this.workData.dance = csv.GetCellAsInteger(num++, y);
  931. this.workData.appealPoint = csv.GetCellAsInteger(num++, y);
  932. this.workData.exp = csv.GetCellAsInteger(num++, y);
  933. this.workData.income = csv.GetCellAsInteger(num++, y);
  934. this.workData.cmdExp = csv.GetCellAsInteger(num++, y);
  935. string cellAsString6 = csv.GetCellAsString(num++, y);
  936. this.workData.condContract = new List<Contract>();
  937. string[] array2 = cellAsString6.Split(new char[]
  938. {
  939. '|'
  940. }, StringSplitOptions.RemoveEmptyEntries);
  941. for (int j = 0; j < array2.Length; j++)
  942. {
  943. if (Enum.IsDefined(typeof(Contract), array2[j]))
  944. {
  945. this.workData.condContract.Add((Contract)Enum.Parse(typeof(Contract), array2[j], false));
  946. }
  947. }
  948. string cellAsString7 = csv.GetCellAsString(num++, y);
  949. this.workData.condMaidClass = new List<int>();
  950. string[] array3 = cellAsString7.Split(new char[]
  951. {
  952. '&'
  953. }, StringSplitOptions.RemoveEmptyEntries);
  954. for (int k = 0; k < array3.Length; k++)
  955. {
  956. int id = JobClass.GetData(array3[k]).id;
  957. this.workData.condMaidClass.Add(id);
  958. }
  959. this.workData.needEventItemIdList = new List<int>();
  960. if (csv.GetCellAsString(num, 0) == "必要状態")
  961. {
  962. this.workData.needMaidStatus = csv.GetCellAsString(num++, y);
  963. string cellAsString8 = csv.GetCellAsString(num++, y);
  964. if (!string.IsNullOrEmpty(cellAsString8))
  965. {
  966. string[] array4 = cellAsString8.Split(new char[]
  967. {
  968. '|'
  969. });
  970. foreach (string s in array4)
  971. {
  972. this.workData.needEventItemIdList.Add(int.Parse(s));
  973. }
  974. }
  975. }
  976. if (num < csv.max_cell_x)
  977. {
  978. string cellAsString9 = csv.GetCellAsString(num, y);
  979. if (cellAsString9 != null)
  980. {
  981. if (!(cellAsString9 == "表示"))
  982. {
  983. if (cellAsString9 == "非表示")
  984. {
  985. this.workData.disableIfRentalMaid = true;
  986. }
  987. }
  988. else
  989. {
  990. this.workData.visibleIfRentalMaid = true;
  991. }
  992. }
  993. }
  994. num++;
  995. if (num < csv.max_cell_x)
  996. {
  997. string cellAsString10 = csv.GetCellAsString(num, y);
  998. this.workData.isNewBodyBlock = (cellAsString10 == "〇" || cellAsString10 == "○");
  999. }
  1000. num++;
  1001. if (num < csv.max_cell_x)
  1002. {
  1003. this.workData.mainHeroineBodyTypeMatchCheckList = new HashSet<string>();
  1004. string cellAsString11 = csv.GetCellAsString(num, y);
  1005. foreach (string text in cellAsString11.Split(new char[]
  1006. {
  1007. ','
  1008. }))
  1009. {
  1010. if (!string.IsNullOrEmpty(text))
  1011. {
  1012. string text2 = text.Trim();
  1013. if (text2 != null)
  1014. {
  1015. if (text2 == "無垢" || text2 == "真面目" || text2 == "凜デレ")
  1016. {
  1017. this.workData.mainHeroineBodyTypeMatchCheckList.Add(text.Trim());
  1018. goto IL_912;
  1019. }
  1020. }
  1021. Debug.LogError(string.Concat(new object[]
  1022. {
  1023. "ID[",
  1024. this.ID,
  1025. "]",
  1026. this.name,
  1027. "のメインキャラとのボディ一致チェック項目で不正な文字列が指定されています=>",
  1028. text.Trim()
  1029. }));
  1030. }
  1031. IL_912:;
  1032. }
  1033. }
  1034. num++;
  1035. this.workData.condPackage = new List<string>();
  1036. if (this.workData.id > 0)
  1037. {
  1038. this.workData.categoryID = 52;
  1039. }
  1040. this.workData.facility = this;
  1041. }
  1042. public bool isExistUpwardFacility
  1043. {
  1044. get
  1045. {
  1046. return FacilityDataTable.IsExistFacilityData(this.upwardFacilityID, true);
  1047. }
  1048. }
  1049. public FacilityDataTable.FacilityDefaultData upwardFacility
  1050. {
  1051. get
  1052. {
  1053. if (!this.isExistUpwardFacility)
  1054. {
  1055. return null;
  1056. }
  1057. return FacilityDataTable.GetFacilityDefaultData(this.upwardFacilityID, true);
  1058. }
  1059. }
  1060. public string termName
  1061. {
  1062. get
  1063. {
  1064. return "SceneFacilityManagement/施設名/" + this.name;
  1065. }
  1066. }
  1067. public const string termRootText = "SceneFacilityManagement/";
  1068. public readonly int ID;
  1069. public readonly string name;
  1070. public readonly string businessTypeName;
  1071. public readonly int businessTypeID;
  1072. public readonly FacilityDataTable.BusinessType businessType;
  1073. public readonly string fileName;
  1074. public readonly string fileNameNight;
  1075. public readonly int cost;
  1076. public readonly int income;
  1077. public readonly int valuation;
  1078. public readonly int experienceValue;
  1079. public readonly bool isBusiness;
  1080. public readonly bool isDefaultPlace;
  1081. public readonly bool isRemoval;
  1082. public readonly string imageThumbnailName;
  1083. public readonly int[] powerUpRecipeIDArray;
  1084. public readonly int minMaidCount;
  1085. public readonly int maxMaidCount;
  1086. public readonly int heroineMagnification;
  1087. public readonly int rank;
  1088. public readonly int[] staffRankArray;
  1089. public readonly List<int> levelTable;
  1090. public readonly ScheduleCSVData.Work workData;
  1091. public readonly bool isEnableNTR;
  1092. public readonly bool isOnlyNTR;
  1093. public readonly bool isEnableData;
  1094. private readonly int upwardFacilityID;
  1095. }
  1096. public class FacilityRecipeData
  1097. {
  1098. public FacilityRecipeData(CsvParser csv, int y)
  1099. {
  1100. int num = 0;
  1101. this.ID = csv.GetCellAsInteger(num++, y);
  1102. this.name = csv.GetCellAsString(num++, y);
  1103. string cellAsString = csv.GetCellAsString(num++, y);
  1104. this.conditions = new string[FacilityDataTable.FacilityRecipeData.CONDITIONS_NUM];
  1105. for (int i = 0; i < FacilityDataTable.FacilityRecipeData.CONDITIONS_NUM; i++)
  1106. {
  1107. this.conditions[i] = csv.GetCellAsString(num++, y);
  1108. }
  1109. this.salonGrade = csv.GetCellAsInteger(num++, y);
  1110. string cellAsString2 = csv.GetCellAsString(num++, y);
  1111. if (!string.IsNullOrEmpty(cellAsString2))
  1112. {
  1113. string[] array = cellAsString2.Split(new char[]
  1114. {
  1115. ','
  1116. });
  1117. ParametersPack.StatusType key = ParametersPack.NameToStatusType(array[0]);
  1118. this.statusType = new KeyValuePair<ParametersPack.StatusType, int>(key, int.Parse(array[1]));
  1119. }
  1120. this.income = csv.GetCellAsInteger(num++, y);
  1121. this.valuation = csv.GetCellAsInteger(num++, y);
  1122. this.experienceValue = csv.GetCellAsInteger(num++, y);
  1123. if (!string.IsNullOrEmpty(cellAsString))
  1124. {
  1125. string[] array2 = cellAsString.Split(new char[]
  1126. {
  1127. ','
  1128. });
  1129. this.materialIDArray = new int[array2.Length];
  1130. for (int j = 0; j < array2.Length; j++)
  1131. {
  1132. this.materialIDArray[j] = int.Parse(array2[j]);
  1133. }
  1134. }
  1135. else
  1136. {
  1137. this.materialIDArray = null;
  1138. }
  1139. }
  1140. public bool IsSatisfyTheConditions()
  1141. {
  1142. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  1143. bool flag = true;
  1144. flag &= (this.salonGrade <= GameMain.Instance.CharacterMgr.status.clubGrade);
  1145. if (maid != null && this.statusType.Value > 0)
  1146. {
  1147. flag &= (this.statusType.Value <= FacilityDataTable.FacilityRecipeData.GetMaidStatusValue(maid, this.statusType.Key.ToString()));
  1148. }
  1149. else
  1150. {
  1151. Debug.LogWarning("メイド0番が見つかりません");
  1152. }
  1153. return flag;
  1154. }
  1155. private static int GetMaidStatusValue(Maid maid, string name)
  1156. {
  1157. switch (name)
  1158. {
  1159. case "接待":
  1160. return maid.status.reception;
  1161. case "お世話":
  1162. return maid.status.care;
  1163. case "可憐":
  1164. return maid.status.lovely;
  1165. case "気品":
  1166. return maid.status.elegance;
  1167. case "魅惑":
  1168. return maid.status.charm;
  1169. case "料理":
  1170. return maid.status.cooking;
  1171. case "ボーカル":
  1172. return maid.status.vocal;
  1173. case "ダンス":
  1174. return maid.status.dance;
  1175. case "アピールポイント":
  1176. return maid.status.appealPoint;
  1177. case "淫欲":
  1178. return maid.status.inyoku;
  1179. case "M性":
  1180. return maid.status.mvalue;
  1181. case "変態":
  1182. return maid.status.hentai;
  1183. case "奉仕":
  1184. return maid.status.housi;
  1185. case "指導":
  1186. return maid.status.teachRate;
  1187. case "経験人数":
  1188. return maid.status.sexPlayNumberOfPeople;
  1189. case "人気ランク":
  1190. return maid.status.popularRank;
  1191. case "評価":
  1192. return maid.status.evaluation;
  1193. }
  1194. Debug.LogWarning("メイドパラメータ名" + name + "に対応する処理は未定義でした");
  1195. return 9999;
  1196. }
  1197. public static readonly int CONDITIONS_NUM = 4;
  1198. public readonly int ID;
  1199. public readonly string name;
  1200. public readonly int[] materialIDArray;
  1201. public readonly int income;
  1202. public readonly int valuation;
  1203. public readonly int experienceValue;
  1204. public readonly string[] conditions;
  1205. public readonly int salonGrade;
  1206. public readonly KeyValuePair<ParametersPack.StatusType, int> statusType;
  1207. }
  1208. public class FacilityMaterialData
  1209. {
  1210. public FacilityMaterialData(CsvParser csv, int y)
  1211. {
  1212. int num = 0;
  1213. this.ID = csv.GetCellAsInteger(num++, y);
  1214. this.name = csv.GetCellAsString(num++, y);
  1215. this.categoryID = csv.GetCellAsInteger(num++, y);
  1216. this.income = csv.GetCellAsInteger(num++, y);
  1217. this.valuation = csv.GetCellAsInteger(num++, y);
  1218. this.experienceValue = csv.GetCellAsInteger(num++, y);
  1219. }
  1220. public readonly int ID;
  1221. public readonly string name;
  1222. public readonly int categoryID;
  1223. public readonly int income;
  1224. public readonly int valuation;
  1225. public readonly int experienceValue;
  1226. }
  1227. public class BusinessTypeData
  1228. {
  1229. public BusinessTypeData(CsvParser csv, int y)
  1230. {
  1231. int num = 0;
  1232. this.ID = csv.GetCellAsInteger(num++, y);
  1233. this.name = csv.GetCellAsString(num++, y);
  1234. this.fileName = csv.GetCellAsString(num++, y);
  1235. this.description = csv.GetCellAsString(num++, y);
  1236. this.conditions = new string[FacilityDataTable.BusinessTypeData.CONDITIONS_NUM];
  1237. for (int i = 0; i < FacilityDataTable.BusinessTypeData.CONDITIONS_NUM; i++)
  1238. {
  1239. this.conditions[i] = csv.GetCellAsString(num++, y);
  1240. }
  1241. }
  1242. public static readonly int CONDITIONS_NUM = 2;
  1243. public readonly int ID;
  1244. public readonly string name;
  1245. public readonly string fileName;
  1246. public readonly string description;
  1247. public readonly string[] conditions;
  1248. }
  1249. }