SceneFacilityManagement.cs 50 KB

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