SceneFacilityManagement.cs 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  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. SceneFacilityManagement.<SetUpFacilityTypeList>c__AnonStorey4 <SetUpFacilityTypeList>c__AnonStorey = new SceneFacilityManagement.<SetUpFacilityTypeList>c__AnonStorey4();
  403. <SetUpFacilityTypeList>c__AnonStorey.$this = this;
  404. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  405. Facility facility;
  406. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  407. {
  408. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  409. }
  410. else
  411. {
  412. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  413. }
  414. int num = -1;
  415. if (facility)
  416. {
  417. num = facility.param.typeID;
  418. }
  419. Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true);
  420. <SetUpFacilityTypeList>c__AnonStorey.canBePlaceFacilityDataArray = new List<Facility.FacilityStatus>();
  421. Facility value;
  422. for (int j = 0; j < facilityStatusArray.Length; j++)
  423. {
  424. int typeID = facilityStatusArray[j].typeID;
  425. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(typeID, true);
  426. if (num != typeID)
  427. {
  428. if (!FacilityDataTable.GetFacilityDefaultPlacement(typeID, true))
  429. {
  430. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  431. {
  432. if (!facilityDefaultData.isEnableNTR)
  433. {
  434. goto IL_280;
  435. }
  436. }
  437. else if (facilityDefaultData.isOnlyNTR)
  438. {
  439. goto IL_280;
  440. }
  441. if (facilityDefaultData.name == "カジノ")
  442. {
  443. if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID))
  444. {
  445. goto IL_280;
  446. }
  447. bool flag = false;
  448. foreach (KeyValuePair<int, Facility> keyValuePair in this.FacilityMgr.GetNextDayFacilityArray())
  449. {
  450. value = keyValuePair.Value;
  451. if (value != null && value.defaultName == "カジノ")
  452. {
  453. flag = true;
  454. break;
  455. }
  456. }
  457. if (flag)
  458. {
  459. goto IL_280;
  460. }
  461. }
  462. else if (facilityDefaultData.name == "高級カジノ")
  463. {
  464. if (this.FacilityMgr.IsExistTypeFacility(facilityDefaultData.ID))
  465. {
  466. goto IL_280;
  467. }
  468. bool flag2 = false;
  469. foreach (KeyValuePair<int, Facility> keyValuePair2 in this.FacilityMgr.GetNextDayFacilityArray())
  470. {
  471. Facility value2 = keyValuePair2.Value;
  472. if (value2 != null && value2.defaultName == "高級カジノ")
  473. {
  474. flag2 = true;
  475. break;
  476. }
  477. }
  478. if (flag2)
  479. {
  480. goto IL_280;
  481. }
  482. }
  483. <SetUpFacilityTypeList>c__AnonStorey.canBePlaceFacilityDataArray.Add(facilityStatusArray[j]);
  484. }
  485. }
  486. IL_280:;
  487. }
  488. component.Show<Transform>(<SetUpFacilityTypeList>c__AnonStorey.canBePlaceFacilityDataArray.Count, delegate(int i, Transform trans)
  489. {
  490. Facility.FacilityStatus facilityStatus = <SetUpFacilityTypeList>c__AnonStorey.canBePlaceFacilityDataArray[i];
  491. Toggle componentInChildren = trans.GetComponentInChildren<Toggle>();
  492. Text componentInChildren2 = trans.GetComponentInChildren<Text>();
  493. componentInChildren2.text = facilityStatus.name;
  494. componentInChildren.onValueChanged.AddListener(delegate(bool value)
  495. {
  496. if (!value)
  497. {
  498. return;
  499. }
  500. <SetUpFacilityTypeList>c__AnonStorey.m_CreatingFacility.Init(facilityStatus.typeID);
  501. <SetUpFacilityTypeList>c__AnonStorey.ShowFacilityPowerUpList(<SetUpFacilityTypeList>c__AnonStorey.m_CreatingFacility);
  502. long num2 = <SetUpFacilityTypeList>c__AnonStorey.CalcNowCost();
  503. num2 += (long)FacilityDataTable.GetFacilityDefaultCost(facilityStatus.typeID, true);
  504. if (<SetUpFacilityTypeList>c__AnonStorey.FacilityMgr.GetNextDayFacilityExist(<SetUpFacilityTypeList>c__AnonStorey.m_SelectingFacilityIndex))
  505. {
  506. Facility nextDayFacility = <SetUpFacilityTypeList>c__AnonStorey.FacilityMgr.GetNextDayFacility(<SetUpFacilityTypeList>c__AnonStorey.m_SelectingFacilityIndex);
  507. if (nextDayFacility)
  508. {
  509. num2 -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true);
  510. }
  511. }
  512. <SetUpFacilityTypeList>c__AnonStorey.nowCost = num2;
  513. <SetUpFacilityTypeList>c__AnonStorey.m_CreatingFacility.Init(facilityStatus.typeID);
  514. <SetUpFacilityTypeList>c__AnonStorey.SetOKButtonEnable(<SetUpFacilityTypeList>c__AnonStorey.IsOKButtonEnable());
  515. if (!<SetUpFacilityTypeList>c__AnonStorey.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  516. {
  517. <SetUpFacilityTypeList>c__AnonStorey.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  518. }
  519. <SetUpFacilityTypeList>c__AnonStorey.m_UIFacilityInfoMiniWindow.SetFacilityInfo(<SetUpFacilityTypeList>c__AnonStorey.m_CreatingFacility, true);
  520. <SetUpFacilityTypeList>c__AnonStorey.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode;
  521. });
  522. });
  523. }
  524. public void ResetFacilityTypeList()
  525. {
  526. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  527. component.ResetList();
  528. }
  529. private void ShowFacilityPowerUpList(Facility facility)
  530. {
  531. this.m_UIFacilityPowerUpList.gameObject.SetActive(true);
  532. this.SetUpFacilityPowerUpList(facility);
  533. }
  534. private void SetUpFacilityPowerUpList(Facility facility)
  535. {
  536. uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren<uGUIListViewer>();
  537. if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facility.param.typeID, true))
  538. {
  539. Facility.RecipeData[] recipeArray = facility.recipe;
  540. componentInChildren.Show<Transform>(recipeArray.Length, delegate(int i, Transform trans)
  541. {
  542. Text component = trans.Find("Text Recipe Name").GetComponent<Text>();
  543. Text component2 = trans.Find("Text Recipe Number").GetComponent<Text>();
  544. uGUIListViewer component3 = trans.Find("parent materials").GetComponent<uGUIListViewer>();
  545. uGUIListViewer component4 = trans.Find("parent conditions").GetComponent<uGUIListViewer>();
  546. uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent<uGUIListViewer>();
  547. uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent<uGUIListViewer>();
  548. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeArray[i].id);
  549. component.text = facilityPowerUpRecipe.name;
  550. component2.text = string.Format("RECIPE {0}", i + 1);
  551. this.SetUpRecipeMaterialList(component3, recipeArray[i]);
  552. this.SetUpRecipeConditionList(component4, recipeArray[i].id);
  553. this.SetUpFacilityParams(component5, recipeArray[i].defaultParameter);
  554. this.SetUpFacilityParams(component6, recipeArray[i].additionalParameter);
  555. });
  556. }
  557. else
  558. {
  559. componentInChildren.Show<Transform>(1, delegate(int i, Transform trans)
  560. {
  561. Text component = trans.Find("Text Recipe Name").GetComponent<Text>();
  562. Text component2 = trans.Find("Text Recipe Number").GetComponent<Text>();
  563. uGUIListViewer component3 = trans.Find("parent materials").GetComponent<uGUIListViewer>();
  564. uGUIListViewer component4 = trans.Find("parent conditions").GetComponent<uGUIListViewer>();
  565. uGUIListViewer component5 = trans.Find("parent default parameter").GetComponent<uGUIListViewer>();
  566. uGUIListViewer component6 = trans.Find("parent additional parameter").GetComponent<uGUIListViewer>();
  567. component.text = "レシピ無し";
  568. component2.text = string.Empty;
  569. component3.ResetList();
  570. component4.ResetList();
  571. component5.ResetList();
  572. component6.ResetList();
  573. });
  574. }
  575. }
  576. public void ResetFacilityPowerUpList()
  577. {
  578. uGUIListViewer componentInChildren = this.m_UIFacilityPowerUpList.GetComponentInChildren<uGUIListViewer>();
  579. if (componentInChildren)
  580. {
  581. componentInChildren.ResetList();
  582. }
  583. else
  584. {
  585. Debug.LogWarningFormat("{0}\u3000には「{1}」コンポーネントが無い", new object[]
  586. {
  587. this.m_UIFacilityPowerUpList.name,
  588. typeof(uGUIListViewer)
  589. });
  590. }
  591. }
  592. private void SetUpRecipeMaterialList(uGUIListViewer listViewer, Facility.RecipeData recipeData)
  593. {
  594. Facility.PowerUpRecipe facilityPowerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(recipeData.id);
  595. int[] materialCategoryIDArray = facilityPowerUpRecipe.materialCategoryIDArray;
  596. listViewer.Show<Transform>(materialCategoryIDArray.Length, delegate(int i, Transform trans)
  597. {
  598. int categoryID = materialCategoryIDArray[i];
  599. int materialID = recipeData.materialIDArray[i];
  600. Text component = trans.Find("Text Category Name").GetComponent<Text>();
  601. Text component2 = trans.Find("Text Category Number").GetComponent<Text>();
  602. Text component3 = trans.Find("Text Material Name").GetComponent<Text>();
  603. string facilityPowerUpMaterialCategoryName = FacilityDataTable.GetFacilityPowerUpMaterialCategoryName(categoryID);
  604. string text = string.Empty;
  605. if (FacilityDataTable.IsExistPowerUpMaterial(materialID))
  606. {
  607. text = FacilityDataTable.GetFacilityPowerUpMaterial(materialID).name;
  608. }
  609. component.text = facilityPowerUpMaterialCategoryName;
  610. component3.text = text;
  611. component2.text = string.Format("CATEGORY {0}", i + 1);
  612. });
  613. }
  614. private void SetUpRecipeConditionList(uGUIListViewer listViewer, int recipeID)
  615. {
  616. FacilityDataTable.FacilityRecipeData data = FacilityDataTable.GetFacilityRecipeData(recipeID);
  617. listViewer.Show<Transform>(data.conditions.Length, delegate(int i, Transform trans)
  618. {
  619. Text[] componentsInChildren = trans.GetComponentsInChildren<Text>();
  620. componentsInChildren[0].text = data.conditions[i];
  621. componentsInChildren[1].text = (i + 1).ToString();
  622. });
  623. }
  624. private void SetUpFacilityParams(uGUIListViewer listViewer, Facility.FacilityParameter parameter)
  625. {
  626. List<KeyValuePair<string, int>> paramList = new List<KeyValuePair<string, int>>();
  627. for (int j = 0; j < parameter.Length; j++)
  628. {
  629. if (parameter[j] > 0)
  630. {
  631. paramList.Add(new KeyValuePair<string, int>(parameter.GetParameterName(j), parameter[j]));
  632. }
  633. }
  634. listViewer.Show<Transform>(paramList.Count, delegate(int i, Transform trans)
  635. {
  636. Text componentInChildren = trans.GetComponentInChildren<Text>();
  637. KeyValuePair<string, int> keyValuePair = paramList[i];
  638. componentInChildren.text = string.Format("{0} +{1}", keyValuePair.Key, keyValuePair.Value);
  639. });
  640. }
  641. public void ButtonEvent_OK_FacilityConstruction()
  642. {
  643. Facility facility;
  644. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  645. {
  646. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  647. }
  648. else
  649. {
  650. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  651. }
  652. long num = this.CalcNowCost();
  653. num += (long)FacilityDataTable.GetFacilityDefaultCost(this.m_CreatingFacility.param.typeID, true);
  654. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  655. {
  656. Facility nextDayFacility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  657. if (nextDayFacility)
  658. {
  659. num -= (long)FacilityDataTable.GetFacilityDefaultCost(nextDayFacility.param.typeID, true);
  660. }
  661. }
  662. if (num > this.nowMoney)
  663. {
  664. this.OpenDialog("資金が不足する設定は出来ません。", SystemDialog.TYPE.OK, null, null);
  665. return;
  666. }
  667. string messageText = string.Empty;
  668. if (facility)
  669. {
  670. messageText = string.Concat(new string[]
  671. {
  672. "『",
  673. facility.facilityName,
  674. "』\nを、\n『",
  675. this.m_CreatingFacility.defaultName,
  676. "』\nに設定します。\nよろしいですか?"
  677. });
  678. }
  679. else
  680. {
  681. messageText = "『" + this.m_CreatingFacility.defaultName + "』\nを設定します。\nよろしいですか?";
  682. }
  683. this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate
  684. {
  685. Facility nextDayFacility2 = this.FacilityMgr.CreateNewFacility(this.m_CreatingFacility.param.typeID);
  686. this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, nextDayFacility2);
  687. this.OpenDialog("『" + this.m_CreatingFacility.defaultName + "』\nを設定しました。", SystemDialog.TYPE.OK, delegate
  688. {
  689. this.ResetFacilityTypeList();
  690. this.ResetFacilityPowerUpList();
  691. }, null);
  692. this.m_CreatingFacility.param.typeID = 0;
  693. this.OpenFacilityUIConstruction();
  694. }, delegate
  695. {
  696. });
  697. }
  698. private bool IsOKButtonEnable()
  699. {
  700. return !(this.m_CreatingFacility == null) && FacilityDataTable.IsExistFacilityData(this.m_CreatingFacility.param.typeID, true);
  701. }
  702. private void SetOKButtonEnable(bool b)
  703. {
  704. this.m_UIButtonOK.interactable = b;
  705. }
  706. public void ButtonEvent_RESET_FacilityConstruction()
  707. {
  708. string messageText = "施設の設定をリセットします。\nよろしいですか?";
  709. this.OpenDialog(messageText, SystemDialog.TYPE.YES_NO, delegate
  710. {
  711. this.OpenDialog("施設の設定をリセットしました。", SystemDialog.TYPE.OK, delegate
  712. {
  713. this.ResetFacilityTypeList();
  714. this.ResetFacilityPowerUpList();
  715. }, null);
  716. this.FacilityMgr.ClearNextDayFacilityArray();
  717. this.OpenFacilityUIConstruction();
  718. this.m_CreatingFacility.param.typeID = 0;
  719. this.nowCost = this.CalcNowCost();
  720. }, delegate
  721. {
  722. });
  723. }
  724. private bool CheckFacilityCanBeDestroy(Facility facility)
  725. {
  726. return FacilityDataTable.GetFacilityCanBeDestroy(facility.param.typeID, true);
  727. }
  728. public void OpenDialogFacilityDestroy()
  729. {
  730. Facility facility;
  731. if (this.FacilityMgr.GetNextDayFacilityExist(this.m_SelectingFacilityIndex))
  732. {
  733. facility = this.FacilityMgr.GetNextDayFacility(this.m_SelectingFacilityIndex);
  734. }
  735. else
  736. {
  737. facility = this.FacilityMgr.GetFacility(this.m_SelectingFacilityIndex);
  738. }
  739. if (facility == null)
  740. {
  741. Debug.Log("[FacilityUIDestroy]撤去したい施設としてnullが指定されました");
  742. return;
  743. }
  744. string facilityName = facility.facilityName;
  745. if (this.CheckFacilityCanBeDestroy(facility))
  746. {
  747. this.OpenDialog("『" + facilityName + "』\nを撤去します。\nよろしいですか?\n※施設強化及び服装設定もリセットされます", SystemDialog.TYPE.YES_NO, delegate
  748. {
  749. this.FacilityMgr.SetNextDayFacility(this.m_SelectingFacilityIndex, null);
  750. this.OpenDialog("『" + facilityName + "』\nを撤去予定に設定しました。", SystemDialog.TYPE.OK, null, null);
  751. this.OpenFacilityUIConstruction();
  752. }, delegate
  753. {
  754. });
  755. }
  756. else
  757. {
  758. this.OpenDialog("『" + facilityName + "』\nは撤去出来ない施設です。", SystemDialog.TYPE.OK, null, null);
  759. }
  760. }
  761. public void OpenNowFacilityList(bool isOn)
  762. {
  763. SceneFacilityManagement.<OpenNowFacilityList>c__AnonStoreyB <OpenNowFacilityList>c__AnonStoreyB = new SceneFacilityManagement.<OpenNowFacilityList>c__AnonStoreyB();
  764. <OpenNowFacilityList>c__AnonStoreyB.$this = this;
  765. if (!isOn)
  766. {
  767. return;
  768. }
  769. this.m_UIFacilityDetails.gameObject.SetActive(false);
  770. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  771. this.m_UIFacilityCostume.gameObject.SetActive(false);
  772. this.m_UIButtonOK.gameObject.SetActive(true);
  773. this.m_UIButtonRESET.gameObject.SetActive(false);
  774. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  775. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  776. if (this.m_UIClubStatusViewer)
  777. {
  778. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  779. }
  780. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  781. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  782. this.SetMoneyParamWindowVisible(false);
  783. this.m_UIButtonOK.onClick.RemoveAllListeners();
  784. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  785. this.SetOKButtonEnable(true);
  786. Facility[] facilityArray = this.FacilityMgr.GetFacilityArray();
  787. <OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray = new List<Facility>();
  788. for (int j = 0; j < facilityArray.Length; j++)
  789. {
  790. if (facilityArray[j])
  791. {
  792. <OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray.Add(facilityArray[j]);
  793. }
  794. }
  795. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  796. component.Show<Transform>(<OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray.Count, delegate(int i, Transform trans)
  797. {
  798. Text componentInChildren = trans.GetComponentInChildren<Text>();
  799. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  800. componentInChildren.text = <OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray[i].facilityName;
  801. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  802. {
  803. if (!value)
  804. {
  805. return;
  806. }
  807. <OpenNowFacilityList>c__AnonStoreyB.ShowFacilityPowerUpList(<OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray[i]);
  808. if (!<OpenNowFacilityList>c__AnonStoreyB.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  809. {
  810. <OpenNowFacilityList>c__AnonStoreyB.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  811. }
  812. <OpenNowFacilityList>c__AnonStoreyB.m_UIFacilityInfoMiniWindow.SetFacilityInfo(<OpenNowFacilityList>c__AnonStoreyB.enableFacilityArray[i], true);
  813. <OpenNowFacilityList>c__AnonStoreyB.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode;
  814. });
  815. });
  816. }
  817. public void OpenFacilityInfoList(bool isOn)
  818. {
  819. SceneFacilityManagement.<OpenFacilityInfoList>c__AnonStoreyD <OpenFacilityInfoList>c__AnonStoreyD = new SceneFacilityManagement.<OpenFacilityInfoList>c__AnonStoreyD();
  820. <OpenFacilityInfoList>c__AnonStoreyD.$this = this;
  821. if (!isOn)
  822. {
  823. return;
  824. }
  825. this.m_UIFacilityDetails.gameObject.SetActive(false);
  826. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  827. this.m_UIFacilityCostume.gameObject.SetActive(false);
  828. this.m_UIButtonOK.gameObject.SetActive(true);
  829. this.m_UIButtonRESET.gameObject.SetActive(false);
  830. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  831. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  832. if (this.m_UIClubStatusViewer)
  833. {
  834. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  835. }
  836. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  837. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  838. this.SetMoneyParamWindowVisible(false);
  839. this.m_UIButtonOK.onClick.RemoveAllListeners();
  840. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  841. this.SetOKButtonEnable(true);
  842. Facility.FacilityStatus[] facilityStatusArray = FacilityDataTable.GetFacilityStatusArray(true);
  843. <OpenFacilityInfoList>c__AnonStoreyD.enableFacilityArray = new List<Facility.FacilityStatus>();
  844. for (int j = 0; j < facilityStatusArray.Length; j++)
  845. {
  846. FacilityDataTable.FacilityDefaultData facilityDefaultData = FacilityDataTable.GetFacilityDefaultData(facilityStatusArray[j].typeID, true);
  847. if (!facilityDefaultData.isDefaultPlace)
  848. {
  849. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  850. {
  851. if (!facilityDefaultData.isEnableNTR)
  852. {
  853. goto IL_18C;
  854. }
  855. }
  856. else if (facilityDefaultData.isOnlyNTR)
  857. {
  858. goto IL_18C;
  859. }
  860. <OpenFacilityInfoList>c__AnonStoreyD.enableFacilityArray.Add(facilityStatusArray[j]);
  861. }
  862. IL_18C:;
  863. }
  864. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  865. component.Show<Transform>(<OpenFacilityInfoList>c__AnonStoreyD.enableFacilityArray.Count, delegate(int i, Transform trans)
  866. {
  867. Text componentInChildren = trans.GetComponentInChildren<Text>();
  868. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  869. componentInChildren.text = <OpenFacilityInfoList>c__AnonStoreyD.enableFacilityArray[i].name;
  870. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  871. {
  872. if (!value)
  873. {
  874. return;
  875. }
  876. <OpenFacilityInfoList>c__AnonStoreyD.m_CreatingFacility.Init(<OpenFacilityInfoList>c__AnonStoreyD.enableFacilityArray[i].typeID);
  877. <OpenFacilityInfoList>c__AnonStoreyD.ShowFacilityPowerUpList(<OpenFacilityInfoList>c__AnonStoreyD.m_CreatingFacility);
  878. if (!<OpenFacilityInfoList>c__AnonStoreyD.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  879. {
  880. <OpenFacilityInfoList>c__AnonStoreyD.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  881. }
  882. <OpenFacilityInfoList>c__AnonStoreyD.m_UIFacilityInfoMiniWindow.SetFacilityInfo(<OpenFacilityInfoList>c__AnonStoreyD.m_CreatingFacility, true);
  883. <OpenFacilityInfoList>c__AnonStoreyD.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.ConstructMode;
  884. });
  885. });
  886. }
  887. public void OpenFacilityCostumeSettingWindow(bool isOn)
  888. {
  889. if (!isOn)
  890. {
  891. return;
  892. }
  893. this.OpenFacilityCostumeSettingWindow();
  894. }
  895. public void OpenFacilityCostumeSettingWindow()
  896. {
  897. SceneFacilityManagement.<OpenFacilityCostumeSettingWindow>c__AnonStoreyF <OpenFacilityCostumeSettingWindow>c__AnonStoreyF = new SceneFacilityManagement.<OpenFacilityCostumeSettingWindow>c__AnonStoreyF();
  898. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.$this = this;
  899. this.nowCost = this.CalcNowCost();
  900. this.m_UIFacilityDetails.gameObject.SetActive(false);
  901. this.m_UIFacilityPowerUpList.gameObject.SetActive(false);
  902. this.m_UIButtonOK.gameObject.SetActive(true);
  903. this.m_UIButtonRESET.gameObject.SetActive(false);
  904. this.m_UIButtonCANCEL.gameObject.SetActive(false);
  905. this.m_UIToggleVisibleFacilityInfo.gameObject.SetActive(false);
  906. if (this.m_UIClubStatusViewer)
  907. {
  908. this.m_UIClubStatusViewer.gameObject.SetActive(false);
  909. }
  910. this.m_UIFacilityTypeList.gameObject.SetActive(true);
  911. this.m_UIFacilityInfoMiniWindow.gameObject.SetActive(false);
  912. this.SetMoneyParamWindowVisible(false);
  913. this.m_UIButtonOK.onClick.RemoveAllListeners();
  914. this.m_UIButtonOK.onClick.AddListener(new UnityAction(this.ButtonEvent_OK_OpenMainMenu));
  915. this.SetOKButtonEnable(true);
  916. Facility[] facilityArray = this.FacilityMgr.GetFacilityArray();
  917. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray = new List<Facility>();
  918. for (int j = 0; j < facilityArray.Length; j++)
  919. {
  920. Facility facility = null;
  921. if (this.FacilityMgr.GetNextDayFacilityExist(j))
  922. {
  923. facility = this.FacilityMgr.GetNextDayFacility(j);
  924. }
  925. else if (facilityArray[j])
  926. {
  927. facility = facilityArray[j];
  928. }
  929. if (facility != null)
  930. {
  931. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray.Add(facility);
  932. }
  933. }
  934. uGUIListViewer component = this.m_UIFacilityTypeList.GetComponent<uGUIListViewer>();
  935. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.tempSelectFacility = GameMain.Instance.FacilityMgr.tempSelectFacility;
  936. component.Show<Transform>(<OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray.Count, delegate(int i, Transform trans)
  937. {
  938. Text componentInChildren = trans.GetComponentInChildren<Text>();
  939. Toggle componentInChildren2 = trans.GetComponentInChildren<Toggle>();
  940. componentInChildren.text = <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray[i].facilityName;
  941. componentInChildren2.onValueChanged.AddListener(delegate(bool value)
  942. {
  943. if (!value)
  944. {
  945. return;
  946. }
  947. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.OpenCostumeSettingWindow(<OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray[i]);
  948. if (!<OpenFacilityCostumeSettingWindow>c__AnonStoreyF.m_UIFacilityInfoMiniWindow.gameObject.activeSelf)
  949. {
  950. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.m_UIFacilityInfoMiniWindow.gameObject.SetActive(true);
  951. }
  952. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.m_UIFacilityInfoMiniWindow.SetFacilityInfo(<OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray[i], true);
  953. <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.m_UIFacilityInfoMiniWindow.viewType = FacilityInfoUI.ViewType.DefaultMode;
  954. });
  955. if (<OpenFacilityCostumeSettingWindow>c__AnonStoreyF.tempSelectFacility != null && <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.enableFacilityArray[i] == <OpenFacilityCostumeSettingWindow>c__AnonStoreyF.tempSelectFacility)
  956. {
  957. componentInChildren2.isOn = true;
  958. }
  959. });
  960. }
  961. private void OpenCostumeSettingWindow(Facility facility)
  962. {
  963. SceneFacilityManagement.m_CostumeEditFacilityIndex = GameMain.Instance.FacilityMgr.GetFacilityIndex(facility);
  964. GameMain.Instance.FacilityMgr.tempSelectFacility = facility;
  965. this.m_UIFacilityCostume.gameObject.SetActive(true);
  966. Facility.CostumeType typeCostume = facility.typeCostume;
  967. Toggle[] componentsInChildren = this.m_UIFacilityCostume.GetComponentsInChildren<Toggle>();
  968. for (int i = 0; i < componentsInChildren.Length; i++)
  969. {
  970. int num = i;
  971. Toggle toggle = componentsInChildren[num];
  972. Facility.CostumeType toggleType = (Facility.CostumeType)num;
  973. toggle.onValueChanged.RemoveAllListeners();
  974. toggle.onValueChanged.AddListener(delegate(bool value)
  975. {
  976. if (!value)
  977. {
  978. return;
  979. }
  980. facility.typeCostume = toggleType;
  981. this.m_UIButtonBeginCostumeSetting.interactable = (toggleType == Facility.CostumeType.Edit);
  982. Transform transform = this.m_UIFacilityCostume.Find("image thumbnail");
  983. if (transform != null)
  984. {
  985. RawImage component = transform.GetComponent<RawImage>();
  986. bool flag = facility.IsExistEditCostumeThumbnail();
  987. if (toggleType == Facility.CostumeType.Edit)
  988. {
  989. flag = facility.IsExistEditCostumeThumbnail();
  990. }
  991. else if (toggleType == Facility.CostumeType.Default)
  992. {
  993. flag = !string.IsNullOrEmpty(facility.defaultCostumeThumbnailName);
  994. }
  995. bool flag2 = (toggleType == Facility.CostumeType.Edit || toggleType == Facility.CostumeType.Default) && flag;
  996. if (transform.gameObject.activeSelf != flag2)
  997. {
  998. transform.gameObject.SetActive(flag2);
  999. }
  1000. if (component.texture != null && string.IsNullOrEmpty(component.texture.name))
  1001. {
  1002. try
  1003. {
  1004. UnityEngine.Object.DestroyImmediate(component.texture, false);
  1005. }
  1006. catch
  1007. {
  1008. component.texture = null;
  1009. }
  1010. }
  1011. if (flag2)
  1012. {
  1013. Texture2D texture = null;
  1014. if (toggleType == Facility.CostumeType.Edit)
  1015. {
  1016. texture = facility.GetEditCostumeThumbnail();
  1017. }
  1018. else if (toggleType == Facility.CostumeType.Default)
  1019. {
  1020. texture = facility.GetDefaultCostumeThumbnail();
  1021. }
  1022. component.texture = texture;
  1023. }
  1024. else
  1025. {
  1026. component.texture = null;
  1027. }
  1028. }
  1029. else
  1030. {
  1031. NDebug.Assert("メイドのサムネイル表示オブジェクトがありません", false);
  1032. }
  1033. });
  1034. }
  1035. for (int j = 0; j < componentsInChildren.Length; j++)
  1036. {
  1037. Toggle toggle2 = componentsInChildren[j];
  1038. Facility.CostumeType costumeType = (Facility.CostumeType)j;
  1039. toggle2.isOn = (typeCostume == costumeType);
  1040. toggle2.onValueChanged.Invoke(toggle2.isOn);
  1041. }
  1042. this.m_UIButtonBeginCostumeSetting.interactable = (typeCostume == Facility.CostumeType.Edit);
  1043. }
  1044. public void ButtonEventBeginCostumeSetting()
  1045. {
  1046. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  1047. {
  1048. this.UpdateMaidPropOfCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex, delegate
  1049. {
  1050. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  1051. scriptMgr.adv_kag.JumpLabel(this.m_strScriptEditLabel);
  1052. scriptMgr.adv_kag.Exec();
  1053. });
  1054. }, true, default(Color));
  1055. }
  1056. public void ButtonEventSceneClose()
  1057. {
  1058. if (string.IsNullOrEmpty(this.m_strScriptReturnLabel))
  1059. {
  1060. Debug.Log("[SceneFacilityManagement]シーン終了時に飛ぶラベルがありませんでした");
  1061. return;
  1062. }
  1063. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  1064. {
  1065. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  1066. scriptMgr.adv_kag.JumpLabel(this.m_strScriptReturnLabel);
  1067. scriptMgr.adv_kag.Exec();
  1068. }, true, default(Color));
  1069. }
  1070. private void GetTagBackup()
  1071. {
  1072. Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
  1073. string a;
  1074. if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneFacilityManagement")
  1075. {
  1076. if (!tag_backup.TryGetValue("label", out this.m_strScriptReturnLabel))
  1077. {
  1078. this.m_strScriptReturnLabel = "*施設の管理画面を抜ける";
  1079. }
  1080. if (!tag_backup.TryGetValue("label_edit", out this.m_strScriptEditLabel))
  1081. {
  1082. this.m_strScriptEditLabel = "*施設のコスチュームのエディットを開く";
  1083. }
  1084. if (tag_backup.ContainsKey("update_costume"))
  1085. {
  1086. this.UpdateFacilityCostume(SceneFacilityManagement.m_CostumeEditFacilityIndex);
  1087. this.OpenFacilityCostumeSettingWindow();
  1088. this.OpenCostumeSettingWindow(GameMain.Instance.FacilityMgr.tempSelectFacility);
  1089. }
  1090. else
  1091. {
  1092. SceneFacilityManagement.m_CostumeEditFacilityIndex = -1;
  1093. GameMain.Instance.FacilityMgr.tempSelectFacility = null;
  1094. }
  1095. }
  1096. }
  1097. private void UpdateFacilityCostume(int facilityIndex)
  1098. {
  1099. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  1100. Facility facility = facilityMgr.GetNextDayFacility(facilityIndex);
  1101. if (facility == null)
  1102. {
  1103. facility = facilityMgr.GetFacility(facilityIndex);
  1104. if (facility == null)
  1105. {
  1106. Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex));
  1107. return;
  1108. }
  1109. }
  1110. Maid maidLeader = this.GetMaidLeader();
  1111. if (maidLeader == null)
  1112. {
  1113. NDebug.Warning("メイド長が見つかりません");
  1114. return;
  1115. }
  1116. facility.UpdateEditCostumeToMaidCostume(maidLeader);
  1117. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  1118. for (int i = 0; i < facilityCostumeEnableMPN.Length; i++)
  1119. {
  1120. maidLeader.ResetProp(facilityCostumeEnableMPN[i], true);
  1121. }
  1122. maidLeader.AllProcPropSeqStart();
  1123. maidLeader.Visible = false;
  1124. Debug.Log(string.Format("[SceneFacilityManagement]施設「{0}」の指定コスチュームの更新終了", facility.facilityName));
  1125. }
  1126. private void UpdateMaidPropOfCostume(int facilityIndex, Action callback = null)
  1127. {
  1128. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  1129. Facility facility = facilityMgr.GetNextDayFacility(facilityIndex);
  1130. if (facility == null)
  1131. {
  1132. facility = facilityMgr.GetFacility(facilityIndex);
  1133. if (facility == null)
  1134. {
  1135. Debug.LogWarning(string.Format("[SceneFacilityManagement]インデックス[{0}]番目の施設は存在しない", facilityIndex));
  1136. if (callback != null)
  1137. {
  1138. callback();
  1139. }
  1140. return;
  1141. }
  1142. }
  1143. Maid maid = this.GetMaidLeader();
  1144. if (maid == null)
  1145. {
  1146. NDebug.Warning("メイド長が見つかりません");
  1147. if (callback != null)
  1148. {
  1149. callback();
  1150. }
  1151. return;
  1152. }
  1153. GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
  1154. maid.Visible = true;
  1155. maid.AllProcPropSeqStart();
  1156. base.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, delegate
  1157. {
  1158. facility.UpdateMaidCostumeToEditCostume(maid, true);
  1159. maid.AllProcPropSeqStart();
  1160. this.StartCoroutine(this.coroutine_WaitmaidPropBusy(maid, callback));
  1161. }));
  1162. }
  1163. private IEnumerator coroutine_WaitmaidPropBusy(Maid maid, Action callback)
  1164. {
  1165. while (maid.IsBusy)
  1166. {
  1167. yield return null;
  1168. }
  1169. if (callback != null)
  1170. {
  1171. callback();
  1172. }
  1173. yield break;
  1174. }
  1175. private Maid GetMaidLeader()
  1176. {
  1177. Maid maid = null;
  1178. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1179. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  1180. {
  1181. Maid maid2 = characterMgr.GetMaid(i);
  1182. if (maid2 != null && maid2.status.leader)
  1183. {
  1184. maid = maid2;
  1185. break;
  1186. }
  1187. }
  1188. if (maid == null)
  1189. {
  1190. for (int j = 0; j < characterMgr.GetStockMaidCount(); j++)
  1191. {
  1192. Maid stockMaid = characterMgr.GetStockMaid(j);
  1193. if (stockMaid != null && stockMaid.status.leader)
  1194. {
  1195. maid = stockMaid;
  1196. break;
  1197. }
  1198. }
  1199. }
  1200. if (maid == null)
  1201. {
  1202. for (int k = 0; k < characterMgr.GetMaidCount(); k++)
  1203. {
  1204. Maid maid3 = characterMgr.GetMaid(k);
  1205. if (maid3 != null)
  1206. {
  1207. maid = maid3;
  1208. break;
  1209. }
  1210. }
  1211. }
  1212. if (maid == null)
  1213. {
  1214. for (int l = 0; l < characterMgr.GetStockMaidCount(); l++)
  1215. {
  1216. Maid stockMaid2 = characterMgr.GetStockMaid(l);
  1217. if (stockMaid2 != null)
  1218. {
  1219. maid = stockMaid2;
  1220. break;
  1221. }
  1222. }
  1223. }
  1224. return maid;
  1225. }
  1226. private FacilityManager m_FacilityMgr;
  1227. [SerializeField]
  1228. private Text m_UITextNowMoney;
  1229. [SerializeField]
  1230. private Text m_UITextNowCost;
  1231. [SerializeField]
  1232. private RectTransform m_UIMainMenu;
  1233. [SerializeField]
  1234. private RectTransform m_UIFacilityDetails;
  1235. [SerializeField]
  1236. private RectTransform m_UIFacilityTypeList;
  1237. [SerializeField]
  1238. private RectTransform m_UIFacilityCostume;
  1239. [SerializeField]
  1240. private RectTransform m_UIFacilityPowerUpList;
  1241. [SerializeField]
  1242. private FacilityInfoUI m_UIFacilityInfoConstruction;
  1243. [SerializeField]
  1244. private FacilityInfoUI m_UIFacilityInfoMiniWindow;
  1245. [SerializeField]
  1246. private Button m_UIButtonOK;
  1247. [SerializeField]
  1248. private Button m_UIButtonCANCEL;
  1249. [SerializeField]
  1250. private Button m_UIButtonRESET;
  1251. [SerializeField]
  1252. private Button m_UIButtonDestroyFacility;
  1253. [SerializeField]
  1254. private Toggle m_UIToggleVisibleFacilityInfo;
  1255. [SerializeField]
  1256. private Button m_UIButtonBeginCostumeSetting;
  1257. [SerializeField]
  1258. private StatusViewer m_UIClubStatusViewer;
  1259. [SerializeField]
  1260. private bool m_EnableSetUpCameraAndBG = true;
  1261. private Facility m_CreatingFacility;
  1262. private int m_SelectingFacilityIndex;
  1263. private static int m_CostumeEditFacilityIndex = -1;
  1264. [SerializeField]
  1265. private StartDestroyEventObject m_StartDestroyEventObject;
  1266. private string m_PlayBGM = "BGM009.ogg";
  1267. private long m_NowCost;
  1268. private string m_strScriptReturnLabel = string.Empty;
  1269. private string m_strScriptEditLabel = string.Empty;
  1270. private class FacilityDetailsUI : MonoBehaviour
  1271. {
  1272. private void Awake()
  1273. {
  1274. this.m_FacilityInfoUI = base.GetComponent<FacilityInfoUI>();
  1275. this.m_Toggle = base.GetComponent<Toggle>();
  1276. this.m_Button = base.GetComponentInChildren<Button>();
  1277. this.m_ChangeImage = base.transform.Find("Image Change").gameObject;
  1278. this.m_DeleteImage = base.transform.Find("Image Delete").gameObject;
  1279. this.m_ParentInfo = base.transform.Find("Parent Info").gameObject;
  1280. this.m_ChangeImage.SetActive(false);
  1281. this.m_DeleteImage.SetActive(false);
  1282. this.m_ParentInfo.SetActive(false);
  1283. InputField facilityNameUI = this.m_FacilityInfoUI.textFacilityName;
  1284. facilityNameUI.onEndEdit.RemoveAllListeners();
  1285. facilityNameUI.onEndEdit.AddListener(delegate(string value)
  1286. {
  1287. Facility facility = this.m_FacilityInfoUI.facility;
  1288. value = value.Trim();
  1289. if (string.IsNullOrEmpty(value))
  1290. {
  1291. facilityNameUI.text = facility.facilityName;
  1292. return;
  1293. }
  1294. facility.facilityName = value;
  1295. facilityNameUI.enabled = false;
  1296. });
  1297. this.m_Button.onClick.AddListener(delegate()
  1298. {
  1299. facilityNameUI.enabled = true;
  1300. facilityNameUI.interactable = true;
  1301. facilityNameUI.ActivateInputField();
  1302. });
  1303. }
  1304. private void Start()
  1305. {
  1306. InputField textFacilityName = this.m_FacilityInfoUI.textFacilityName;
  1307. textFacilityName.interactable = false;
  1308. }
  1309. public FacilityInfoUI m_FacilityInfoUI;
  1310. public Toggle m_Toggle;
  1311. public Button m_Button;
  1312. public GameObject m_ChangeImage;
  1313. public GameObject m_DeleteImage;
  1314. public GameObject m_ParentInfo;
  1315. }
  1316. }