SceneFacilityManagement.cs 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using PlayerStatus;
  5. using UnityEngine;
  6. using UnityEngine.Events;
  7. using UnityEngine.UI;
  8. public class SceneFacilityManagement : MonoBehaviour
  9. {
  10. private FacilityManager FacilityMgr
  11. {
  12. get
  13. {
  14. if (this.m_FacilityMgr == null)
  15. {
  16. this.m_FacilityMgr = GameMain.Instance.FacilityMgr;
  17. }
  18. return this.m_FacilityMgr;
  19. }
  20. }
  21. public FacilityInfoUI UIFacilityInfoBottomViewer
  22. {
  23. get
  24. {
  25. return this.m_UIFacilityInfoConstruction;
  26. }
  27. }
  28. public bool enableSetUpCameraAndBG
  29. {
  30. get
  31. {
  32. return this.m_EnableSetUpCameraAndBG;
  33. }
  34. set
  35. {
  36. this.m_EnableSetUpCameraAndBG = value;
  37. }
  38. }
  39. public long nowMoney
  40. {
  41. get
  42. {
  43. Status status = GameMain.Instance.CharacterMgr.status;
  44. return status.money;
  45. }
  46. set
  47. {
  48. Status status = GameMain.Instance.CharacterMgr.status;
  49. status.money = value;
  50. this.UpdateTextNumber(this.m_UITextNowMoney, value);
  51. }
  52. }
  53. public long nowCost
  54. {
  55. get
  56. {
  57. return this.m_NowCost;
  58. }
  59. set
  60. {
  61. this.m_NowCost = value;
  62. this.UpdateTextNumber(this.m_UITextNowCost, value);
  63. }
  64. }
  65. private void Awake()
  66. {
  67. if (this.m_StartDestroyEventObject != null)
  68. {
  69. this.m_StartDestroyEventObject.m_EventOnStart.AddListener(delegate
  70. {
  71. GameMain.Instance.SoundMgr.PlayBGM(this.m_PlayBGM, 0.5f, true);
  72. });
  73. }
  74. }
  75. private void Start()
  76. {
  77. if (this.m_UIClubStatusViewer)
  78. {
  79. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  80. }
  81. if (this.enableSetUpCameraAndBG)
  82. {
  83. this.SetUpBackGroundAndCamera();
  84. }
  85. this.UpdateTextNumber(this.m_UITextNowMoney, this.nowMoney);
  86. this.UpdateTextNumber(this.m_UITextNowCost, this.nowCost);
  87. this.m_UITextNowMoney.transform.parent.gameObject.SetActive(false);
  88. this.m_UITextNowCost.transform.parent.gameObject.SetActive(false);
  89. int typeID = FacilityDataTable.GetFacilityStatusArray(true)[0].typeID;
  90. this.m_CreatingFacility = GameMain.Instance.FacilityMgr.CreateNewFacility(typeID);
  91. this.m_CreatingFacility.transform.SetParent(base.transform, false);
  92. this.OpenFacilityUIConstruction();
  93. this.GetTagBackup();
  94. }
  95. private void SetUpBackGroundAndCamera()
  96. {
  97. GameMain.Instance.BgMgr.ChangeBg("EmpireClub_Entrance");
  98. GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color));
  99. CameraMain mainCamera = GameMain.Instance.MainCamera;
  100. GameMain.Instance.MainLight.Reset();
  101. mainCamera.Reset(CameraMain.CameraType.Target, false);
  102. mainCamera.SetTargetPos(new Vector3(0f, 5.5f, 11f), true);
  103. mainCamera.SetDistance(1.4f, true);
  104. mainCamera.SetAroundAngle(new Vector2(180f, 3f), true);
  105. mainCamera.SetTargetOffset(Vector3.zero, false);
  106. }
  107. private void UpdateTextNumber(Text text, long number)
  108. {
  109. text.text = string.Format("{0:#,0}", number);
  110. }
  111. public long CalcNowCost()
  112. {
  113. long num = 0L;
  114. Dictionary<int, Facility> nextDayFacilityArray = this.FacilityMgr.GetNextDayFacilityArray();
  115. List<Facility> list = new List<Facility>(nextDayFacilityArray.Values);
  116. for (int i = 0; i < list.Count; i++)
  117. {
  118. Facility facility = list[i];
  119. if (facility != null)
  120. {
  121. num += (long)FacilityDataTable.GetFacilityDefaultCost(facility.param.typeID, true);
  122. }
  123. }
  124. return num;
  125. }
  126. public void OpenDialog(string messageText, SystemDialog.TYPE openType, Action actionOK, Action actionCANCEL)
  127. {
  128. uGUIUtility.SetActiveEventSystem(false);
  129. GameMain.Instance.SysDlg.Show(messageText, openType, delegate
  130. {
  131. GameMain.Instance.SysDlg.Close();
  132. uGUIUtility.SetActiveEventSystem(true);
  133. if (actionOK != null)
  134. {
  135. actionOK();
  136. }
  137. }, delegate
  138. {
  139. GameMain.Instance.SysDlg.Close();
  140. uGUIUtility.SetActiveEventSystem(true);
  141. if (actionCANCEL != null)
  142. {
  143. actionCANCEL();
  144. }
  145. });
  146. }
  147. private void ButtonEvent_OK_OpenMainMenu()
  148. {
  149. this.ButtonEventSceneClose();
  150. }
  151. private void SetMoneyParamWindowVisible(bool isVisible)
  152. {
  153. Transform parent = this.m_UITextNowMoney.transform.parent;
  154. if (parent)
  155. {
  156. parent.gameObject.SetActive(isVisible);
  157. }
  158. }
  159. public void OpenFacilityUIMaidSchedule()
  160. {
  161. this.m_UIMainMenu.gameObject.SetActive(true);
  162. this.m_UIFacilityDetails.gameObject.SetActive(true);
  163. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  164. this.m_UIFacilityTypeList.gameObject.SetActive(false);
  165. this.m_UIFacilityCostume.gameObject.SetActive(false);
  166. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  167. this.m_UIButtonOK.gameObject.SetActive(true);
  168. this.m_UIButtonRESET.gameObject.SetActive(true);
  169. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  170. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(true);
  171. if (this.m_UIClubStatusViewer)
  172. {
  173. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  174. }
  175. this.SetMoneyParamWindowVisible(true);
  176. this.nowMoney = this.nowMoney;
  177. this.nowCost = this.CalcNowCost();
  178. this.m_UIToggleVisibleFacilityInfo.isOn = false;
  179. this.m_UIButtonOK.onClick.RemoveAllListeners();
  180. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  181. this.SetOKButtonEnable(true);
  182. this.m_UIFacilityInfoConstruction.gameObject.SetActive(false);
  183. this.m_UIButtonRESET.interactable = (this.FacilityMgr.GetNextDayFacilityArray().Count > 0);
  184. int facilityCountMax = this.FacilityMgr.FacilityCountMax;
  185. uGUIListViewer component = this.m_UIFacilityDetails.GetComponent<uGUIListViewer>();
  186. component.Show<Transform>(facilityCountMax, delegate(int i, Transform trans)
  187. {
  188. GameObject gameObject = trans.gameObject;
  189. SceneFacilityManagement.FacilityDetailsUI facilityDetailsUI = gameObject.AddComponent<SceneFacilityManagement.FacilityDetailsUI>();
  190. Facility facility = this.FacilityMgr.GetFacility(i);
  191. if (facility == null)
  192. {
  193. facilityDetailsUI.m_Button.gameObject.SetActive(false);
  194. facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(0f, 0f, 0f, 0.25f);
  195. ColorBlock colors = facilityDetailsUI.m_Toggle.colors;
  196. Color highlightedColor = colors.highlightedColor;
  197. highlightedColor.a = 0f;
  198. colors.highlightedColor = highlightedColor;
  199. facilityDetailsUI.m_Toggle.colors = colors;
  200. }
  201. else
  202. {
  203. facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(1f, 1f, 1f, 1f);
  204. }
  205. FacilityInfoUI component2 = trans.GetComponent<FacilityInfoUI>();
  206. component2.SetFacilityInfo(facility, false);
  207. component2.SetNameChangeEnable(facility != null);
  208. facilityDetailsUI.m_Toggle.onValueChanged.RemoveAllListeners();
  209. facilityDetailsUI.m_Toggle.onValueChanged.AddListener(delegate(bool value)
  210. {
  211. if (!value)
  212. {
  213. return;
  214. }
  215. this.m_SelectingFacilityIndex = i;
  216. if (!this.m_UIFacilityInfoConstruction.gameObject.activeSelf)
  217. {
  218. this.m_UIFacilityInfoConstruction.gameObject.SetActive(true);
  219. }
  220. this.m_UIFacilityInfoConstruction.SetFacilityInfo(facility, false);
  221. this.m_UIButtonDestroyFacility.interactable = (facility != null);
  222. });
  223. if (i == this.m_SelectingFacilityIndex)
  224. {
  225. Selectable componentInChildren = trans.GetComponentInChildren<Selectable>();
  226. if (componentInChildren.interactable)
  227. {
  228. uGUIUtility.SetSelectedGameObject(gameObject);
  229. facilityDetailsUI.m_Toggle.isOn = true;
  230. }
  231. }
  232. });
  233. }
  234. public void OpenFacilityUIConstruction(bool isOn)
  235. {
  236. if (!isOn)
  237. {
  238. return;
  239. }
  240. this.OpenFacilityUIConstruction();
  241. }
  242. public void OpenFacilityUIConstruction()
  243. {
  244. this.m_UIMainMenu.gameObject.SetActive(true);
  245. this.m_UIFacilityDetails.gameObject.SetActive(true);
  246. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  247. this.m_UIFacilityTypeList.gameObject.SetActive(false);
  248. this.m_UIFacilityCostume.gameObject.SetActive(false);
  249. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  250. this.m_UIButtonOK.gameObject.SetActive(true);
  251. this.m_UIButtonRESET.gameObject.SetActive(true);
  252. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  253. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(true);
  254. if (this.m_UIClubStatusViewer)
  255. {
  256. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  257. }
  258. this.SetMoneyParamWindowVisible(true);
  259. this.nowMoney = this.nowMoney;
  260. this.nowCost = this.CalcNowCost();
  261. this.m_UIToggleVisibleFacilityInfo.isOn = false;
  262. this.m_UIButtonOK.onClick.RemoveAllListeners();
  263. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  264. this.SetOKButtonEnable(true);
  265. this.m_UIFacilityInfoConstruction.gameObject.SetActive(false);
  266. this.m_UIButtonRESET.interactable = (this.FacilityMgr.GetNextDayFacilityArray().Count > 0);
  267. int facilityCountMax = this.FacilityMgr.FacilityCountMax;
  268. uGUIListViewer component = this.m_UIFacilityDetails.GetComponent<uGUIListViewer>();
  269. component.Show<Transform>(facilityCountMax, delegate(int i, Transform trans)
  270. {
  271. GameObject gameObject = trans.gameObject;
  272. SceneFacilityManagement.FacilityDetailsUI facilityDetailsUI = gameObject.AddComponent<SceneFacilityManagement.FacilityDetailsUI>();
  273. Facility facility = null;
  274. if (this.FacilityMgr.GetNextDayFacilityExist(i))
  275. {
  276. facility = this.FacilityMgr.GetNextDayFacility(i);
  277. facilityDetailsUI.m_ChangeImage.SetActive(facility != null);
  278. facilityDetailsUI.m_DeleteImage.SetActive(facility == null && this.FacilityMgr.GetFacility(i) != null);
  279. if (facility == null)
  280. {
  281. facility = this.FacilityMgr.GetFacility(i);
  282. }
  283. }
  284. else
  285. {
  286. facility = this.FacilityMgr.GetFacility(i);
  287. }
  288. if (facility == null)
  289. {
  290. facilityDetailsUI.m_Button.gameObject.SetActive(false);
  291. facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(0f, 0f, 0f, 0.25f);
  292. ColorBlock colors = facilityDetailsUI.m_Toggle.colors;
  293. Color highlightedColor = colors.highlightedColor;
  294. highlightedColor.a = 0f;
  295. colors.highlightedColor = highlightedColor;
  296. facilityDetailsUI.m_Toggle.colors = colors;
  297. }
  298. else
  299. {
  300. facilityDetailsUI.m_FacilityInfoUI.imageFacilityThumbnail.color = new Color(1f, 1f, 1f, 1f);
  301. }
  302. FacilityInfoUI component2 = trans.GetComponent<FacilityInfoUI>();
  303. component2.SetFacilityInfo(facility, false);
  304. component2.SetNameChangeEnable(facility != null);
  305. facilityDetailsUI.m_Toggle.onValueChanged.RemoveAllListeners();
  306. facilityDetailsUI.m_Toggle.onValueChanged.AddListener(delegate(bool value)
  307. {
  308. if (!value)
  309. {
  310. return;
  311. }
  312. this.m_SelectingFacilityIndex = i;
  313. if (!this.m_UIFacilityInfoConstruction.gameObject.activeSelf)
  314. {
  315. this.m_UIFacilityInfoConstruction.gameObject.SetActive(true);
  316. }
  317. this.m_UIFacilityInfoConstruction.SetFacilityInfo(facility, false);
  318. this.m_UIButtonDestroyFacility.interactable = (facility != null);
  319. });
  320. if (i == this.m_SelectingFacilityIndex)
  321. {
  322. Selectable componentInChildren = trans.GetComponentInChildren<Selectable>();
  323. if (componentInChildren.interactable)
  324. {
  325. uGUIUtility.SetSelectedGameObject(gameObject);
  326. facilityDetailsUI.m_Toggle.isOn = true;
  327. }
  328. }
  329. });
  330. }
  331. public void ButtonEvent_FacilityReplace()
  332. {
  333. int selectingFacilityIndex = this.m_SelectingFacilityIndex;
  334. Facility facility;
  335. if (this.FacilityMgr.GetNextDayFacilityExist(selectingFacilityIndex))
  336. {
  337. facility = this.FacilityMgr.GetNextDayFacility(selectingFacilityIndex);
  338. }
  339. else
  340. {
  341. facility = this.FacilityMgr.GetFacility(selectingFacilityIndex);
  342. }
  343. string messageText = string.Empty;
  344. if (facility == null)
  345. {
  346. messageText = "空き部屋に施設を配置しますか?";
  347. }
  348. else
  349. {
  350. messageText = "『" + facility.facilityName + "』\nが配置されています。\n施設を変更しますか?";
  351. }
  352. if (facility && !FacilityDataTable.GetFacilityCanBeDestroy(facility.param.typeID, true))
  353. {
  354. this.OpenDialog("『" + facility.facilityName + "』\nは変更出来ない施設です。", SystemDialog.TYPE.OK, null, null);
  355. }
  356. else
  357. {
  358. this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate
  359. {
  360. this.m_CreatingFacility.param.typeID = 0;
  361. this.ShowFacilityTypeList();
  362. this.m_UIButtonRESET.gameObject.SetActive(false);
  363. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  364. this.m_UIMainMenu.gameObject.SetActive(false);
  365. this.SetMoneyParamWindowVisible(true);
  366. }, null);
  367. }
  368. }
  369. public void ToggleEvent_VisibleFacilityInfo(bool b)
  370. {
  371. uGUIListViewer component = this.m_UIFacilityDetails.GetComponent<uGUIListViewer>();
  372. GameObject[] itemArray = component.ItemArray;
  373. if (itemArray == null)
  374. {
  375. return;
  376. }
  377. foreach (GameObject gameObject in itemArray)
  378. {
  379. SceneFacilityManagement.FacilityDetailsUI component2 = gameObject.GetComponent<SceneFacilityManagement.FacilityDetailsUI>();
  380. component2.m_ParentInfo.SetActive(b);
  381. }
  382. }
  383. public void ShowFacilityTypeList()
  384. {
  385. this.m_UIFacilityDetails.gameObject.SetActive(false);
  386. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  387. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  388. this.m_UIButtonCANCEL.gameObject.SetActive(true);
  389. this.m_UIButtonCANCEL.onClick.RemoveAllListeners();
  390. this.m_UIButtonCANCEL.onClick.AddListener(new UnityAction(this.OpenFacilityUIConstruction));
  391. this.m_UIButtonCANCEL.onClick.AddListener(delegate
  392. {
  393. this.m_UIMainMenu.gameObject.SetActive(true);
  394. });
  395. this.m_UIButtonOK.onClick.RemoveAllListeners();
  396. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_FacilityConstruction));
  397. this.SetOKButtonEnable(this.IsOKButtonEnable());
  398. this.SetUpFacilityTypeList();
  399. }
  400. private void SetUpFacilityTypeList()
  401. {
  402. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  403. Facility facility;
  404. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  405. {
  406. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  407. }
  408. else
  409. {
  410. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  411. }
  412. int num = -1;
  413. if (facility)
  414. {
  415. num = facility.param.typeID;
  416. }
  417. Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true);
  418. List<Facility.FacilityStatus> canBePlaceFacilityDataArray = new List<Facility.FacilityStatus>();
  419. Facility value;
  420. for (int j = 0; j < facilityStatusArray.Length; j++)
  421. {
  422. int typeID = facilityStatusArray[j].typeID;
  423. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(typeID, true);
  424. if (num != typeID)
  425. {
  426. if (!FacilityDataTable.GetFacilityDefaultPlacement(typeID, true))
  427. {
  428. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  429. {
  430. if (!facilityDefaultData.isEnableNTR)
  431. {
  432. goto IL_280;
  433. }
  434. }
  435. else if (facilityDefaultData.isOnlyNTR)
  436. {
  437. goto IL_280;
  438. }
  439. if (facilityDefaultData.name == "カジノ")
  440. {
  441. if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID))
  442. {
  443. goto IL_280;
  444. }
  445. bool flag = false;
  446. foreach (KeyValuePair<int, Facility> keyValuePair in this.FacilityMgr.GetNextDayFacilityArray())
  447. {
  448. value = keyValuePair.Value;
  449. if (value != null && value.defaultName == "カジノ")
  450. {
  451. flag = true;
  452. break;
  453. }
  454. }
  455. if (flag)
  456. {
  457. goto IL_280;
  458. }
  459. }
  460. else if (facilityDefaultData.name == "高級カジノ")
  461. {
  462. if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID))
  463. {
  464. goto IL_280;
  465. }
  466. bool flag2 = false;
  467. foreach (KeyValuePair<int, Facility> keyValuePair2 in this.FacilityMgr.GetNextDayFacilityArray())
  468. {
  469. Facility value2 = keyValuePair2.Value;
  470. if (value2 != null && value2.defaultName == "高級カジノ")
  471. {
  472. flag2 = true;
  473. break;
  474. }
  475. }
  476. if (flag2)
  477. {
  478. goto IL_280;
  479. }
  480. }
  481. canBePlaceFacilityDataArray.Add(facilityStatusArray[j]);
  482. }
  483. }
  484. IL_280:;
  485. }
  486. component.Show<Transform>(canBePlaceFacilityDataArray.Count, delegate(int i, Transform trans)
  487. {
  488. Facility.FacilityStatus facilityStatus = canBePlaceFacilityDataArray[i];
  489. Toggle componentInChildren = trans.GetComponentInChildren<Toggle>();
  490. Text componentInChildren2 = trans.GetComponentInChildren<Text>();
  491. componentInChildren2.text = facilityStatus.name;
  492. componentInChildren.onValueChanged.AddListener(delegate(bool value)
  493. {
  494. if (!value)
  495. {
  496. return;
  497. }
  498. this.m_CreatingFacility.Init(facilityStatus.typeID);
  499. this.ShowFacilityPowerUpList(this.m_CreatingFacility);
  500. long num2 = this.CalcNowCost();
  501. num2 += (long)FacilityDataTable.GetFacilityDefaultCost(facilityStatus.typeID, true);
  502. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  503. {
  504. Facility nextDayFacility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  505. if (nextDayFacility)
  506. {
  507. num2 -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true);
  508. }
  509. }
  510. this.nowCost = num2;
  511. this.m_CreatingFacility.Init(facilityStatus.typeID);
  512. this.SetOKButtonEnable(this.IsOKButtonEnable());
  513. if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  514. {
  515. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  516. }
  517. this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(this.m_CreatingFacility, true);
  518. this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode;
  519. });
  520. });
  521. }
  522. public void ResetFacilityTypeList()
  523. {
  524. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  525. component.ResetList();
  526. }
  527. private void ShowFacilityPowerUpList(Facility facility)
  528. {
  529. this.m_UIFacilityPowerUpList.gameObject.SetActive(true);
  530. this.SetUpFacilityPowerUpList(facility);
  531. }
  532. private void SetUpFacilityPowerUpList(Facility facility)
  533. {
  534. uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren<uGUIListViewer>();
  535. if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facility.param.typeID, true))
  536. {
  537. Facility.RecipeData[] recipeArray = facility.recipe;
  538. componentInChildren.Show<Transform>(recipeArray.Length, delegate(int i, Transform trans)
  539. {
  540. Text component = trans.Find("Text Recipe Name").GetComponent<Text>();
  541. Text component2 = trans.Find("Text Recipe Number").GetComponent<Text>();
  542. uGUIListViewer component3 = trans.Find("parent materials").GetComponent<uGUIListViewer>();
  543. uGUIListViewer component4 = trans.Find("parent conditions").GetComponent<uGUIListViewer>();
  544. uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent<uGUIListViewer>();
  545. uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent<uGUIListViewer>();
  546. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeArray[i].id);
  547. component.text = facilityPowerUpRecipe.name;
  548. component2.text = string.Format("RECIPE {0}", i + 1);
  549. this.SetUpRecipeMaterialList(component3, recipeArray[i]);
  550. this.SetUpRecipeConditionList(component4, recipeArray[i].id);
  551. this.SetUpFacilityParams(component5, recipeArray[i].defaultParameter);
  552. this.SetUpFacilityParams(component6, recipeArray[i].additionalParameter);
  553. });
  554. }
  555. else
  556. {
  557. componentInChildren.Show<Transform>(1, delegate(int i, Transform trans)
  558. {
  559. Text component = trans.Find("Text Recipe Name").GetComponent<Text>();
  560. Text component2 = trans.Find("Text Recipe Number").GetComponent<Text>();
  561. uGUIListViewer component3 = trans.Find("parent materials").GetComponent<uGUIListViewer>();
  562. uGUIListViewer component4 = trans.Find("parent conditions").GetComponent<uGUIListViewer>();
  563. uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent<uGUIListViewer>();
  564. uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent<uGUIListViewer>();
  565. component.text = "レシピ無し";
  566. component2.text = string.Empty;
  567. component3.ResetList();
  568. component4.ResetList();
  569. component5.ResetList();
  570. component6.ResetList();
  571. });
  572. }
  573. }
  574. public void ResetFacilityPowerUpList()
  575. {
  576. uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren<uGUIListViewer>();
  577. if (componentInChildren)
  578. {
  579. componentInChildren.ResetList();
  580. }
  581. else
  582. {
  583. Debug.LogWarningFormat("{0}\u3000には「{1}」コンポーネントが無い", new object[]
  584. {
  585. this.m_UIFacilityPowerUpList.name,
  586. typeof(uGUIListViewer)
  587. });
  588. }
  589. }
  590. private void SetUpRecipeMaterialList(uGUIListViewer listViewer, Facility.RecipeData recipeData)
  591. {
  592. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeData.id);
  593. int[] materialCategoryIDArray = facilityPowerUpRecipe.materialCategoryIDArray;
  594. listViewer.Show<Transform>(materialCategoryIDArray.Length, delegate(int i, Transform trans)
  595. {
  596. int categoryID = materialCategoryIDArray[i];
  597. int materialID = recipeData.materialIDArray[i];
  598. Text component = trans.Find("Text Category Name").GetComponent<Text>();
  599. Text component2 = trans.Find("Text Category Number").GetComponent<Text>();
  600. Text component3 = trans.Find("Text Material Name").GetComponent<Text>();
  601. string facilityPowerUpMaterialCategoryName = FacilityDataTable.GetFacilityPowerUpMaterialCategoryName(categoryID);
  602. string text = string.Empty;
  603. if (FacilityDataTable.IsExistPowerUpMaterial(materialID))
  604. {
  605. text = FacilityDataTable.GetFacilityPowerUpMaterial(materialID).name;
  606. }
  607. component.text = facilityPowerUpMaterialCategoryName;
  608. component3.text = text;
  609. component2.text = string.Format("CATEGORY {0}", i + 1);
  610. });
  611. }
  612. private void SetUpRecipeConditionList(uGUIListViewer listViewer, int recipeID)
  613. {
  614. FacilityDataTable.FacilityRecipeData data = FacilityDataTable.GetFacilityRecipeData(recipeID);
  615. listViewer.Show<Transform>(data.conditions.Length, delegate(int i, Transform trans)
  616. {
  617. Text[] componentsInChildren = trans.GetComponentsInChildren<Text>();
  618. componentsInChildren[0].text = data.conditions[i];
  619. componentsInChildren[1].text = (i + 1).ToString();
  620. });
  621. }
  622. private void SetUpFacilityParams(uGUIListViewer listViewer, Facility.FacilityParameter parameter)
  623. {
  624. List<KeyValuePair<string, int>> paramList = new List<KeyValuePair<string, int>>();
  625. for (int j = 0; j < parameter.Length; j++)
  626. {
  627. if (parameter[j] > 0)
  628. {
  629. paramList.Add(new KeyValuePair<string, int>(parameter.GetParameterName(j), parameter[j]));
  630. }
  631. }
  632. listViewer.Show<Transform>(paramList.Count, delegate(int i, Transform trans)
  633. {
  634. Text componentInChildren = trans.GetComponentInChildren<Text>();
  635. KeyValuePair<string, int> keyValuePair = paramList[i];
  636. componentInChildren.text = string.Format("{0} +{1}", keyValuePair.Key, keyValuePair.Value);
  637. });
  638. }
  639. public void ButtonEvent_OK_FacilityConstruction()
  640. {
  641. Facility facility;
  642. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  643. {
  644. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  645. }
  646. else
  647. {
  648. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  649. }
  650. long num = this.CalcNowCost();
  651. num += (long)FacilityDataTable.GetFacilityDefaultCost(this.m_CreatingFacility.param.typeID, true);
  652. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  653. {
  654. Facility nextDayFacility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  655. if (nextDayFacility)
  656. {
  657. num -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true);
  658. }
  659. }
  660. if (num > this.nowMoney)
  661. {
  662. this.OpenDialog("資金が不足する設定は出来ません。", SystemDialog.TYPE.OK, null, null);
  663. return;
  664. }
  665. string messageText = string.Empty;
  666. if (facility)
  667. {
  668. messageText = string.Concat(new string[]
  669. {
  670. "『",
  671. facility.facilityName,
  672. "』\nを、\n『",
  673. this.m_CreatingFacility.defaultName,
  674. "』\nに設定します。\nよろしいですか?"
  675. });
  676. }
  677. else
  678. {
  679. messageText = "『" + this.m_CreatingFacility.defaultName + "』\nを設定します。\nよろしいですか?";
  680. }
  681. this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate
  682. {
  683. Facility nextDayFacility2 = this.FacilityMgr.CreateNewFacility(this.m_CreatingFacility.param.typeID);
  684. this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, nextDayFacility2);
  685. this.OpenDialog("『" + this.m_CreatingFacility.defaultName + "』\nを設定しました。", SystemDialog.TYPE.OK, delegate
  686. {
  687. this.ResetFacilityTypeList();
  688. this.ResetFacilityPowerUpList();
  689. }, null);
  690. this.m_CreatingFacility.param.typeID = 0;
  691. this.OpenFacilityUIConstruction();
  692. }, delegate
  693. {
  694. });
  695. }
  696. private bool IsOKButtonEnable()
  697. {
  698. return !(this.m_CreatingFacility == null) && FacilityDataTable.IsExistFacilityData(this.m_CreatingFacility.param.typeID, true);
  699. }
  700. private void SetOKButtonEnable(bool b)
  701. {
  702. this.m_UIButtonOK.interactable = b;
  703. }
  704. public void ButtonEvent_RESET_FacilityConstruction()
  705. {
  706. string messageText = "施設の設定をリセットします。\nよろしいですか?";
  707. this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate
  708. {
  709. this.OpenDialog("施設の設定をリセットしました。", SystemDialog.TYPE.OK, delegate
  710. {
  711. this.ResetFacilityTypeList();
  712. this.ResetFacilityPowerUpList();
  713. }, null);
  714. this.FacilityMgr.ClearNextDayFacilityArray();
  715. this.OpenFacilityUIConstruction();
  716. this.m_CreatingFacility.param.typeID = 0;
  717. this.nowCost = this.CalcNowCost();
  718. }, delegate
  719. {
  720. });
  721. }
  722. private bool CheckFacilityCanBeDestroy(Facility facility)
  723. {
  724. return FacilityDataTable.GetFacilityCanBeDestroy(facility.param.typeID, true);
  725. }
  726. public void OpenDialogFacilityDestroy()
  727. {
  728. Facility facility;
  729. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  730. {
  731. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  732. }
  733. else
  734. {
  735. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  736. }
  737. if (facility == null)
  738. {
  739. Debug.Log("[FacilityUIDestroy]撤去したい施設としてnullが指定されました");
  740. return;
  741. }
  742. string facilityName = facility.facilityName;
  743. if (this.CheckFacilityCanBeDestroy(facility))
  744. {
  745. this.OpenDialog("『" + facilityName + "』\nを撤去します。\nよろしいですか?\n※施設強化及び服装設定もリセットされます", SystemDialog.TYPE.YES_NO, delegate
  746. {
  747. this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, null);
  748. this.OpenDialog("『" + facilityName + "』\nを撤去予定に設定しました。", SystemDialog.TYPE.OK, null, null);
  749. this.OpenFacilityUIConstruction();
  750. }, delegate
  751. {
  752. });
  753. }
  754. else
  755. {
  756. this.OpenDialog("『" + facilityName + "』\nは撤去出来ない施設です。", SystemDialog.TYPE.OK, null, null);
  757. }
  758. }
  759. public void OpenNowFacilityList(bool isOn)
  760. {
  761. if (!isOn)
  762. {
  763. return;
  764. }
  765. this.m_UIFacilityDetails.gameObject.SetActive(false);
  766. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  767. this.m_UIFacilityCostume.gameObject.SetActive(false);
  768. this.m_UIButtonOK.gameObject.SetActive(true);
  769. this.m_UIButtonRESET.gameObject.SetActive(false);
  770. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  771. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  772. if (this.m_UIClubStatusViewer)
  773. {
  774. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  775. }
  776. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  777. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  778. this.SetMoneyParamWindowVisible(false);
  779. this.m_UIButtonOK.onClick.RemoveAllListeners();
  780. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  781. this.SetOKButtonEnable(true);
  782. Facility[] facilityArray = this.FacilityMgr.GetFacilityArray();
  783. List<Facility> enableFacilityArray = new List<Facility>();
  784. for (int j = 0; j < facilityArray.Length; j++)
  785. {
  786. if (facilityArray[j])
  787. {
  788. enableFacilityArray.Add(facilityArray[j]);
  789. }
  790. }
  791. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  792. component.Show<Transform>(enableFacilityArray.Count, delegate(int i, Transform trans)
  793. {
  794. Text componentInChildren = trans.GetComponentInChildren<Text>();
  795. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  796. componentInChildren.text = enableFacilityArray[i].facilityName;
  797. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  798. {
  799. if (!value)
  800. {
  801. return;
  802. }
  803. this.ShowFacilityPowerUpList(enableFacilityArray[i]);
  804. if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  805. {
  806. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  807. }
  808. this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(enableFacilityArray[i], true);
  809. this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode;
  810. });
  811. });
  812. }
  813. public void OpenFacilityInfoList(bool isOn)
  814. {
  815. if (!isOn)
  816. {
  817. return;
  818. }
  819. this.m_UIFacilityDetails.gameObject.SetActive(false);
  820. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  821. this.m_UIFacilityCostume.gameObject.SetActive(false);
  822. this.m_UIButtonOK.gameObject.SetActive(true);
  823. this.m_UIButtonRESET.gameObject.SetActive(false);
  824. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  825. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  826. if (this.m_UIClubStatusViewer)
  827. {
  828. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  829. }
  830. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  831. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  832. this.SetMoneyParamWindowVisible(false);
  833. this.m_UIButtonOK.onClick.RemoveAllListeners();
  834. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  835. this.SetOKButtonEnable(true);
  836. Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true);
  837. List<Facility.FacilityStatus> enableFacilityArray = new List<Facility.FacilityStatus>();
  838. for (int j = 0; j < facilityStatusArray.Length; j++)
  839. {
  840. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(facilityStatusArray[j].typeID, true);
  841. if (!facilityDefaultData.isDefaultPlace)
  842. {
  843. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  844. {
  845. if (!facilityDefaultData.isEnableNTR)
  846. {
  847. goto IL_18C;
  848. }
  849. }
  850. else if (facilityDefaultData.isOnlyNTR)
  851. {
  852. goto IL_18C;
  853. }
  854. enableFacilityArray.Add(facilityStatusArray[j]);
  855. }
  856. IL_18C:;
  857. }
  858. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  859. component.Show<Transform>(enableFacilityArray.Count, delegate(int i, Transform trans)
  860. {
  861. Text componentInChildren = trans.GetComponentInChildren<Text>();
  862. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  863. componentInChildren.text = enableFacilityArray[i].name;
  864. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  865. {
  866. if (!value)
  867. {
  868. return;
  869. }
  870. this.m_CreatingFacility.Init(enableFacilityArray[i].typeID);
  871. this.ShowFacilityPowerUpList(this.m_CreatingFacility);
  872. if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  873. {
  874. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  875. }
  876. this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(this.m_CreatingFacility, true);
  877. this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode;
  878. });
  879. });
  880. }
  881. public void OpenFacilityCostumeSettingWindow(bool isOn)
  882. {
  883. if (!isOn)
  884. {
  885. return;
  886. }
  887. this.OpenFacilityCostumeSettingWindow();
  888. }
  889. public void OpenFacilityCostumeSettingWindow()
  890. {
  891. this.nowCost = this.CalcNowCost();
  892. this.m_UIFacilityDetails.gameObject.SetActive(false);
  893. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  894. this.m_UIButtonOK.gameObject.SetActive(true);
  895. this.m_UIButtonRESET.gameObject.SetActive(false);
  896. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  897. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  898. if (this.m_UIClubStatusViewer)
  899. {
  900. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  901. }
  902. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  903. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  904. this.SetMoneyParamWindowVisible(false);
  905. this.m_UIButtonOK.onClick.RemoveAllListeners();
  906. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  907. this.SetOKButtonEnable(true);
  908. Facility[] facilityArray = this.FacilityMgr.GetFacilityArray();
  909. List<Facility> enableFacilityArray = new List<Facility>();
  910. for (int j = 0; j < facilityArray.Length; j++)
  911. {
  912. Facility facility = null;
  913. if (this.FacilityMgr.GetNextDayFacilityExist(j))
  914. {
  915. facility = this.FacilityMgr.GetNextDayFacility(j);
  916. }
  917. else if (facilityArray[j])
  918. {
  919. facility = facilityArray[j];
  920. }
  921. if (facility != null)
  922. {
  923. enableFacilityArray.Add(facility);
  924. }
  925. }
  926. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  927. Facility tempSelectFacility = GameMain.Instance.FacilityMgr.tempSelectFacility;
  928. component.Show<Transform>(enableFacilityArray.Count, delegate(int i, Transform trans)
  929. {
  930. Text componentInChildren = trans.GetComponentInChildren<Text>();
  931. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  932. componentInChildren.text = enableFacilityArray[i].facilityName;
  933. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  934. {
  935. if (!value)
  936. {
  937. return;
  938. }
  939. this.OpenCostumeSettingWindow(enableFacilityArray[i]);
  940. if (!this.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  941. {
  942. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  943. }
  944. this.m_UIFacilityInfoMiniWindow.SetFacilityInfo(enableFacilityArray[i], true);
  945. this.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode;
  946. });
  947. if (tempSelectFacility != null && enableFacilityArray[i] == tempSelectFacility)
  948. {
  949. componentInChildren2.isOn = true;
  950. }
  951. });
  952. }
  953. private void OpenCostumeSettingWindow(Facility facility)
  954. {
  955. SceneFacilityManagement.m_CostumeEditFacilityIndex = GameMain.Instance.FacilityMgr.GetFacilityIndex(facility);
  956. GameMain.Instance.FacilityMgr.tempSelectFacility = facility;
  957. this.m_UIFacilityCostume.gameObject.SetActive(true);
  958. Facility.CostumeType typeCostume = facility.typeCostume;
  959. Toggle[] componentsInChildren = this.m_UIFacilityCostume.GetComponentsInChildren<Toggle>();
  960. for (int i = 0; i < componentsInChildren.Length; i++)
  961. {
  962. int num = i;
  963. Toggle toggle = componentsInChildren[num];
  964. Facility.CostumeType toggleType = (Facility.CostumeType)num;
  965. toggle.onValueChanged.RemoveAllListeners();
  966. toggle.onValueChanged.AddListener(delegate(bool value)
  967. {
  968. if (!value)
  969. {
  970. return;
  971. }
  972. facility.typeCostume = toggleType;
  973. this.m_UIButtonBeginCostumeSetting.interactable = (toggleType == Facility.CostumeType.Edit);
  974. Transform transform = this.m_UIFacilityCostume.Find("image thumbnail");
  975. if (transform != null)
  976. {
  977. RawImage component = transform.GetComponent<RawImage>();
  978. bool flag = facility.IsExistEditCostumeThumbnail();
  979. if (toggleType == Facility.CostumeType.Edit)
  980. {
  981. flag = facility.IsExistEditCostumeThumbnail();
  982. }
  983. else if (toggleType == Facility.CostumeType.Default)
  984. {
  985. flag = !string.IsNullOrEmpty(facility.defaultCostumeThumbnailName);
  986. }
  987. bool flag2 = (toggleType == Facility.CostumeType.Edit || toggleType == Facility.CostumeType.Default) && flag;
  988. if (transform.gameObject.activeSelf != flag2)
  989. {
  990. transform.gameObject.SetActive(flag2);
  991. }
  992. if (component.texture != null && string.IsNullOrEmpty(component.texture.name))
  993. {
  994. try
  995. {
  996. UnityEngine.Object.DestroyImmediate(component.texture, false);
  997. }
  998. catch
  999. {
  1000. component.texture = null;
  1001. }
  1002. }
  1003. if (flag2)
  1004. {
  1005. Texture2D texture = null;
  1006. if (toggleType == Facility.CostumeType.Edit)
  1007. {
  1008. texture = facility.GetEditCostumeThumbnail();
  1009. }
  1010. else if (toggleType == Facility.CostumeType.Default)
  1011. {
  1012. texture = facility.GetDefaultCostumeThumbnail();
  1013. }
  1014. component.texture = texture;
  1015. }
  1016. else
  1017. {
  1018. component.texture = null;
  1019. }
  1020. }
  1021. else
  1022. {
  1023. NDebug.Assert("メイドのサムネイル表示オブジェクトがありません", false);
  1024. }
  1025. });
  1026. }
  1027. for (int j = 0; j < componentsInChildren.Length; j++)
  1028. {
  1029. Toggle toggle2 = componentsInChildren[j];
  1030. Facility.CostumeType costumeType = (Facility.CostumeType)j;
  1031. toggle2.isOn = (typeCostume == costumeType);
  1032. toggle2.onValueChanged.Invoke(toggle2.isOn);
  1033. }
  1034. this.m_UIButtonBeginCostumeSetting.interactable = (typeCostume == Facility.CostumeType.Edit);
  1035. }
  1036. public void ButtonEventBeginCostumeSetting()
  1037. {
  1038. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  1039. {
  1040. this.UpdateMaidPropOfCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex, delegate
  1041. {
  1042. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  1043. scriptMgr.adv_kag.JumpLabel(this.m_strScriptEditLabel);
  1044. scriptMgr.adv_kag.Exec();
  1045. });
  1046. }, true, default(Color));
  1047. }
  1048. public void ButtonEventSceneClose()
  1049. {
  1050. if (string.IsNullOrEmpty(this.m_strScriptReturnLabel))
  1051. {
  1052. Debug.Log("[SceneFacilityManagement]シーン終了時に飛ぶラベルがありませんでした");
  1053. return;
  1054. }
  1055. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  1056. {
  1057. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  1058. scriptMgr.adv_kag.JumpLabel(this.m_strScriptReturnLabel);
  1059. scriptMgr.adv_kag.Exec();
  1060. }, true, default(Color));
  1061. }
  1062. private void GetTagBackup()
  1063. {
  1064. Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
  1065. string a;
  1066. if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneFacilityManagement")
  1067. {
  1068. if (!tag_backup.TryGetValue("label", out this.m_strScriptReturnLabel))
  1069. {
  1070. this.m_strScriptReturnLabel = "*施設の管理画面を抜ける";
  1071. }
  1072. if (!tag_backup.TryGetValue("label_edit", out this.m_strScriptEditLabel))
  1073. {
  1074. this.m_strScriptEditLabel = "*施設のコスチュームのエディットを開く";
  1075. }
  1076. if (tag_backup.ContainsKey("update_costume"))
  1077. {
  1078. this.UpdateFacilityCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex);
  1079. this.OpenFacilityCostumeSettingWindow();
  1080. this.OpenCostumeSettingWindow(GameMain.Instance.FacilityMgr.tempSelectFacility);
  1081. }
  1082. else
  1083. {
  1084. SceneFacilityManagement.m_CostumeEditFacilityIndex = -1;
  1085. GameMain.Instance.FacilityMgr.tempSelectFacility = null;
  1086. }
  1087. }
  1088. }
  1089. private void UpdateFacilityCostume(int facilityIndex)
  1090. {
  1091. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  1092. Facility facility = facilityMgr.GetNextDayFacility(facilityIndex);
  1093. if (facility == null)
  1094. {
  1095. facility = facilityMgr.GetFacility(facilityIndex);
  1096. if (facility == null)
  1097. {
  1098. Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex));
  1099. return;
  1100. }
  1101. }
  1102. Maid maidLeader = this.GetMaidLeader();
  1103. if (maidLeader == null)
  1104. {
  1105. NDebug.Warning("メイド長が見つかりません");
  1106. return;
  1107. }
  1108. facility.UpdateEditCostumeToMaidCostume(maidLeader);
  1109. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  1110. for (int i = 0; i < facilityCostumeEnableMPN.Length; i++)
  1111. {
  1112. maidLeader.ResetProp(facilityCostumeEnableMPN[i], true);
  1113. }
  1114. maidLeader.AllProcPropSeqStart();
  1115. maidLeader.Visible = false;
  1116. Debug.Log(string.Format("[SceneFacilityManagement]施設「{0}」の指定コスチュームの更新終了", facility.facilityName));
  1117. }
  1118. private void UpdateMaidPropOfCostume(int facilityIndex, Action callback = null)
  1119. {
  1120. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  1121. Facility facility = facilityMgr.GetNextDayFacility(facilityIndex);
  1122. if (facility == null)
  1123. {
  1124. facility = facilityMgr.GetFacility(facilityIndex);
  1125. if (facility == null)
  1126. {
  1127. Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex));
  1128. if (callback != null)
  1129. {
  1130. callback();
  1131. }
  1132. return;
  1133. }
  1134. }
  1135. Maid maid = this.GetMaidLeader();
  1136. if (maid == null)
  1137. {
  1138. NDebug.Warning("メイド長が見つかりません");
  1139. if (callback != null)
  1140. {
  1141. callback();
  1142. }
  1143. return;
  1144. }
  1145. GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
  1146. maid.Visible = true;
  1147. maid.AllProcPropSeqStart();
  1148. base.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, delegate
  1149. {
  1150. facility.UpdateMaidCostumeToEditCostume(maid, true);
  1151. maid.AllProcPropSeqStart();
  1152. this.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, callback));
  1153. }));
  1154. }
  1155. private IEnumerator coroutine_WaitmaidPropBusy(Maid maid, Action callback)
  1156. {
  1157. while (maid.IsBusy)
  1158. {
  1159. yield return null;
  1160. }
  1161. if (callback != null)
  1162. {
  1163. callback();
  1164. }
  1165. yield break;
  1166. }
  1167. private Maid GetMaidLeader()
  1168. {
  1169. Maid maid = null;
  1170. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1171. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  1172. {
  1173. Maid maid2 = characterMgr.GetMaid(i);
  1174. if (maid2 != null && maid2.status.leader)
  1175. {
  1176. maid = maid2;
  1177. break;
  1178. }
  1179. }
  1180. if (maid == null)
  1181. {
  1182. for (int j = 0; j < characterMgr.GetStockMaidCount(); j++)
  1183. {
  1184. Maid stockMaid = characterMgr.GetStockMaid(j);
  1185. if (stockMaid != null && stockMaid.status.leader)
  1186. {
  1187. maid = stockMaid;
  1188. break;
  1189. }
  1190. }
  1191. }
  1192. if (maid == null)
  1193. {
  1194. for (int k = 0; k < characterMgr.GetMaidCount(); k++)
  1195. {
  1196. Maid maid3 = characterMgr.GetMaid(k);
  1197. if (maid3 != null)
  1198. {
  1199. maid = maid3;
  1200. break;
  1201. }
  1202. }
  1203. }
  1204. if (maid == null)
  1205. {
  1206. for (int l = 0; l < characterMgr.GetStockMaidCount(); l++)
  1207. {
  1208. Maid stockMaid2 = characterMgr.GetStockMaid(l);
  1209. if (stockMaid2 != null)
  1210. {
  1211. maid = stockMaid2;
  1212. break;
  1213. }
  1214. }
  1215. }
  1216. return maid;
  1217. }
  1218. private FacilityManager m_FacilityMgr;
  1219. [SerializeField]
  1220. private Text m_UITextNowMoney;
  1221. [SerializeField]
  1222. private Text m_UITextNowCost;
  1223. [SerializeField]
  1224. private RectTransform m_UIMainMenu;
  1225. [SerializeField]
  1226. private RectTransform m_UIFacilityDetails;
  1227. [SerializeField]
  1228. private RectTransform m_UIFacilityTypeList;
  1229. [SerializeField]
  1230. private RectTransform m_UIFacilityCostume;
  1231. [SerializeField]
  1232. private RectTransform m_UIFacilityPowerUpList;
  1233. [SerializeField]
  1234. private FacilityInfoUI m_UIFacilityInfoConstruction;
  1235. [SerializeField]
  1236. private FacilityInfoUI m_UIFacilityInfoMiniWindow;
  1237. [SerializeField]
  1238. private Button m_UIButtonOK;
  1239. [SerializeField]
  1240. private Button m_UIButtonCANCEL;
  1241. [SerializeField]
  1242. private Button m_UIButtonRESET;
  1243. [SerializeField]
  1244. private Button m_UIButtonDestroyFacility;
  1245. [SerializeField]
  1246. private Toggle m_UIToggleVisibleFacilityInfo;
  1247. [SerializeField]
  1248. private Button m_UIButtonBeginCostumeSetting;
  1249. [SerializeField]
  1250. private StatusViewer m_UIClubStatusViewer;
  1251. [SerializeField]
  1252. private bool m_EnableSetUpCameraAndBG = true;
  1253. private Facility m_CreatingFacility;
  1254. private int m_SelectingFacilityIndex;
  1255. private static int m_CostumeEditFacilityIndex = -1;
  1256. [SerializeField]
  1257. private StartDestroyEventObject m_StartDestroyEventObject;
  1258. private string m_PlayBGM = "BGM009.ogg";
  1259. private long m_NowCost;
  1260. private string m_strScriptReturnLabel = string.Empty;
  1261. private string m_strScriptEditLabel = string.Empty;
  1262. private class FacilityDetailsUI : MonoBehaviour
  1263. {
  1264. private void Awake()
  1265. {
  1266. this.m_FacilityInfoUI = base.GetComponent<FacilityInfoUI>();
  1267. this.m_Toggle = base.GetComponent<Toggle>();
  1268. this.m_Button = base.GetComponentInChildren<Button>();
  1269. this.m_ChangeImage = base.transform.Find("Image Change").gameObject;
  1270. this.m_DeleteImage = base.transform.Find("Image Delete").gameObject;
  1271. this.m_ParentInfo = base.transform.Find("Parent Info").gameObject;
  1272. this.m_ChangeImage.SetActive(false);
  1273. this.m_DeleteImage.SetActive(false);
  1274. this.m_ParentInfo.SetActive(false);
  1275. InputField facilityNameUI = this.m_FacilityInfoUI.textFacilityName;
  1276. facilityNameUI.onEndEdit.RemoveAllListeners();
  1277. facilityNameUI.onEndEdit.AddListener(delegate(string value)
  1278. {
  1279. Facility facility = this.m_FacilityInfoUI.facility;
  1280. value = value.Trim();
  1281. if (string.IsNullOrEmpty(value))
  1282. {
  1283. facilityNameUI.text = facility.facilityName;
  1284. return;
  1285. }
  1286. facility.facilityName = value;
  1287. facilityNameUI.enabled = false;
  1288. });
  1289. this.m_Button.onClick.AddListener(delegate
  1290. {
  1291. facilityNameUI.enabled = true;
  1292. facilityNameUI.interactable = true;
  1293. facilityNameUI.ActivateInputField();
  1294. });
  1295. }
  1296. private void Start()
  1297. {
  1298. InputField textFacilityName = this.m_FacilityInfoUI.textFacilityName;
  1299. textFacilityName.interactable = false;
  1300. }
  1301. public FacilityInfoUI m_FacilityInfoUI;
  1302. public Toggle m_Toggle;
  1303. public Button m_Button;
  1304. public GameObject m_ChangeImage;
  1305. public GameObject m_DeleteImage;
  1306. public GameObject m_ParentInfo;
  1307. }
  1308. }