Facility.cs 42 KB

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