SceneFacilityManagement.cs 51 KB

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