Facility.cs 42 KB

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