Facility.cs 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642
  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, false);
  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, false);
  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, maid.IsCrcBody);
  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. if (maid.IsCrcBody)
  530. {
  531. return;
  532. }
  533. int count = editCostumeArray.Count;
  534. List<MPN> list = new List<MPN>(editCostumeArray.Keys);
  535. List<KeyValuePair<bool, string>> list2 = new List<KeyValuePair<bool, string>>(editCostumeArray.Values);
  536. for (int i = 0; i < count; i++)
  537. {
  538. MaidProp prop = maid.GetProp(list[i]);
  539. prop.strTempFileName = string.Empty;
  540. prop.nTempFileNameRID = 0;
  541. if (!absoluteChange && !list2[i].Key)
  542. {
  543. maid.ResetProp(list[i], false);
  544. }
  545. else if (list2[i].Value == "del")
  546. {
  547. maid.DelProp(list[i], true);
  548. }
  549. else
  550. {
  551. maid.SetProp(list[i], list2[i].Value, 0, true, false);
  552. }
  553. }
  554. }
  555. public void UpdateEditCostumeToMaidCostume(Maid maid)
  556. {
  557. if (maid == null)
  558. {
  559. Debug.LogWarning(string.Format("[Facility]施設『{0}』のコスチューム設定メイドにnullが指定されました", this.facilityName));
  560. return;
  561. }
  562. StringBuilder stringBuilder = new StringBuilder();
  563. stringBuilder.AppendFormat("[Facility]施設『{0}』のコスチューム\n", this.facilityName);
  564. foreach (MPN mpn in FacilityDataTable.GetFacilityCostumeEnableMPN())
  565. {
  566. MaidProp prop = maid.GetProp(mpn);
  567. string strTempFileName = prop.strTempFileName;
  568. this.SetEditCostume(mpn, strTempFileName);
  569. stringBuilder.AppendFormat("<{0}\t{1}>\n", mpn, strTempFileName);
  570. }
  571. }
  572. public static string GetFacilityEditCostumeThumbnailPath()
  573. {
  574. return Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "Thumb") + "\\";
  575. }
  576. public string GetFacilityEditCostumeThumbnailName()
  577. {
  578. return "f_cos_tmp_" + this.guid + ".png";
  579. }
  580. public string GetFacilityEditCostumeThumbnailTrueName()
  581. {
  582. return "f_cos_" + this.guid + ".png";
  583. }
  584. public Texture2D GetEditCostumeThumbnail()
  585. {
  586. Texture2D result = null;
  587. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  588. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  589. {
  590. Directory.CreateDirectory(facilityEditCostumeThumbnailPath);
  591. }
  592. string text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  593. if (File.Exists(text))
  594. {
  595. result = UTY.LoadTexture(text);
  596. }
  597. else
  598. {
  599. text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  600. if (File.Exists(text))
  601. {
  602. result = UTY.LoadTexture(text);
  603. }
  604. }
  605. return result;
  606. }
  607. public bool IsExistEditCostumeThumbnail()
  608. {
  609. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  610. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  611. {
  612. return false;
  613. }
  614. string path = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  615. if (File.Exists(path))
  616. {
  617. return true;
  618. }
  619. path = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  620. return File.Exists(path);
  621. }
  622. public Texture2D GetDefaultCostumeThumbnail()
  623. {
  624. if (!string.IsNullOrEmpty(this.defaultCostumeThumbnailName))
  625. {
  626. string f_strFileName = this.defaultCostumeThumbnailName + ".tex";
  627. if (GameUty.FileSystem.IsExistentFile(f_strFileName))
  628. {
  629. return ImportCM.CreateTexture(f_strFileName);
  630. }
  631. Debug.LogWarningFormat("施設デフォルト衣装サムネイル「{0}」がない", new object[]
  632. {
  633. this.defaultCostumeThumbnailName
  634. });
  635. }
  636. else
  637. {
  638. Debug.LogWarningFormat("施設「{0}」のデフォルト衣装サムネイル名が空文字だった", new object[]
  639. {
  640. this.defaultName
  641. });
  642. }
  643. return null;
  644. }
  645. private void FixEditCostumeThumbnail()
  646. {
  647. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  648. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  649. {
  650. return;
  651. }
  652. string text = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailName();
  653. if (!File.Exists(text))
  654. {
  655. return;
  656. }
  657. string text2 = facilityEditCostumeThumbnailPath + this.GetFacilityEditCostumeThumbnailTrueName();
  658. try
  659. {
  660. if (File.Exists(text2))
  661. {
  662. File.Delete(text2);
  663. }
  664. File.Move(text, text2);
  665. }
  666. catch
  667. {
  668. }
  669. }
  670. public static void DeleteTmpEditCostumeThumnails()
  671. {
  672. string facilityEditCostumeThumbnailPath = Facility.GetFacilityEditCostumeThumbnailPath();
  673. if (!Directory.Exists(facilityEditCostumeThumbnailPath))
  674. {
  675. return;
  676. }
  677. string[] files = Directory.GetFiles(facilityEditCostumeThumbnailPath, "*", SearchOption.TopDirectoryOnly);
  678. for (int i = 0; i < files.Length; i++)
  679. {
  680. string text = string.Empty;
  681. try
  682. {
  683. text = files[i].Substring(facilityEditCostumeThumbnailPath.Length, files[i].Length - facilityEditCostumeThumbnailPath.Length);
  684. }
  685. catch
  686. {
  687. }
  688. if (string.IsNullOrEmpty(text))
  689. {
  690. files[i] = string.Empty;
  691. }
  692. else if (0 > text.IndexOf(".png") || 0 > text.IndexOf("f_cos_tmp_"))
  693. {
  694. files[i] = string.Empty;
  695. }
  696. }
  697. for (int j = 0; j < files.Length; j++)
  698. {
  699. if (!string.IsNullOrEmpty(files[j]))
  700. {
  701. try
  702. {
  703. File.Delete(files[j]);
  704. }
  705. catch
  706. {
  707. }
  708. }
  709. }
  710. }
  711. public void LoadFacilityBG()
  712. {
  713. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  714. if (facilityDefaultData == null)
  715. {
  716. return;
  717. }
  718. string fileName = facilityDefaultData.fileName;
  719. if (string.IsNullOrEmpty(fileName))
  720. {
  721. Debug.LogWarningFormat("[Facility]施設「{0}」の背景プレハブ名が空でした", new object[]
  722. {
  723. this.facilityName
  724. });
  725. return;
  726. }
  727. GameMain.Instance.BgMgr.ChangeBg(fileName);
  728. }
  729. public Facility.FacilityStatus param
  730. {
  731. get
  732. {
  733. return this.m_Param;
  734. }
  735. }
  736. public Facility.RecipeData[] recipe
  737. {
  738. get
  739. {
  740. return this.m_Recipe;
  741. }
  742. set
  743. {
  744. this.m_Recipe = value;
  745. }
  746. }
  747. public string facilityName
  748. {
  749. get
  750. {
  751. return this.m_Param.name;
  752. }
  753. set
  754. {
  755. this.m_Param.name = value;
  756. }
  757. }
  758. public int facilityIncome
  759. {
  760. get
  761. {
  762. return this.m_Param.parameter.income;
  763. }
  764. set
  765. {
  766. this.m_Param.parameter.income = value;
  767. }
  768. }
  769. public int facilityValuation
  770. {
  771. get
  772. {
  773. return this.m_Param.parameter.valuation;
  774. }
  775. set
  776. {
  777. this.m_Param.parameter.valuation = value;
  778. }
  779. }
  780. public int facilityExperienceValue
  781. {
  782. get
  783. {
  784. return this.m_Param.parameter.experienceValue;
  785. }
  786. set
  787. {
  788. this.m_Param.parameter.experienceValue = value;
  789. }
  790. }
  791. public int facilityLevel
  792. {
  793. get
  794. {
  795. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  796. if (!facilityMgr)
  797. {
  798. NDebug.Assert("[Facility]施設マネージャクラスが見つかりません", false);
  799. return -1;
  800. }
  801. return facilityMgr.GetFacilityLevel(this.param.typeID);
  802. }
  803. }
  804. public SimpleExperienceSystem expSystem
  805. {
  806. get
  807. {
  808. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  809. if (!facilityMgr)
  810. {
  811. NDebug.Assert("[Facility]施設マネージャクラスが見つかりません", false);
  812. return null;
  813. }
  814. return facilityMgr.GetFacilityExpSystem(this.param.typeID);
  815. }
  816. }
  817. public int staffRankDayTime
  818. {
  819. get
  820. {
  821. int[] staffRankArray = this.defaultData.staffRankArray;
  822. int num = 0;
  823. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  824. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.DayTime);
  825. foreach (Maid maid in allocationMaidArray)
  826. {
  827. num += this.CalcStaffRank(maid);
  828. }
  829. int j;
  830. for (j = 0; j < staffRankArray.Length; j++)
  831. {
  832. if (num <= staffRankArray[j])
  833. {
  834. break;
  835. }
  836. }
  837. return j + 1;
  838. }
  839. }
  840. public int staffRankNight
  841. {
  842. get
  843. {
  844. int[] staffRankArray = this.defaultData.staffRankArray;
  845. int num = 0;
  846. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  847. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.Night);
  848. foreach (Maid maid in allocationMaidArray)
  849. {
  850. num += this.CalcStaffRank(maid);
  851. }
  852. int j;
  853. for (j = 0; j < staffRankArray.Length; j++)
  854. {
  855. if (num <= staffRankArray[j])
  856. {
  857. break;
  858. }
  859. }
  860. return j + 1;
  861. }
  862. }
  863. public int GetStaffRank(ScheduleMgr.ScheduleTime scheduleTime)
  864. {
  865. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  866. {
  867. return this.staffRankDayTime;
  868. }
  869. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  870. {
  871. return this.staffRankNight;
  872. }
  873. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  874. return -1;
  875. }
  876. private int CalcStaffRank(Maid maid)
  877. {
  878. return Facility.CalcStaffRank(maid, this.defaultData.businessType);
  879. }
  880. private static int CalcStaffRank(Maid maid, FacilityDataTable.BusinessType type)
  881. {
  882. Status status = maid.status;
  883. double num = 0.0;
  884. if (type != FacilityDataTable.BusinessType.接待系)
  885. {
  886. if (type != FacilityDataTable.BusinessType.営業系)
  887. {
  888. if (type != FacilityDataTable.BusinessType.アイドル系)
  889. {
  890. if (type == FacilityDataTable.BusinessType.無し)
  891. {
  892. num += Facility.ConvertRevisionStatus((double)status.lovely);
  893. num += Facility.ConvertRevisionStatus((double)status.elegance);
  894. num += Facility.ConvertRevisionStatus((double)status.charm);
  895. num += Facility.ConvertRevisionStatus((double)status.care);
  896. num += Facility.ConvertRevisionStatus((double)status.reception);
  897. num += Facility.ConvertRevisionStatus((double)status.cooking);
  898. num += Facility.ConvertRevisionStatus((double)status.vocal);
  899. num += Facility.ConvertRevisionStatus((double)status.dance);
  900. num += Facility.ConvertRevisionStatus((double)status.inyoku);
  901. num += Facility.ConvertRevisionStatus((double)status.mvalue);
  902. num += Facility.ConvertRevisionStatus((double)status.hentai);
  903. num += Facility.ConvertRevisionStatus((double)status.housi);
  904. num /= 6.0;
  905. }
  906. }
  907. else
  908. {
  909. num += Facility.ConvertRevisionStatus((double)status.lovely);
  910. num += Facility.ConvertRevisionStatus((double)status.elegance);
  911. num += Facility.ConvertRevisionStatus((double)status.charm);
  912. num += Facility.ConvertRevisionStatus((double)status.vocal);
  913. num += Facility.ConvertRevisionStatus((double)status.dance);
  914. num /= 3.0;
  915. }
  916. }
  917. else
  918. {
  919. num += Facility.ConvertRevisionStatus((double)status.lovely);
  920. num += Facility.ConvertRevisionStatus((double)status.elegance);
  921. num += Facility.ConvertRevisionStatus((double)status.charm);
  922. num += Facility.ConvertRevisionStatus((double)status.reception);
  923. num += Facility.ConvertRevisionStatus((double)status.inyoku);
  924. num += Facility.ConvertRevisionStatus((double)status.mvalue);
  925. num += Facility.ConvertRevisionStatus((double)status.hentai);
  926. num += Facility.ConvertRevisionStatus((double)status.housi);
  927. num /= 4.0;
  928. }
  929. }
  930. else
  931. {
  932. num += Facility.ConvertRevisionStatus((double)status.lovely);
  933. num += Facility.ConvertRevisionStatus((double)status.elegance);
  934. num += Facility.ConvertRevisionStatus((double)status.charm);
  935. num += Facility.ConvertRevisionStatus((double)status.care);
  936. num += Facility.ConvertRevisionStatus((double)status.cooking);
  937. num /= 3.0;
  938. }
  939. return (int)num;
  940. }
  941. private static double ConvertRevisionStatus(double value)
  942. {
  943. double num = (double)Mathf.Clamp((float)value, 0f, 9999f);
  944. return Math.Ceiling(value / 500.0);
  945. }
  946. public bool isOperationDayTime
  947. {
  948. get
  949. {
  950. return this.nowDayTimeMaidCount >= this.minMaidCount;
  951. }
  952. }
  953. public bool isOperationNight
  954. {
  955. get
  956. {
  957. return this.nowNightMaidCount >= this.minMaidCount;
  958. }
  959. }
  960. public bool IsOperation(ScheduleMgr.ScheduleTime scheduleTime)
  961. {
  962. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  963. {
  964. return this.isOperationDayTime;
  965. }
  966. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  967. {
  968. return this.isOperationNight;
  969. }
  970. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  971. return false;
  972. }
  973. public int minMaidCount
  974. {
  975. get
  976. {
  977. int result = 0;
  978. if (FacilityDataTable.IsExistFacilityData(this.param.typeID, true))
  979. {
  980. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  981. result = facilityDefaultData.minMaidCount;
  982. }
  983. else
  984. {
  985. Debug.LogErrorFormat("[Facility]施設の種類ID[{0}]の情報は存在しない", new object[]
  986. {
  987. this.param.typeID
  988. });
  989. }
  990. return result;
  991. }
  992. }
  993. public int maxMaidCount
  994. {
  995. get
  996. {
  997. int result = 0;
  998. if (FacilityDataTable.IsExistFacilityData(this.param.typeID, true))
  999. {
  1000. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  1001. result = facilityDefaultData.maxMaidCount;
  1002. }
  1003. else
  1004. {
  1005. Debug.LogErrorFormat("[Facility]施設の種類ID[{0}]の情報は存在しない", new object[]
  1006. {
  1007. this.param.typeID
  1008. });
  1009. }
  1010. return result;
  1011. }
  1012. }
  1013. public int nowDayTimeMaidCount
  1014. {
  1015. get
  1016. {
  1017. return this.m_AllocationDayTimeMaidGuidList.Count;
  1018. }
  1019. }
  1020. public int nowNightMaidCount
  1021. {
  1022. get
  1023. {
  1024. return this.m_AllocationNightMaidGuidList.Count;
  1025. }
  1026. }
  1027. public int NowMaidCount(ScheduleMgr.ScheduleTime scheduleTime)
  1028. {
  1029. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1030. {
  1031. return this.nowDayTimeMaidCount;
  1032. }
  1033. if (scheduleTime == ScheduleMgr.ScheduleTime.Night)
  1034. {
  1035. return this.nowNightMaidCount;
  1036. }
  1037. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1038. return 0;
  1039. }
  1040. public bool AllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1041. {
  1042. string guid = maid.status.guid;
  1043. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, scheduleTime);
  1044. if (maidAssignedFacility && maidAssignedFacility != this)
  1045. {
  1046. maidAssignedFacility.RemoveAllocationMaid(maid, scheduleTime);
  1047. }
  1048. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1049. {
  1050. if (this.m_AllocationDayTimeMaidGuidList.Contains(guid))
  1051. {
  1052. Debug.LogWarningFormat("メイド「{0}」は既に割り当てられています", new object[]
  1053. {
  1054. maid.name
  1055. });
  1056. return false;
  1057. }
  1058. if (this.m_BeforeAllocationDayTimeMaidGuidList.Contains(guid))
  1059. {
  1060. this.m_BeforeAllocationDayTimeMaidGuidList.Remove(guid);
  1061. }
  1062. this.m_AllocationDayTimeMaidGuidList.Add(guid);
  1063. }
  1064. else
  1065. {
  1066. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1067. {
  1068. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1069. return false;
  1070. }
  1071. if (this.m_AllocationNightMaidGuidList.Contains(guid))
  1072. {
  1073. Debug.LogWarningFormat("メイド「{0}」は既に割り当てられています", new object[]
  1074. {
  1075. maid.name
  1076. });
  1077. return false;
  1078. }
  1079. if (this.m_BeforeAllocationNightMaidGuidList.Contains(guid))
  1080. {
  1081. this.m_BeforeAllocationNightMaidGuidList.Remove(guid);
  1082. }
  1083. this.m_AllocationNightMaidGuidList.Add(guid);
  1084. }
  1085. return true;
  1086. }
  1087. public bool RemoveAllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1088. {
  1089. string guid = maid.status.guid;
  1090. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1091. {
  1092. if (!this.m_AllocationDayTimeMaidGuidList.Contains(guid))
  1093. {
  1094. Debug.LogWarningFormat("メイド「{0}」は割り当てられていません", new object[]
  1095. {
  1096. maid.name
  1097. });
  1098. return false;
  1099. }
  1100. this.m_AllocationDayTimeMaidGuidList.Remove(guid);
  1101. }
  1102. else
  1103. {
  1104. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1105. {
  1106. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1107. return false;
  1108. }
  1109. if (!this.m_AllocationNightMaidGuidList.Contains(guid))
  1110. {
  1111. Debug.LogWarningFormat("メイド「{0}」は割り当てられていません", new object[]
  1112. {
  1113. maid.name
  1114. });
  1115. return false;
  1116. }
  1117. this.m_AllocationNightMaidGuidList.Remove(guid);
  1118. }
  1119. return true;
  1120. }
  1121. public void UpdateAllocationMaidList()
  1122. {
  1123. this.UpdateAllocationDayTimeMaidList();
  1124. this.UpdateAllocationNightMaidList();
  1125. }
  1126. public void UpdateAllocationDayTimeMaidList()
  1127. {
  1128. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1129. List<string> list = new List<string>();
  1130. List<string> list2 = new List<string>();
  1131. List<string> list3 = new List<string>();
  1132. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.DayTime, ref list2);
  1133. for (int i = 0; i < allocationMaidArray.Length; i++)
  1134. {
  1135. list.Add(allocationMaidArray[i].status.guid);
  1136. }
  1137. foreach (string text in this.m_BeforeAllocationDayTimeMaidGuidList)
  1138. {
  1139. if (!string.IsNullOrEmpty(text))
  1140. {
  1141. Maid stockMaid = characterMgr.GetStockMaid(text);
  1142. if (stockMaid)
  1143. {
  1144. if (!GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(stockMaid, ScheduleMgr.ScheduleTime.DayTime))
  1145. {
  1146. if (ScheduleAPI.FacilitySlotActive(text, this, ScheduleMgr.ScheduleTime.DayTime))
  1147. {
  1148. list.Add(text);
  1149. }
  1150. else
  1151. {
  1152. list3.Add(text);
  1153. }
  1154. }
  1155. }
  1156. }
  1157. }
  1158. foreach (string item in list2)
  1159. {
  1160. if (!list3.Contains(item))
  1161. {
  1162. list3.Add(item);
  1163. }
  1164. }
  1165. this.m_AllocationDayTimeMaidGuidList = list;
  1166. this.m_BeforeAllocationDayTimeMaidGuidList = list3;
  1167. }
  1168. public void UpdateAllocationNightMaidList()
  1169. {
  1170. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1171. List<string> list = new List<string>();
  1172. List<string> list2 = new List<string>();
  1173. List<string> list3 = new List<string>();
  1174. Maid[] allocationMaidArray = this.GetAllocationMaidArray(ScheduleMgr.ScheduleTime.Night, ref list2);
  1175. for (int i = 0; i < allocationMaidArray.Length; i++)
  1176. {
  1177. list.Add(allocationMaidArray[i].status.guid);
  1178. }
  1179. foreach (string text in this.m_BeforeAllocationNightMaidGuidList)
  1180. {
  1181. if (!string.IsNullOrEmpty(text))
  1182. {
  1183. Maid stockMaid = characterMgr.GetStockMaid(text);
  1184. if (stockMaid)
  1185. {
  1186. if (!GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(stockMaid, ScheduleMgr.ScheduleTime.Night))
  1187. {
  1188. if (ScheduleAPI.FacilitySlotActive(text, this, ScheduleMgr.ScheduleTime.Night))
  1189. {
  1190. list.Add(text);
  1191. }
  1192. else
  1193. {
  1194. list3.Add(text);
  1195. }
  1196. }
  1197. }
  1198. }
  1199. }
  1200. foreach (string item in list2)
  1201. {
  1202. if (!list3.Contains(item))
  1203. {
  1204. list3.Add(item);
  1205. }
  1206. }
  1207. this.m_AllocationNightMaidGuidList = list;
  1208. this.m_BeforeAllocationNightMaidGuidList = list3;
  1209. }
  1210. public Maid[] GetAllocationMaidArray(ScheduleMgr.ScheduleTime scheduleTime)
  1211. {
  1212. List<string> list = new List<string>();
  1213. return this.GetAllocationMaidArray(scheduleTime, ref list);
  1214. }
  1215. public Maid[] GetAllocationMaidArray(ScheduleMgr.ScheduleTime scheduleTime, ref List<string> excludeMaidList)
  1216. {
  1217. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1218. List<Maid> list = new List<Maid>();
  1219. List<string> list2 = new List<string>();
  1220. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1221. {
  1222. list2 = this.m_AllocationDayTimeMaidGuidList;
  1223. }
  1224. else
  1225. {
  1226. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1227. {
  1228. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1229. return null;
  1230. }
  1231. list2 = this.m_AllocationNightMaidGuidList;
  1232. }
  1233. int count = list2.Count;
  1234. for (int i = 0; i < count; i++)
  1235. {
  1236. string text = list2[i];
  1237. Maid maid = characterMgr.GetMaid(text);
  1238. if (maid == null)
  1239. {
  1240. maid = characterMgr.GetStockMaid(text);
  1241. }
  1242. if (maid != null)
  1243. {
  1244. if (ScheduleAPI.FacilitySlotActive(text, this, scheduleTime))
  1245. {
  1246. list.Add(maid);
  1247. }
  1248. else if (excludeMaidList != null)
  1249. {
  1250. excludeMaidList.Add(text);
  1251. }
  1252. }
  1253. else
  1254. {
  1255. Debug.LogFormat("GUID「{0}」のメイドがいなくなりました。", new object[]
  1256. {
  1257. text
  1258. });
  1259. }
  1260. }
  1261. return list.ToArray();
  1262. }
  1263. public bool IsAllocationMaid(Maid maid, ScheduleMgr.ScheduleTime scheduleTime)
  1264. {
  1265. bool result;
  1266. if (scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  1267. {
  1268. result = this.m_AllocationDayTimeMaidGuidList.Contains(maid.status.guid);
  1269. }
  1270. else
  1271. {
  1272. if (scheduleTime != ScheduleMgr.ScheduleTime.Night)
  1273. {
  1274. NDebug.Assert(string.Format("スケジュール時間帯に不正な値が入りました\n時間帯:{0}", scheduleTime), false);
  1275. return false;
  1276. }
  1277. result = this.m_AllocationNightMaidGuidList.Contains(maid.status.guid);
  1278. }
  1279. return result;
  1280. }
  1281. public Facility.CostumeType typeCostume
  1282. {
  1283. get
  1284. {
  1285. return this.m_TypeCostume;
  1286. }
  1287. set
  1288. {
  1289. this.m_TypeCostume = value;
  1290. }
  1291. }
  1292. public string defaultName
  1293. {
  1294. get
  1295. {
  1296. return FacilityDataTable.GetFacilityStatus(this.param.typeID, true).name;
  1297. }
  1298. }
  1299. public string defaultTermName
  1300. {
  1301. get
  1302. {
  1303. return FacilityDataTable.GetFacilityStatus(this.param.typeID, true).termName;
  1304. }
  1305. }
  1306. public FacilityDataTable.FacilityDefaultData defaultData
  1307. {
  1308. get
  1309. {
  1310. return FacilityDataTable.GetFacilityDefaultData(this.param.typeID, true);
  1311. }
  1312. }
  1313. public string defaultCostumeThumbnailName
  1314. {
  1315. get
  1316. {
  1317. return FacilityDataTable.GetFacilityDefaultCostumeThumbnailName(this.param.typeID, true);
  1318. }
  1319. }
  1320. public string guid { get; private set; }
  1321. [SerializeField]
  1322. private Facility.FacilityStatus m_Param;
  1323. [SerializeField]
  1324. private Facility.RecipeData[] m_Recipe;
  1325. [SerializeField]
  1326. private Facility.CostumeType m_TypeCostume;
  1327. private Dictionary<MPN, KeyValuePair<bool, string>> m_EditCostumeArray;
  1328. private List<string> m_AllocationDayTimeMaidGuidList;
  1329. private List<string> m_AllocationNightMaidGuidList;
  1330. private List<string> m_BeforeAllocationDayTimeMaidGuidList;
  1331. private List<string> m_BeforeAllocationNightMaidGuidList;
  1332. public enum CostumeType
  1333. {
  1334. Default,
  1335. Edit,
  1336. Heroine
  1337. }
  1338. [Serializable]
  1339. public class FacilityStatus
  1340. {
  1341. public int typeID;
  1342. public string name = string.Empty;
  1343. public string termName = string.Empty;
  1344. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1345. }
  1346. [Serializable]
  1347. public class FacilityParameter
  1348. {
  1349. public FacilityParameter()
  1350. {
  1351. this.dataArray[0] = 0;
  1352. this.dataArray[1] = 0;
  1353. this.dataArray[2] = 0;
  1354. }
  1355. public FacilityParameter(int income_, int valuation_, int experienceValue_)
  1356. {
  1357. this.dataArray[0] = income_;
  1358. this.dataArray[1] = valuation_;
  1359. this.dataArray[2] = experienceValue_;
  1360. }
  1361. public int income
  1362. {
  1363. get
  1364. {
  1365. return this.dataArray[0];
  1366. }
  1367. set
  1368. {
  1369. this.dataArray[0] = value;
  1370. }
  1371. }
  1372. public int valuation
  1373. {
  1374. get
  1375. {
  1376. return this.dataArray[1];
  1377. }
  1378. set
  1379. {
  1380. this.dataArray[1] = value;
  1381. }
  1382. }
  1383. public int experienceValue
  1384. {
  1385. get
  1386. {
  1387. return this.dataArray[2];
  1388. }
  1389. set
  1390. {
  1391. this.dataArray[2] = value;
  1392. }
  1393. }
  1394. public int Length
  1395. {
  1396. get
  1397. {
  1398. return this.dataArray.Length;
  1399. }
  1400. }
  1401. public int this[int i]
  1402. {
  1403. get
  1404. {
  1405. switch (i)
  1406. {
  1407. case 0:
  1408. return this.income;
  1409. case 1:
  1410. return this.valuation;
  1411. case 2:
  1412. return this.experienceValue;
  1413. default:
  1414. Debug.LogError("[FacilityParameter]施設パラメータのインデクサーの添え字が範囲外です");
  1415. return 0;
  1416. }
  1417. }
  1418. set
  1419. {
  1420. switch (i)
  1421. {
  1422. case 0:
  1423. this.income = value;
  1424. break;
  1425. case 1:
  1426. this.valuation = value;
  1427. break;
  1428. case 2:
  1429. this.experienceValue = value;
  1430. break;
  1431. default:
  1432. Debug.LogError("[FacilityParameter]施設パラメータのインデクサーの添え字が範囲外です");
  1433. break;
  1434. }
  1435. }
  1436. }
  1437. public string GetParameterName(int parameterIndex)
  1438. {
  1439. return FacilityDataTable.GetFacilityParameterName(parameterIndex + 1);
  1440. }
  1441. public static Facility.FacilityParameter operator +(Facility.FacilityParameter a, Facility.FacilityParameter b)
  1442. {
  1443. return new Facility.FacilityParameter(a[0] + b[0], a[1] + b[1], a[2] + b[2]);
  1444. }
  1445. public static Facility.FacilityParameter operator -(Facility.FacilityParameter a, Facility.FacilityParameter b)
  1446. {
  1447. return new Facility.FacilityParameter(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
  1448. }
  1449. [SerializeField]
  1450. private int[] dataArray = new int[3];
  1451. }
  1452. public class PowerUpMaterial
  1453. {
  1454. public int id;
  1455. public string name = string.Empty;
  1456. public int categoryID;
  1457. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1458. }
  1459. public class PowerUpRecipe
  1460. {
  1461. public int id;
  1462. public string name = string.Empty;
  1463. public int[] materialCategoryIDArray;
  1464. public Facility.FacilityParameter parameter = new Facility.FacilityParameter();
  1465. }
  1466. [Serializable]
  1467. public class RecipeData
  1468. {
  1469. public RecipeData(int id_)
  1470. {
  1471. this.id = id_;
  1472. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(id_);
  1473. this.materialIDArray = new int[facilityPowerUpRecipe.materialCategoryIDArray.Length];
  1474. }
  1475. public Facility.FacilityParameter defaultParameter
  1476. {
  1477. get
  1478. {
  1479. return FacilityDataTable.GetFacilityPowerUpRecipe(this.id).parameter;
  1480. }
  1481. }
  1482. public Facility.FacilityParameter additionalParameter
  1483. {
  1484. get
  1485. {
  1486. return Facility.RecipeData.CalcFacilityParameter(this.materialIDArray);
  1487. }
  1488. }
  1489. public Facility.FacilityParameter parameter
  1490. {
  1491. get
  1492. {
  1493. return this.defaultParameter + this.additionalParameter;
  1494. }
  1495. }
  1496. public string name
  1497. {
  1498. get
  1499. {
  1500. return FacilityDataTable.GetFacilityRecipeData(this.id).name;
  1501. }
  1502. }
  1503. public static Facility.FacilityParameter CalcFacilityParameter(Facility.RecipeData recipeData)
  1504. {
  1505. return Facility.RecipeData.CalcFacilityParameter(recipeData.materialIDArray);
  1506. }
  1507. public static Facility.FacilityParameter CalcFacilityParameter(int[] materialIDArray)
  1508. {
  1509. Facility.FacilityParameter facilityParameter = new Facility.FacilityParameter();
  1510. if (materialIDArray != null)
  1511. {
  1512. for (int i = 0; i < materialIDArray.Length; i++)
  1513. {
  1514. if (FacilityDataTable.IsExistPowerUpMaterial(materialIDArray[i]))
  1515. {
  1516. facilityParameter += FacilityDataTable.GetFacilityPowerUpMaterial(materialIDArray[i]).parameter;
  1517. }
  1518. }
  1519. }
  1520. return facilityParameter;
  1521. }
  1522. public static Facility.FacilityParameter CalcFacilityDefaultParameter(int facilityTypeID)
  1523. {
  1524. Facility.FacilityParameter facilityParameter = new Facility.FacilityParameter();
  1525. if (FacilityDataTable.IsExistFacilityData(facilityTypeID, true) && FacilityDataTable.IsExistFacilityPowerUpRecipe(facilityTypeID, true))
  1526. {
  1527. int[] facilityPowerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(facilityTypeID, true);
  1528. for (int i = 0; i < facilityPowerUpRecipeIDArray.Length; i++)
  1529. {
  1530. facilityParameter += FacilityDataTable.GetFacilityPowerUpRecipe(facilityPowerUpRecipeIDArray[i]).parameter;
  1531. }
  1532. }
  1533. return facilityParameter;
  1534. }
  1535. public int id;
  1536. public int[] materialIDArray;
  1537. }
  1538. }