Facility.cs 42 KB

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