Facility.cs 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using I2.Loc;
  6. using MaidStatus;
  7. using Schedule;
  8. using UnityEngine;
  9. public class Facility : MonoBehaviour
  10. {
  11. public void Init(int facilityTypeID)
  12. {
  13. this.m_Param = new Facility.FacilityStatus();
  14. Facility.FacilityStatus facilityStatus = FacilityDataTable.GetFacilityStatus(facilityTypeID, true);
  15. this.param.typeID = facilityStatus.typeID;
  16. this.param.name = facilityStatus.name;
  17. if (Product.supportMultiLanguage)
  18. {
  19. string translation = LocalizationManager.GetTranslation(facilityStatus.termName, true, 0, true, false, null, null);
  20. if (!string.IsNullOrEmpty(translation))
  21. {
  22. this.param.name = translation;
  23. }
  24. }
  25. this.param.parameter = facilityStatus.parameter;
  26. if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facilityTypeID, true))
  27. {
  28. int[] facilityPowerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(facilityTypeID, true);
  29. this.recipe = new Facility.RecipeData[facilityPowerUpRecipeIDArray.Length];
  30. for (int i = 0; i < this.recipe.Length; i++)
  31. {
  32. this.recipe[i] = new Facility.RecipeData(facilityPowerUpRecipeIDArray[i]);
  33. }
  34. }
  35. this.m_EditCostumeArray = new Dictionary<MPN, KeyValuePair<bool, string>>();
  36. Dictionary<MPN, KeyValuePair<bool, string>> facilityDefaultCostume = FacilityDataTable.GetFacilityDefaultCostume(facilityTypeID, true);
  37. if (facilityDefaultCostume != null && 0 < facilityDefaultCostume.Count)
  38. {
  39. List<MPN> list = new List<MPN>(facilityDefaultCostume.Keys);
  40. List<KeyValuePair<bool, string>> list2 = new List<KeyValuePair<bool, string>>(facilityDefaultCostume.Values);
  41. int count = facilityDefaultCostume.Count;
  42. for (int j = 0; j < count; j++)
  43. {
  44. KeyValuePair<bool, string> value = new KeyValuePair<bool, string>(true, list2[j].Value);
  45. if (Product.isPublic && (list[j] == MPN.panz || list[j] == MPN.bra))
  46. {
  47. value = new KeyValuePair<bool, string>(false, list2[j].Value);
  48. }
  49. this.m_EditCostumeArray.Add(list[j], value);
  50. }
  51. }
  52. this.m_TypeCostume = Facility.CostumeType.Heroine;
  53. this.m_AllocationDayTimeMaidGuidList = new List<string>();
  54. this.m_AllocationNightMaidGuidList = new List<string>();
  55. this.m_BeforeAllocationDayTimeMaidGuidList = new List<string>();
  56. this.m_BeforeAllocationNightMaidGuidList = new List<string>();
  57. this.guid = Guid.NewGuid().ToString();
  58. }
  59. public Facility.RecipeData GetRecipeData(int id)
  60. {
  61. if (this.m_Recipe == null)
  62. {
  63. return null;
  64. }
  65. Facility.RecipeData result = null;
  66. for (int i = 0; i < this.m_Recipe.Length; i++)
  67. {
  68. if (this.m_Recipe[i].id == id)
  69. {
  70. result = this.m_Recipe[i];
  71. break;
  72. }
  73. }
  74. return result;
  75. }
  76. public bool IsExistRecipeData(int id)
  77. {
  78. return this.GetRecipeData(id) != null;
  79. }
  80. public void SetRecipeData(Facility.RecipeData recipeData)
  81. {
  82. if (this.m_Recipe == null)
  83. {
  84. return;
  85. }
  86. if (!this.IsExistRecipeData(recipeData.id))
  87. {
  88. Debug.LogWarning(string.Concat(new object[]
  89. {
  90. "[Facility.cs]施設「",
  91. this.facilityName,
  92. "」は強化レシピID:",
  93. recipeData.id,
  94. "のレシピに対応していません"
  95. }));
  96. return;
  97. }
  98. for (int i = 0; i < this.m_Recipe.Length; i++)
  99. {
  100. if (this.m_Recipe[i].id == recipeData.id)
  101. {
  102. this.m_Recipe[i] = recipeData;
  103. }
  104. }
  105. }
  106. public Facility.FacilityParameter CalcAllParameter()
  107. {
  108. return this.CalcRecipeParameter() + this.m_Param.parameter;
  109. }
  110. public Facility.FacilityParameter CalcRecipeParameter()
  111. {
  112. Facility.FacilityParameter facilityParameter = new Facility.FacilityParameter();
  113. if (this.m_Recipe == null)
  114. {
  115. return facilityParameter;
  116. }
  117. Facility.RecipeData[] recipe = this.m_Recipe;
  118. for (int i = 0; i < recipe.Length; i++)
  119. {
  120. facilityParameter += Facility.RecipeData.CalcFacilityParameter(recipe[i]);
  121. facilityParameter += FacilityDataTable.GetFacilityPowerUpRecipe(recipe[i].id).parameter;
  122. }
  123. return facilityParameter;
  124. }
  125. public void SetEditCostume(MPN mpn, string fileName)
  126. {
  127. if (!FacilityDataTable.IsEnableFacilityCostumeMPN(mpn))
  128. {
  129. Debug.LogWarning(string.Format("[Facility]施設「{0}」:エディットコスチューム「{1}」のキーが存在しない", this.facilityName, mpn));
  130. return;
  131. }
  132. if (fileName.ToLower() == "del")
  133. {
  134. if (!CM3.dicDelItem.TryGetValue(mpn, out fileName))
  135. {
  136. NDebug.Assert(string.Format("[Facility]MPN「{0}」のdelファイル名の取得に失敗", mpn), false);
  137. }
  138. }
  139. else if (!string.IsNullOrEmpty(fileName))
  140. {
  141. if (!Path.HasExtension(fileName))
  142. {
  143. fileName += ".menu";
  144. }
  145. if (!GameUty.FileSystem.IsExistentFile(fileName))
  146. {
  147. Debug.LogWarning(string.Format("[Facility].menuアイテム「{0}」は存在しない", fileName));
  148. return;
  149. }
  150. }
  151. bool key = false;
  152. if (this.m_EditCostumeArray.ContainsKey(mpn))
  153. {
  154. key = this.m_EditCostumeArray[mpn].Key;
  155. this.m_EditCostumeArray[mpn] = new KeyValuePair<bool, string>(key, fileName);
  156. }
  157. else
  158. {
  159. Dictionary<MPN, KeyValuePair<bool, string>> facilityDefaultCostume = FacilityDataTable.GetFacilityDefaultCostume(this.param.typeID, true);
  160. if (facilityDefaultCostume != null)
  161. {
  162. key = facilityDefaultCostume[mpn].Key;
  163. }
  164. this.m_EditCostumeArray.Add(mpn, new KeyValuePair<bool, string>(key, fileName));
  165. }
  166. }
  167. public Dictionary<MPN, KeyValuePair<bool, string>> GetEditCostume()
  168. {
  169. return new Dictionary<MPN, KeyValuePair<bool, string>>(this.m_EditCostumeArray);
  170. }
  171. public string GetEditCostume(MPN mpn)
  172. {
  173. if (!this.m_EditCostumeArray.ContainsKey(mpn))
  174. {
  175. Debug.LogWarning(string.Format("[Facility]施設「{0}」のエディットコスチューム「{1}」のキーが存在しない", this.facilityName, mpn));
  176. return string.Empty;
  177. }
  178. return this.m_EditCostumeArray[mpn].Value;
  179. }
  180. public void DeleteEditCostume(MPN mpn)
  181. {
  182. if (!this.m_EditCostumeArray.ContainsKey(mpn))
  183. {
  184. Debug.LogWarning(string.Format("[Facility]施設「{0}」のエディットコスチューム「{1}」のキーが存在しない", this.facilityName, mpn));
  185. return;
  186. }
  187. KeyValuePair<bool, string> keyValuePair = this.m_EditCostumeArray[mpn];
  188. this.m_EditCostumeArray[mpn] = new KeyValuePair<bool, string>(keyValuePair.Key, CM3.dicDelItem[mpn]);
  189. }
  190. public void SetCostumeForced(MPN mpn, bool isForced)
  191. {
  192. if (!this.m_EditCostumeArray.ContainsKey(mpn))
  193. {
  194. Debug.LogWarning(string.Format("[Facility]施設「{0}」のエディットコスチューム「{1}」のキーが存在しない", this.facilityName, mpn));
  195. return;
  196. }
  197. KeyValuePair<bool, string> keyValuePair = this.m_EditCostumeArray[mpn];
  198. this.m_EditCostumeArray[mpn] = new KeyValuePair<bool, string>(isForced, keyValuePair.Value);
  199. }
  200. public bool GetCostumeForced(MPN mpn)
  201. {
  202. if (!this.m_EditCostumeArray.ContainsKey(mpn))
  203. {
  204. Debug.LogWarning(string.Format("[Facility]施設「{0}」のエディットコスチューム「{1}」のキーが存在しない", this.facilityName, mpn));
  205. return false;
  206. }
  207. return this.m_EditCostumeArray[mpn].Key;
  208. }
  209. public void Serialize(BinaryWriter bw)
  210. {
  211. bw.Write(this.guid);
  212. bw.Write(this.m_Param.typeID);
  213. bw.Write(this.m_Param.name);
  214. bw.Write(this.m_Param.parameter.income);
  215. bw.Write(this.m_Param.parameter.valuation);
  216. bw.Write(this.m_Param.parameter.experienceValue);
  217. if (this.m_Recipe != null)
  218. {
  219. bw.Write(this.m_Recipe.Length);
  220. for (int i = 0; i < this.m_Recipe.Length; i++)
  221. {
  222. bw.Write(this.m_Recipe[i].id);
  223. bw.Write(this.m_Recipe[i].materialIDArray.Length);
  224. for (int j = 0; j < this.m_Recipe[i].materialIDArray.Length; j++)
  225. {
  226. bw.Write(this.m_Recipe[i].materialIDArray[j]);
  227. }
  228. }
  229. }
  230. else
  231. {
  232. bw.Write(0);
  233. }
  234. bw.Write((int)this.m_TypeCostume);
  235. if (this.m_EditCostumeArray != null)
  236. {
  237. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  238. bw.Write(facilityCostumeEnableMPN.Length);
  239. foreach (MPN mpn in facilityCostumeEnableMPN)
  240. {
  241. KeyValuePair<bool, string> keyValuePair = default(KeyValuePair<bool, string>);
  242. if (this.m_EditCostumeArray.ContainsKey(mpn))
  243. {
  244. keyValuePair = this.m_EditCostumeArray[mpn];
  245. }
  246. bw.Write(Enum.GetName(typeof(MPN), mpn));
  247. bw.Write(keyValuePair.Key);
  248. bw.Write((!string.IsNullOrEmpty(keyValuePair.Value)) ? keyValuePair.Value : string.Empty);
  249. }
  250. }
  251. else
  252. {
  253. bw.Write(0);
  254. }
  255. if (this.m_AllocationDayTimeMaidGuidList != null)
  256. {
  257. bw.Write(this.m_AllocationDayTimeMaidGuidList.Count);
  258. for (int l = 0; l < this.m_AllocationDayTimeMaidGuidList.Count; l++)
  259. {
  260. bw.Write(this.m_AllocationDayTimeMaidGuidList[l]);
  261. }
  262. }
  263. else
  264. {
  265. bw.Write(0);
  266. }
  267. if (this.m_AllocationNightMaidGuidList != null)
  268. {
  269. bw.Write(this.m_AllocationNightMaidGuidList.Count);
  270. for (int m = 0; m < this.m_AllocationNightMaidGuidList.Count; m++)
  271. {
  272. bw.Write(this.m_AllocationNightMaidGuidList[m]);
  273. }
  274. }
  275. else
  276. {
  277. bw.Write(0);
  278. }
  279. if (this.m_BeforeAllocationDayTimeMaidGuidList != null)
  280. {
  281. bw.Write(this.m_BeforeAllocationDayTimeMaidGuidList.Count);
  282. for (int n = 0; n < this.m_BeforeAllocationDayTimeMaidGuidList.Count; n++)
  283. {
  284. bw.Write(this.m_BeforeAllocationDayTimeMaidGuidList[n]);
  285. }
  286. }
  287. else
  288. {
  289. bw.Write(0);
  290. }
  291. if (this.m_BeforeAllocationNightMaidGuidList != null)
  292. {
  293. bw.Write(this.m_BeforeAllocationNightMaidGuidList.Count);
  294. for (int num = 0; num < this.m_BeforeAllocationNightMaidGuidList.Count; num++)
  295. {
  296. bw.Write(this.m_BeforeAllocationNightMaidGuidList[num]);
  297. }
  298. }
  299. else
  300. {
  301. bw.Write(0);
  302. }
  303. this.FixEditCostumeThumbnail();
  304. }
  305. public bool Deserialize(BinaryReader br, int version)
  306. {
  307. this.guid = br.ReadString();
  308. this.m_Param.typeID = br.ReadInt32();
  309. this.m_Param.name = br.ReadString();
  310. this.m_Param.parameter.income = br.ReadInt32();
  311. this.m_Param.parameter.valuation = br.ReadInt32();
  312. this.m_Param.parameter.experienceValue = br.ReadInt32();
  313. bool flag = FacilityDataTable.IsExistFacilityData(this.m_Param.typeID, true);
  314. if (!flag)
  315. {
  316. string message = string.Format("施設の種類ID[{0}]の情報は存在しないので、この施設情報は失われます", this.m_Param.typeID);
  317. NDebug.Warning(message);
  318. Debug.LogWarning(message);
  319. }
  320. if (version < 5)
  321. {
  322. int num = br.ReadInt32();
  323. this.m_Recipe = new Facility.RecipeData[num];
  324. for (int i = 0; i < num; i++)
  325. {
  326. int id_ = br.ReadInt32();
  327. this.m_Recipe[i] = new Facility.RecipeData(id_);
  328. for (int j = 0; j < this.m_Recipe[i].materialIDArray.Length; j++)
  329. {
  330. this.m_Recipe[i].materialIDArray[j] = br.ReadInt32();
  331. }
  332. }
  333. }
  334. else
  335. {
  336. if (FacilityDataTable.IsExistFacilityPowerUpRecipe(this.param.typeID, flag))
  337. {
  338. int[] facilityPowerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(this.param.typeID, flag);
  339. this.m_Recipe = new Facility.RecipeData[facilityPowerUpRecipeIDArray.Length];
  340. for (int k = 0; k < this.m_Recipe.Length; k++)
  341. {
  342. this.m_Recipe[k] = new Facility.RecipeData(facilityPowerUpRecipeIDArray[k]);
  343. }
  344. }
  345. else
  346. {
  347. this.m_Recipe = null;
  348. }
  349. int num2 = br.ReadInt32();
  350. Facility.RecipeData[] array = new Facility.RecipeData[num2];
  351. for (int l = 0; l < num2; l++)
  352. {
  353. int id_2 = br.ReadInt32();
  354. array[l] = new Facility.RecipeData(id_2);
  355. int num3 = br.ReadInt32();
  356. bool flag2 = array[l].materialIDArray.Length == num3;
  357. for (int m = 0; m < num3; m++)
  358. {
  359. if (flag2)
  360. {
  361. array[l].materialIDArray[m] = br.ReadInt32();
  362. }
  363. else
  364. {
  365. br.ReadInt32();
  366. }
  367. }
  368. }
  369. foreach (Facility.RecipeData recipeData in array)
  370. {
  371. for (int num4 = 0; num4 < this.m_Recipe.Length; num4++)
  372. {
  373. if (this.m_Recipe[num4].id == recipeData.id && this.m_Recipe[num4].materialIDArray.Length == recipeData.materialIDArray.Length)
  374. {
  375. this.m_Recipe[num4] = recipeData;
  376. }
  377. }
  378. }
  379. }
  380. int num5 = br.ReadInt32();
  381. this.m_TypeCostume = (Facility.CostumeType)Enum.Parse(typeof(Facility.CostumeType), num5.ToString());
  382. int num6 = br.ReadInt32();
  383. this.m_EditCostumeArray = new Dictionary<MPN, KeyValuePair<bool, string>>();
  384. if (version >= 3)
  385. {
  386. for (int num7 = 0; num7 < num6; num7++)
  387. {
  388. string value = br.ReadString();
  389. MPN mpn = MPN.null_mpn;
  390. try
  391. {
  392. mpn = (MPN)Enum.Parse(typeof(MPN), value);
  393. }
  394. catch (Exception e)
  395. {
  396. NDebug.AssertParseError("MPN", e);
  397. }
  398. bool key = br.ReadBoolean();
  399. string value2 = br.ReadString();
  400. if (FacilityDataTable.IsEnableFacilityCostumeMPN(mpn))
  401. {
  402. this.m_EditCostumeArray.Add(mpn, new KeyValuePair<bool, string>(key, value2));
  403. }
  404. }
  405. }
  406. else
  407. {
  408. for (int num8 = 0; num8 < num6; num8++)
  409. {
  410. int num9 = br.ReadInt32();
  411. bool key2 = br.ReadBoolean();
  412. string text = br.ReadString();
  413. MPN mpn2 = MPN.null_mpn;
  414. if (!string.IsNullOrEmpty(text))
  415. {
  416. string[] array2 = text.Split(new char[]
  417. {
  418. '_'
  419. });
  420. foreach (string value3 in array2)
  421. {
  422. try
  423. {
  424. mpn2 = (MPN)Enum.Parse(typeof(MPN), value3, true);
  425. break;
  426. }
  427. catch
  428. {
  429. }
  430. }
  431. if (FacilityDataTable.IsEnableFacilityCostumeMPN(mpn2))
  432. {
  433. this.m_EditCostumeArray.Add(mpn2, new KeyValuePair<bool, string>(key2, text));
  434. }
  435. }
  436. }
  437. }
  438. int num11 = br.ReadInt32();
  439. this.m_AllocationDayTimeMaidGuidList = new List<string>();
  440. for (int num12 = 0; num12 < num11; num12++)
  441. {
  442. string item = br.ReadString();
  443. this.m_AllocationDayTimeMaidGuidList.Add(item);
  444. }
  445. num11 = br.ReadInt32();
  446. this.m_AllocationNightMaidGuidList = new List<string>();
  447. for (int num13 = 0; num13 < num11; num13++)
  448. {
  449. string item2 = br.ReadString();
  450. this.m_AllocationNightMaidGuidList.Add(item2);
  451. }
  452. if (version > 0)
  453. {
  454. num11 = br.ReadInt32();
  455. this.m_BeforeAllocationDayTimeMaidGuidList = new List<string>();
  456. for (int num14 = 0; num14 < num11; num14++)
  457. {
  458. string item3 = br.ReadString();
  459. this.m_BeforeAllocationDayTimeMaidGuidList.Add(item3);
  460. }
  461. num11 = br.ReadInt32();
  462. this.m_BeforeAllocationNightMaidGuidList = new List<string>();
  463. for (int num15 = 0; num15 < num11; num15++)
  464. {
  465. string item4 = br.ReadString();
  466. this.m_BeforeAllocationNightMaidGuidList.Add(item4);
  467. }
  468. }
  469. return flag;
  470. }
  471. public void UpdateMaidCostumeToDefaultCostume(Maid maid)
  472. {
  473. Dictionary<MPN, KeyValuePair<bool, string>> facilityDefaultCostume = FacilityDataTable.GetFacilityDefaultCostume(this.param.typeID, true);
  474. if (facilityDefaultCostume == null)
  475. {
  476. Debug.LogWarning(string.Format("[Facility]施設『{0}』のデフォルトコスチュームの取得に失敗しました\n施設の種類ID:{1}", this.facilityName, this.param.typeID));
  477. return;
  478. }
  479. if (facilityDefaultCostume.Count <= 0)
  480. {
  481. Debug.LogWarning(string.Format("[Facility]施設『{0}』のデフォルトコスチュームの数が0以下でした\n施設の種類ID:{1}\u3000\u3000データ数:{2}", this.facilityName, this.param.typeID, facilityDefaultCostume.Count));
  482. return;
  483. }
  484. if (maid == null)
  485. {
  486. Debug.LogWarning(string.Format("[Facility]施設『{0}』のコスチュームにするメイドにnullが指定されました", this.facilityName));
  487. return;
  488. }
  489. int count = facilityDefaultCostume.Count;
  490. List<MPN> list = new List<MPN>(facilityDefaultCostume.Keys);
  491. List<KeyValuePair<bool, string>> list2 = new List<KeyValuePair<bool, string>>(facilityDefaultCostume.Values);
  492. for (int i = 0; i < count; i++)
  493. {
  494. MaidProp prop = maid.GetProp(list[i]);
  495. prop.strTempFileName = string.Empty;
  496. prop.nTempFileNameRID = 0;
  497. if (!list2[i].Key)
  498. {
  499. maid.ResetProp(list[i], false);
  500. }
  501. else if (list2[i].Value == "del")
  502. {
  503. maid.DelProp(list[i], true);
  504. }
  505. else
  506. {
  507. maid.SetProp(list[i], list2[i].Value, 0, true, false);
  508. }
  509. }
  510. }
  511. public void UpdateMaidCostumeToEditCostume(Maid maid, bool absoluteChange = false)
  512. {
  513. Dictionary<MPN, KeyValuePair<bool, string>> editCostumeArray = this.m_EditCostumeArray;
  514. if (editCostumeArray == null)
  515. {
  516. Debug.LogWarning(string.Format("[Facility]施設『{0}』のエディットコスチュームの取得に失敗しました\n施設の種類ID:{1}", this.facilityName, this.param.typeID));
  517. return;
  518. }
  519. if (editCostumeArray.Count <= 0)
  520. {
  521. Debug.LogWarning(string.Format("[Facility]施設『{0}』のエディットコスチュームの数が0以下でした\n施設の種類ID:{1}\u3000\u3000データ数:{2}", this.facilityName, this.param.typeID, editCostumeArray.Count));
  522. return;
  523. }
  524. if (maid == null)
  525. {
  526. Debug.LogWarning(string.Format("[Facility]施設『{0}』のコスチュームにするメイドにnullが指定されました", this.facilityName));
  527. return;
  528. }
  529. int count = editCostumeArray.Count;
  530. List<MPN> list = new List<MPN>(editCostumeArray.Keys);
  531. List<KeyValuePair<bool, string>> list2 = new List<KeyValuePair<bool, string>>(editCostumeArray.Values);
  532. for (int i = 0; i < count; i++)
  533. {
  534. MaidProp prop = maid.GetProp(list[i]);
  535. prop.strTempFileName = string.Empty;
  536. prop.nTempFileNameRID = 0;
  537. if (!absoluteChange && !list2[i].Key)
  538. {
  539. maid.ResetProp(list[i], false);
  540. }
  541. else if (list2[i].Value == "del")
  542. {
  543. maid.DelProp(list[i], true);
  544. }
  545. else
  546. {
  547. maid.SetProp(list[i], list2[i].Value, 0, true, false);
  548. }
  549. }
  550. }
  551. public void UpdateEditCostumeToMaidCostume(Maid maid)
  552. {
  553. if (maid == null)
  554. {
  555. Debug.LogWarning(string.Format("[Facility]施設『{0}』のコスチューム設定メイドにnullが指定されました", this.facilityName));
  556. return;
  557. }
  558. StringBuilder stringBuilder = new StringBuilder();
  559. stringBuilder.AppendFormat("[Facility]施設『{0}』のコスチューム\n", this.facilityName);
  560. foreach (MPN mpn in FacilityDataTable.GetFacilityCostumeEnableMPN())
  561. {
  562. MaidProp prop = maid.GetProp(mpn);
  563. string strTempFileName = prop.strTempFileName;
  564. this.SetEditCostume(mpn, strTempFileName);
  565. stringBuilder.AppendFormat("<{0}\t{1}>\n", mpn, strTempFileName);
  566. }
  567. }
  568. public static string GetFacilityEditCostumeThumbnailPath()
  569. {
  570. string fullPath = Path.GetFullPath(".\\");
  571. return fullPath + "Thumb\\";
  572. }
  573. public string GetFacilityEditCostumeThumbnailName()
  574. {
  575. return "f_cos_tmp_" + this.guid + ".png";
  576. }
  577. public string GetFacilityEditCostumeThumbnailTrueName()
  578. {
  579. return "f_cos_" + this.guid + ".png";
  580. }
  581. public Texture2D GetEditCostumeThumbnail()
  582. {
  583. Texture2D result = null;
  584. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  585. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  586. {
  587. Directory.CreateDirectory(facilityEditCostumeThumbnailPath);
  588. }
  589. string text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  590. if (File.Exists(text))
  591. {
  592. result = UTY.LoadTexture(text);
  593. }
  594. else
  595. {
  596. text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  597. if (File.Exists(text))
  598. {
  599. result = UTY.LoadTexture(text);
  600. }
  601. }
  602. return result;
  603. }
  604. public bool IsExistEditCostumeThumbnail()
  605. {
  606. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  607. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  608. {
  609. return false;
  610. }
  611. string path = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  612. if (File.Exists(path))
  613. {
  614. return true;
  615. }
  616. path = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  617. return File.Exists(path);
  618. }
  619. public Texture2D GetDefaultCostumeThumbnail()
  620. {
  621. if (!string.IsNullOrEmpty(this.defaultCostumeThumbnailName))
  622. {
  623. string f_strFileName = this.defaultCostumeThumbnailName + ".tex";
  624. if (GameUty.FileSystem.IsExistentFile(f_strFileName))
  625. {
  626. return ImportCM.CreateTexture(f_strFileName);
  627. }
  628. Debug.LogWarningFormat("施設デフォルト衣装サムネイル「{0}」がない", new object[]
  629. {
  630. this.defaultCostumeThumbnailName
  631. });
  632. }
  633. else
  634. {
  635. Debug.LogWarningFormat("施設「{0}」のデフォルト衣装サムネイル名が空文字だった", new object[]
  636. {
  637. this.defaultName
  638. });
  639. }
  640. return null;
  641. }
  642. private void FixEditCostumeThumbnail()
  643. {
  644. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  645. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  646. {
  647. return;
  648. }
  649. string text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  650. if (!File.Exists(text))
  651. {
  652. return;
  653. }
  654. string text2 = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  655. try
  656. {
  657. if (File.Exists(text2))
  658. {
  659. File.Delete(text2);
  660. }
  661. File.Move(text, text2);
  662. }
  663. catch
  664. {
  665. }
  666. }
  667. public static void DeleteTmpEditCostumeThumnails()
  668. {
  669. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  670. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  671. {
  672. return;
  673. }
  674. string[] files = Directory.GetFiles(facilityEditCostumeThumbnailPath, "*", SearchOption.TopDirectoryOnly);
  675. for (int i = 0; i < files.Length; i++)
  676. {
  677. string text = string.Empty;
  678. try
  679. {
  680. text = files[i].Substring(facilityEditCostumeThumbnailPath.Length, files[i].Length - facilityEditCostumeThumbnailPath.Length);
  681. }
  682. catch
  683. {
  684. }
  685. if (string.IsNullOrEmpty(text))
  686. {
  687. files[i] = string.Empty;
  688. }
  689. else if (0 > text.IndexOf(".png") || 0 > text.IndexOf("f_cos_tmp_"))
  690. {
  691. files[i] = string.Empty;
  692. }
  693. }
  694. for (int j = 0; j < files.Length; j++)
  695. {
  696. if (!string.IsNullOrEmpty(files[j]))
  697. {
  698. try
  699. {
  700. File.Delete(files[j]);
  701. }
  702. catch
  703. {
  704. }
  705. }
  706. }
  707. }
  708. public void LoadFacilityBG()
  709. {
  710. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  711. if (facilityDefaultData == null)
  712. {
  713. return;
  714. }
  715. string fileName = facilityDefaultData.fileName;
  716. if (string.IsNullOrEmpty(fileName))
  717. {
  718. Debug.LogWarningFormat("[Facility]施設「{0}」の背景プレハブ名が空でした", new object[]
  719. {
  720. this.facilityName
  721. });
  722. return;
  723. }
  724. GameMain.Instance.BgMgr.ChangeBg(fileName);
  725. }
  726. public Facility.FacilityStatus param
  727. {
  728. get
  729. {
  730. return this.m_Param;
  731. }
  732. }
  733. public Facility.RecipeData[] recipe
  734. {
  735. get
  736. {
  737. return this.m_Recipe;
  738. }
  739. set
  740. {
  741. this.m_Recipe = value;
  742. }
  743. }
  744. public string facilityName
  745. {
  746. get
  747. {
  748. return this.m_Param.name;
  749. }
  750. set
  751. {
  752. this.m_Param.name = value;
  753. }
  754. }
  755. public int facilityIncome
  756. {
  757. get
  758. {
  759. return this.m_Param.parameter.income;
  760. }
  761. set
  762. {
  763. this.m_Param.parameter.income = value;
  764. }
  765. }
  766. public int facilityValuation
  767. {
  768. get
  769. {
  770. return this.m_Param.parameter.valuation;
  771. }
  772. set
  773. {
  774. this.m_Param.parameter.valuation = value;
  775. }
  776. }
  777. public int facilityExperienceValue
  778. {
  779. get
  780. {
  781. return this.m_Param.parameter.experienceValue;
  782. }
  783. set
  784. {
  785. this.m_Param.parameter.experienceValue = value;
  786. }
  787. }
  788. public int facilityLevel
  789. {
  790. get
  791. {
  792. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  793. if (!facilityMgr)
  794. {
  795. NDebug.Assert("[Facility]施設マネージャクラスが見つかりません", false);
  796. return -1;
  797. }
  798. return facilityMgr.GetFacilityLevel(this.param.typeID);
  799. }
  800. }
  801. public SimpleExperienceSystem expSystem
  802. {
  803. get
  804. {
  805. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  806. if (!facilityMgr)
  807. {
  808. NDebug.Assert("[Facility]施設マネージャクラスが見つかりません", false);
  809. return null;
  810. }
  811. return facilityMgr.GetFacilityExpSystem(this.param.typeID);
  812. }
  813. }
  814. public int staffRankDayTime
  815. {
  816. get
  817. {
  818. int[] staffRankArray = this.defaultData.staffRankArray;
  819. int num = 0;
  820. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  821. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.DayTime);
  822. foreach (Maid maid in allocationMaidArray)
  823. {
  824. num += this.CalcStaffRank(maid);
  825. }
  826. int j;
  827. for (j = 0; j < staffRankArray.Length; j++)
  828. {
  829. if (num <= staffRankArray[j])
  830. {
  831. break;
  832. }
  833. }
  834. return j + 1;
  835. }
  836. }
  837. public int staffRankNight
  838. {
  839. get
  840. {
  841. int[] staffRankArray = this.defaultData.staffRankArray;
  842. int num = 0;
  843. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  844. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.Night);
  845. foreach (Maid maid in allocationMaidArray)
  846. {
  847. num += this.CalcStaffRank(maid);
  848. }
  849. int j;
  850. for (j = 0; j < staffRankArray.Length; j++)
  851. {
  852. if (num <= staffRankArray[j])
  853. {
  854. break;
  855. }
  856. }
  857. return j + 1;
  858. }
  859. }
  860. public int GetStaffRank(ScheduleMgr.ScheduleTime scheduleTime)
  861. {
  862. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  863. {
  864. return this.staffRankDayTime;
  865. }
  866. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  867. {
  868. return this.staffRankNight;
  869. }
  870. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  871. return -1;
  872. }
  873. private int CalcStaffRank(Maid maid)
  874. {
  875. return Facility.CalcStaffRank(maid, this.defaultData.businessType);
  876. }
  877. private static int CalcStaffRank(Maid maid, FacilityDataTable.BusinessType type)
  878. {
  879. Status status = maid.status;
  880. double num = 0.0;
  881. if (type != FacilityDataTable.BusinessType.接待系)
  882. {
  883. if (type != FacilityDataTable.BusinessType.営業系)
  884. {
  885. if (type != FacilityDataTable.BusinessType.アイドル系)
  886. {
  887. if (type == FacilityDataTable.BusinessType.無し)
  888. {
  889. num += Facility.ConvertRevisionStatus((double)status.lovely);
  890. num += Facility.ConvertRevisionStatus((double)status.elegance);
  891. num += Facility.ConvertRevisionStatus((double)status.charm);
  892. num += Facility.ConvertRevisionStatus((double)status.care);
  893. num += Facility.ConvertRevisionStatus((double)status.reception);
  894. num += Facility.ConvertRevisionStatus((double)status.cooking);
  895. num += Facility.ConvertRevisionStatus((double)status.vocal);
  896. num += Facility.ConvertRevisionStatus((double)status.dance);
  897. num += Facility.ConvertRevisionStatus((double)status.inyoku);
  898. num += Facility.ConvertRevisionStatus((double)status.mvalue);
  899. num += Facility.ConvertRevisionStatus((double)status.hentai);
  900. num += Facility.ConvertRevisionStatus((double)status.housi);
  901. num /= 6.0;
  902. }
  903. }
  904. else
  905. {
  906. num += Facility.ConvertRevisionStatus((double)status.lovely);
  907. num += Facility.ConvertRevisionStatus((double)status.elegance);
  908. num += Facility.ConvertRevisionStatus((double)status.charm);
  909. num += Facility.ConvertRevisionStatus((double)status.vocal);
  910. num += Facility.ConvertRevisionStatus((double)status.dance);
  911. num /= 3.0;
  912. }
  913. }
  914. else
  915. {
  916. num += Facility.ConvertRevisionStatus((double)status.lovely);
  917. num += Facility.ConvertRevisionStatus((double)status.elegance);
  918. num += Facility.ConvertRevisionStatus((double)status.charm);
  919. num += Facility.ConvertRevisionStatus((double)status.reception);
  920. num += Facility.ConvertRevisionStatus((double)status.inyoku);
  921. num += Facility.ConvertRevisionStatus((double)status.mvalue);
  922. num += Facility.ConvertRevisionStatus((double)status.hentai);
  923. num += Facility.ConvertRevisionStatus((double)status.housi);
  924. num /= 4.0;
  925. }
  926. }
  927. else
  928. {
  929. num += Facility.ConvertRevisionStatus((double)status.lovely);
  930. num += Facility.ConvertRevisionStatus((double)status.elegance);
  931. num += Facility.ConvertRevisionStatus((double)status.charm);
  932. num += Facility.ConvertRevisionStatus((double)status.care);
  933. num += Facility.ConvertRevisionStatus((double)status.cooking);
  934. num /= 3.0;
  935. }
  936. return (int)num;
  937. }
  938. private static double ConvertRevisionStatus(double value)
  939. {
  940. double num = (double)Mathf.Clamp((float)value, 0f, 9999f);
  941. return Math.Ceiling(value / 500.0);
  942. }
  943. public bool isOperationDayTime
  944. {
  945. get
  946. {
  947. return this.nowDayTimeMaidCount >= this.minMaidCount;
  948. }
  949. }
  950. public bool isOperationNight
  951. {
  952. get
  953. {
  954. return this.nowNightMaidCount >= this.minMaidCount;
  955. }
  956. }
  957. public bool IsOperation(ScheduleMgr.ScheduleTime scheduleTime)
  958. {
  959. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  960. {
  961. return this.isOperationDayTime;
  962. }
  963. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  964. {
  965. return this.isOperationNight;
  966. }
  967. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  968. return false;
  969. }
  970. public int minMaidCount
  971. {
  972. get
  973. {
  974. int result = 0;
  975. if (FacilityDataTable.IsExistFacilityData(this.param.typeID, true))
  976. {
  977. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  978. result = facilityDefaultData.minMaidCount;
  979. }
  980. else
  981. {
  982. Debug.LogErrorFormat("[Facility]施設の種類ID[{0}]の情報は存在しない", new object[]
  983. {
  984. this.param.typeID
  985. });
  986. }
  987. return result;
  988. }
  989. }
  990. public int maxMaidCount
  991. {
  992. get
  993. {
  994. int result = 0;
  995. if (FacilityDataTable.IsExistFacilityData(this.param.typeID, true))
  996. {
  997. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  998. result = facilityDefaultData.maxMaidCount;
  999. }
  1000. else
  1001. {
  1002. Debug.LogErrorFormat("[Facility]施設の種類ID[{0}]の情報は存在しない", new object[]
  1003. {
  1004. this.param.typeID
  1005. });
  1006. }
  1007. return result;
  1008. }
  1009. }
  1010. public int nowDayTimeMaidCount
  1011. {
  1012. get
  1013. {
  1014. return this.m_AllocationDayTimeMaidGuidList.Count;
  1015. }
  1016. }
  1017. public int nowNightMaidCount
  1018. {
  1019. get
  1020. {
  1021. return this.m_AllocationNightMaidGuidList.Count;
  1022. }
  1023. }
  1024. public int NowMaidCount(ScheduleMgr.ScheduleTime scheduleTime)
  1025. {
  1026. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1027. {
  1028. return this.nowDayTimeMaidCount;
  1029. }
  1030. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  1031. {
  1032. return this.nowNightMaidCount;
  1033. }
  1034. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1035. return 0;
  1036. }
  1037. public bool AllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1038. {
  1039. string guid = maid.status.guid;
  1040. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, scheduleTime);
  1041. if (maidAssignedFacility && maidAssignedFacility != this)
  1042. {
  1043. maidAssignedFacility.RemoveAllocationMaid(maid, scheduleTime);
  1044. }
  1045. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1046. {
  1047. if (this.m_AllocationDayTimeMaidGuidList.Contains(guid))
  1048. {
  1049. Debug.LogWarningFormat("メイド「{0}」は既に割り当てられています", new object[]
  1050. {
  1051. maid.name
  1052. });
  1053. return false;
  1054. }
  1055. if (this.m_BeforeAllocationDayTimeMaidGuidList.Contains(guid))
  1056. {
  1057. this.m_BeforeAllocationDayTimeMaidGuidList.Remove(guid);
  1058. }
  1059. this.m_AllocationDayTimeMaidGuidList.Add(guid);
  1060. }
  1061. else
  1062. {
  1063. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1064. {
  1065. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1066. return false;
  1067. }
  1068. if (this.m_AllocationNightMaidGuidList.Contains(guid))
  1069. {
  1070. Debug.LogWarningFormat("メイド「{0}」は既に割り当てられています", new object[]
  1071. {
  1072. maid.name
  1073. });
  1074. return false;
  1075. }
  1076. if (this.m_BeforeAllocationNightMaidGuidList.Contains(guid))
  1077. {
  1078. this.m_BeforeAllocationNightMaidGuidList.Remove(guid);
  1079. }
  1080. this.m_AllocationNightMaidGuidList.Add(guid);
  1081. }
  1082. return true;
  1083. }
  1084. public bool RemoveAllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1085. {
  1086. string guid = maid.status.guid;
  1087. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1088. {
  1089. if (!this.m_AllocationDayTimeMaidGuidList.Contains(guid))
  1090. {
  1091. Debug.LogWarningFormat("メイド「{0}」は割り当てられていません", new object[]
  1092. {
  1093. maid.name
  1094. });
  1095. return false;
  1096. }
  1097. this.m_AllocationDayTimeMaidGuidList.Remove(guid);
  1098. }
  1099. else
  1100. {
  1101. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1102. {
  1103. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1104. return false;
  1105. }
  1106. if (!this.m_AllocationNightMaidGuidList.Contains(guid))
  1107. {
  1108. Debug.LogWarningFormat("メイド「{0}」は割り当てられていません", new object[]
  1109. {
  1110. maid.name
  1111. });
  1112. return false;
  1113. }
  1114. this.m_AllocationNightMaidGuidList.Remove(guid);
  1115. }
  1116. return true;
  1117. }
  1118. public void UpdateAllocationMaidList()
  1119. {
  1120. this.UpdateAllocationDayTimeMaidList();
  1121. this.UpdateAllocationNightMaidList();
  1122. }
  1123. public void UpdateAllocationDayTimeMaidList()
  1124. {
  1125. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1126. List<string> list = new List<string>();
  1127. List<string> list2 = new List<string>();
  1128. List<string> list3 = new List<string>();
  1129. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.DayTime, ref list2);
  1130. for (int i = 0; i < allocationMaidArray.Length; i++)
  1131. {
  1132. list.Add(allocationMaidArray[i].status.guid);
  1133. }
  1134. foreach (string text in this.m_BeforeAllocationDayTimeMaidGuidList)
  1135. {
  1136. if (!string.IsNullOrEmpty(text))
  1137. {
  1138. Maid stockMaid = characterMgr.GetStockMaid(text);
  1139. if (stockMaid)
  1140. {
  1141. if (!GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(stockMaid, ScheduleMgr.ScheduleTime.DayTime))
  1142. {
  1143. if (ScheduleAPI.FacilitySlotActive(text, this, ScheduleMgr.ScheduleTime.DayTime))
  1144. {
  1145. list.Add(text);
  1146. }
  1147. else
  1148. {
  1149. list3.Add(text);
  1150. }
  1151. }
  1152. }
  1153. }
  1154. }
  1155. foreach (string item in list2)
  1156. {
  1157. if (!list3.Contains(item))
  1158. {
  1159. list3.Add(item);
  1160. }
  1161. }
  1162. this.m_AllocationDayTimeMaidGuidList = list;
  1163. this.m_BeforeAllocationDayTimeMaidGuidList = list3;
  1164. }
  1165. public void UpdateAllocationNightMaidList()
  1166. {
  1167. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1168. List<string> list = new List<string>();
  1169. List<string> list2 = new List<string>();
  1170. List<string> list3 = new List<string>();
  1171. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.Night, ref list2);
  1172. for (int i = 0; i < allocationMaidArray.Length; i++)
  1173. {
  1174. list.Add(allocationMaidArray[i].status.guid);
  1175. }
  1176. foreach (string text in this.m_BeforeAllocationNightMaidGuidList)
  1177. {
  1178. if (!string.IsNullOrEmpty(text))
  1179. {
  1180. Maid stockMaid = characterMgr.GetStockMaid(text);
  1181. if (stockMaid)
  1182. {
  1183. if (!GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(stockMaid, ScheduleMgr.ScheduleTime.Night))
  1184. {
  1185. if (ScheduleAPI.FacilitySlotActive(text, this, ScheduleMgr.ScheduleTime.Night))
  1186. {
  1187. list.Add(text);
  1188. }
  1189. else
  1190. {
  1191. list3.Add(text);
  1192. }
  1193. }
  1194. }
  1195. }
  1196. }
  1197. foreach (string item in list2)
  1198. {
  1199. if (!list3.Contains(item))
  1200. {
  1201. list3.Add(item);
  1202. }
  1203. }
  1204. this.m_AllocationNightMaidGuidList = list;
  1205. this.m_BeforeAllocationNightMaidGuidList = list3;
  1206. }
  1207. public Maid[] GetAllocationMaidArray(ScheduleMgr.ScheduleTime scheduleTime)
  1208. {
  1209. List<string> list = new List<string>();
  1210. return this.GetAllocationMaidArray(scheduleTime, ref list);
  1211. }
  1212. public Maid[] GetAllocationMaidArray(ScheduleMgr.ScheduleTime scheduleTime, ref List<string> excludeMaidList)
  1213. {
  1214. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1215. List<Maid> list = new List<Maid>();
  1216. List<string> list2 = new List<string>();
  1217. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1218. {
  1219. list2 = this.m_AllocationDayTimeMaidGuidList;
  1220. }
  1221. else
  1222. {
  1223. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1224. {
  1225. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1226. return null;
  1227. }
  1228. list2 = this.m_AllocationNightMaidGuidList;
  1229. }
  1230. int count = list2.Count;
  1231. for (int i = 0; i < count; i++)
  1232. {
  1233. string text = list2[i];
  1234. Maid maid = characterMgr.GetMaid(text);
  1235. if (maid == null)
  1236. {
  1237. maid = characterMgr.GetStockMaid(text);
  1238. }
  1239. if (maid != null)
  1240. {
  1241. if (ScheduleAPI.FacilitySlotActive(text, this, scheduleTime))
  1242. {
  1243. list.Add(maid);
  1244. }
  1245. else if (excludeMaidList != null)
  1246. {
  1247. excludeMaidList.Add(text);
  1248. }
  1249. }
  1250. else
  1251. {
  1252. Debug.LogFormat("GUID「{0}」のメイドがいなくなりました。", new object[]
  1253. {
  1254. text
  1255. });
  1256. }
  1257. }
  1258. return list.ToArray();
  1259. }
  1260. public bool IsAllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1261. {
  1262. bool result;
  1263. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1264. {
  1265. result = this.m_AllocationDayTimeMaidGuidList.Contains(maid.status.guid);
  1266. }
  1267. else
  1268. {
  1269. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1270. {
  1271. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1272. return false;
  1273. }
  1274. result = this.m_AllocationNightMaidGuidList.Contains(maid.status.guid);
  1275. }
  1276. return result;
  1277. }
  1278. public Facility.CostumeType typeCostume
  1279. {
  1280. get
  1281. {
  1282. return this.m_TypeCostume;
  1283. }
  1284. set
  1285. {
  1286. this.m_TypeCostume = value;
  1287. }
  1288. }
  1289. public string defaultName
  1290. {
  1291. get
  1292. {
  1293. return FacilityDataTable.GetFacilityStatus(this.param.typeID, true).name;
  1294. }
  1295. }
  1296. public string defaultTermName
  1297. {
  1298. get
  1299. {
  1300. return FacilityDataTable.GetFacilityStatus(this.param.typeID, true).termName;
  1301. }
  1302. }
  1303. public FacilityDataTable.FacilityDefaultData defaultData
  1304. {
  1305. get
  1306. {
  1307. return FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  1308. }
  1309. }
  1310. public string defaultCostumeThumbnailName
  1311. {
  1312. get
  1313. {
  1314. return FacilityDataTable.GetFacilityDefaultCostumeThumbnailName(this.param.typeID, true);
  1315. }
  1316. }
  1317. public string guid { get; private set; }
  1318. [SerializeField]
  1319. private Facility.FacilityStatus m_Param;
  1320. [SerializeField]
  1321. private Facility.RecipeData[] m_Recipe;
  1322. [SerializeField]
  1323. private Facility.CostumeType m_TypeCostume;
  1324. private Dictionary<MPN, KeyValuePair<bool, string>> m_EditCostumeArray;
  1325. private List<string> m_AllocationDayTimeMaidGuidList;
  1326. private List<string> m_AllocationNightMaidGuidList;
  1327. private List<string> m_BeforeAllocationDayTimeMaidGuidList;
  1328. private List<string> m_BeforeAllocationNightMaidGuidList;
  1329. public enum CostumeType
  1330. {
  1331. Default,
  1332. Edit,
  1333. Heroine
  1334. }
  1335. [Serializable]
  1336. public class FacilityStatus
  1337. {
  1338. public int typeID;
  1339. public string name = string.Empty;
  1340. public string termName = string.Empty;
  1341. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1342. }
  1343. [Serializable]
  1344. public class FacilityParameter
  1345. {
  1346. public FacilityParameter()
  1347. {
  1348. this.dataArray[0] = 0;
  1349. this.dataArray[1] = 0;
  1350. this.dataArray[2] = 0;
  1351. }
  1352. public FacilityParameter(int income_, int valuation_, int experienceValue_)
  1353. {
  1354. this.dataArray[0] = income_;
  1355. this.dataArray[1] = valuation_;
  1356. this.dataArray[2] = experienceValue_;
  1357. }
  1358. public int income
  1359. {
  1360. get
  1361. {
  1362. return this.dataArray[0];
  1363. }
  1364. set
  1365. {
  1366. this.dataArray[0] = value;
  1367. }
  1368. }
  1369. public int valuation
  1370. {
  1371. get
  1372. {
  1373. return this.dataArray[1];
  1374. }
  1375. set
  1376. {
  1377. this.dataArray[1] = value;
  1378. }
  1379. }
  1380. public int experienceValue
  1381. {
  1382. get
  1383. {
  1384. return this.dataArray[2];
  1385. }
  1386. set
  1387. {
  1388. this.dataArray[2] = value;
  1389. }
  1390. }
  1391. public int Length
  1392. {
  1393. get
  1394. {
  1395. return this.dataArray.Length;
  1396. }
  1397. }
  1398. public int this[int i]
  1399. {
  1400. get
  1401. {
  1402. switch (i)
  1403. {
  1404. case 0:
  1405. return this.income;
  1406. case 1:
  1407. return this.valuation;
  1408. case 2:
  1409. return this.experienceValue;
  1410. default:
  1411. Debug.LogError("[FacilityParameter]施設パラメータのインデクサーの添え字が範囲外です");
  1412. return 0;
  1413. }
  1414. }
  1415. set
  1416. {
  1417. switch (i)
  1418. {
  1419. case 0:
  1420. this.income = value;
  1421. break;
  1422. case 1:
  1423. this.valuation = value;
  1424. break;
  1425. case 2:
  1426. this.experienceValue = value;
  1427. break;
  1428. default:
  1429. Debug.LogError("[FacilityParameter]施設パラメータのインデクサーの添え字が範囲外です");
  1430. break;
  1431. }
  1432. }
  1433. }
  1434. public string GetParameterName(int parameterIndex)
  1435. {
  1436. return FacilityDataTable.GetFacilityParameterName(parameterIndex + 1);
  1437. }
  1438. public static Facility.FacilityParameter operator +(Facility.FacilityParameter a, Facility.FacilityParameter b)
  1439. {
  1440. return new Facility.FacilityParameter(a[0] + b[0], a[1] + b[1], a[2] + b[2]);
  1441. }
  1442. public static Facility.FacilityParameter operator -(Facility.FacilityParameter a, Facility.FacilityParameter b)
  1443. {
  1444. return new Facility.FacilityParameter(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
  1445. }
  1446. [SerializeField]
  1447. private int[] dataArray = new int[3];
  1448. }
  1449. public class PowerUpMaterial
  1450. {
  1451. public int id;
  1452. public string name = string.Empty;
  1453. public int categoryID;
  1454. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1455. }
  1456. public class PowerUpRecipe
  1457. {
  1458. public int id;
  1459. public string name = string.Empty;
  1460. public int[] materialCategoryIDArray;
  1461. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1462. }
  1463. [Serializable]
  1464. public class RecipeData
  1465. {
  1466. public RecipeData(int id_)
  1467. {
  1468. this.id = id_;
  1469. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(id_);
  1470. this.materialIDArray = new int[facilityPowerUpRecipe.materialCategoryIDArray.Length];
  1471. }
  1472. public Facility.FacilityParameter defaultParameter
  1473. {
  1474. get
  1475. {
  1476. return FacilityDataTable.GetFacilityPowerUpRecipe(this.id).parameter;
  1477. }
  1478. }
  1479. public Facility.FacilityParameter additionalParameter
  1480. {
  1481. get
  1482. {
  1483. return Facility.RecipeData.CalcFacilityParameter(this.materialIDArray);
  1484. }
  1485. }
  1486. public Facility.FacilityParameter parameter
  1487. {
  1488. get
  1489. {
  1490. return this.defaultParameter + this.additionalParameter;
  1491. }
  1492. }
  1493. public string name
  1494. {
  1495. get
  1496. {
  1497. return FacilityDataTable.GetFacilityRecipeData(this.id).name;
  1498. }
  1499. }
  1500. public static Facility.FacilityParameter CalcFacilityParameter(Facility.RecipeData recipeData)
  1501. {
  1502. return Facility.RecipeData.CalcFacilityParameter(recipeData.materialIDArray);
  1503. }
  1504. public static Facility.FacilityParameter CalcFacilityParameter(int[] materialIDArray)
  1505. {
  1506. Facility.FacilityParameter facilityParameter = new Facility.FacilityParameter();
  1507. if (materialIDArray != null)
  1508. {
  1509. for (int i = 0; i < materialIDArray.Length; i++)
  1510. {
  1511. if (FacilityDataTable.IsExistPowerUpMaterial(materialIDArray[i]))
  1512. {
  1513. facilityParameter += FacilityDataTable.GetFacilityPowerUpMaterial(materialIDArray[i]).parameter;
  1514. }
  1515. }
  1516. }
  1517. return facilityParameter;
  1518. }
  1519. public static Facility.FacilityParameter CalcFacilityDefaultParameter(int facilityTypeID)
  1520. {
  1521. Facility.FacilityParameter facilityParameter = new Facility.FacilityParameter();
  1522. if (FacilityDataTable.IsExistFacilityData(facilityTypeID, true) && FacilityDataTable.IsExistFacilityPowerUpRecipe(facilityTypeID, true))
  1523. {
  1524. int[] facilityPowerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(facilityTypeID, true);
  1525. for (int i = 0; i < facilityPowerUpRecipeIDArray.Length; i++)
  1526. {
  1527. facilityParameter += FacilityDataTable.GetFacilityPowerUpRecipe(facilityPowerUpRecipeIDArray[i]).parameter;
  1528. }
  1529. }
  1530. return facilityParameter;
  1531. }
  1532. public int id;
  1533. public int[] materialIDArray;
  1534. }
  1535. }