KasizukiMainMenu.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace Kasizuki
  6. {
  7. public class KasizukiMainMenu : WfScreenChildren
  8. {
  9. public override void Awake()
  10. {
  11. base.Awake();
  12. GameObject gameObject = base.transform.parent.parent.gameObject;
  13. this.m_SwitchingWindowDic = new Dictionary<string, NGUIWindow>();
  14. this.m_SwitchingWindowDic.Add("部屋選択", UTY.GetChildObject(gameObject, "Window Select Club", false).GetComponent<NGUIWindow>());
  15. this.m_SwitchingWindowDic.Add("メインメニュー", base.root_obj.GetComponent<NGUIWindow>());
  16. this.m_SwitchingWindowDic.Add("メイド情報", UTY.GetChildObject(gameObject, "MaidMiniManagement", false).AddComponent<NGUIWindow>());
  17. this.m_SwitchingWindowDic.Add("セーブロード", UTY.GetChildObject(gameObject, "SaveAndLoadPanel", false).GetComponent<NGUIWindow>());
  18. this.m_SwitchingWindowDic.Add("男選択", UTY.GetChildObject(gameObject, "Window Select Man", false).GetComponent<NGUIWindow>());
  19. this.m_SwitchingWindowDic.Add("施設情報", UTY.GetChildObject(gameObject, "Window Play Info", false).GetComponent<NGUIWindow>());
  20. this.SetUpMainMenu();
  21. this.SetUpSelectRoom();
  22. this.SetUpSaveLoad();
  23. this.SetUpManSelect();
  24. this.SetUpPlayInfo();
  25. }
  26. protected override void OnCall()
  27. {
  28. this.m_SwitchingWindowDic["部屋選択"].GetCache<UIButton>("OK").isEnabled = (KasizukiMainMenu.m_NowSelectingRoom != null);
  29. this.m_SwitchingWindowDic["メイド情報"].OnOpen = delegate
  30. {
  31. MaidMiniManagementCtrl component = base.parent_mgr.children_dic["MaidInfo"].GetComponent<MaidMiniManagementCtrl>();
  32. component.buttonDic["エディット"].gameObject.SetActive(component.selectMaid != null);
  33. };
  34. if ((base.parent_mgr as SceneKasizukiMainMenu).isReturnEdit)
  35. {
  36. MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  37. if (KasizukiMainMenu.m_NowSelectingRoom != null)
  38. {
  39. KasizukiCharacterSelectCtrl charaSelect = maidMiniManagementCtrl.charaSelectMgr;
  40. maidMiniManagementCtrl.selectMaid = null;
  41. charaSelect.callbackGetMaidList = delegate
  42. {
  43. ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
  44. List<PlayData.Data> playDatas = KasizukiMainMenu.m_NowSelectingRoom.GetPlayDatas();
  45. List<PlayData.Data> list = new List<PlayData.Data>();
  46. foreach (PlayData.Data data in playDatas)
  47. {
  48. if (data.enableManTypeDic[nowManType])
  49. {
  50. list.Add(data);
  51. }
  52. }
  53. HashSet<Maid> hashSet = new HashSet<Maid>();
  54. foreach (PlayData.Data data2 in list)
  55. {
  56. List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
  57. foreach (Maid item in filteringPlayDataMaidArray)
  58. {
  59. hashSet.Add(item);
  60. }
  61. }
  62. charaSelect.callbackGetMaidList = null;
  63. return new List<Maid>(hashSet);
  64. };
  65. }
  66. this.OpenSwitchingWindow("メイド情報", true);
  67. this.SetMaidInfoWindowParameter(KasizukiMainMenu.m_BackUpBeforeMaidInfoParameter);
  68. }
  69. else
  70. {
  71. this.OpenSwitchingWindow("メインメニュー", true);
  72. }
  73. if ((base.parent_mgr as SceneKasizukiMainMenu).isUpdateMaidStatus)
  74. {
  75. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  76. Maid maid = characterMgr.GetMaid(0);
  77. if (maid != null)
  78. {
  79. Debug.Log("メイドの仕事回数、好感度を更新");
  80. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  81. bool systemData = kasizukiMgr.GetSystemData<bool>(SystemDataType.仕事回数ロック);
  82. int num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.仕事回数, false);
  83. if (!systemData)
  84. {
  85. kasizukiMgr.SetMaidData<int>(maid, MaidDataType.仕事回数, num + 1, false);
  86. }
  87. if (!kasizukiMgr.GetSystemData<bool>(SystemDataType.好感度ロック))
  88. {
  89. if (kasizukiMgr.GetNowManType() != 10)
  90. {
  91. if (kasizukiMgr.GetNowManType() == 20)
  92. {
  93. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  94. num += 4;
  95. kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, num, false);
  96. }
  97. }
  98. }
  99. Debug.Log("プレイ回数を更新");
  100. num = kasizukiMgr.GetSystemData<int>(SystemDataType.プレイ回数);
  101. num++;
  102. kasizukiMgr.SetSystemData<int>(SystemDataType.プレイ回数, num, false);
  103. }
  104. }
  105. }
  106. private void SetUpMainMenu()
  107. {
  108. NGUIWindow nguiwindow = this.m_SwitchingWindowDic["メインメニュー"];
  109. foreach (UIButton uibutton in new List<UIButton>
  110. {
  111. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/男選択", "男選択"),
  112. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/クラブ", "クラブ"),
  113. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/セーブ", "セーブ"),
  114. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/ロード", "ロード"),
  115. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/ヒロイン", "ヒロイン"),
  116. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/フリー", "フリー"),
  117. nguiwindow.CacheChildObject<UIButton>("parent button/Grid/タイトルに戻る", "タイトルに戻る")
  118. })
  119. {
  120. EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.OnClickButton));
  121. }
  122. }
  123. private void SetUpSelectRoom()
  124. {
  125. NGUIWindow nguiwindow = this.m_SwitchingWindowDic["部屋選択"];
  126. nguiwindow.CacheChildObject<UIButton>("OK", "OK");
  127. nguiwindow.CacheChildObject<UIButton>("Cancel", "Cancel");
  128. EventDelegate.Add(nguiwindow.GetCache<UIButton>("OK").onClick, delegate
  129. {
  130. this.OnOKRoom();
  131. });
  132. EventDelegate.Add(nguiwindow.GetCache<UIButton>("Cancel").onClick, delegate
  133. {
  134. this.OpenSwitchingWindow("メインメニュー", false);
  135. });
  136. nguiwindow.GetComponent<ClubRoomSelectCtrl>().SetCallbackOnClick(new Action<RoomData.Data>(this.OnSelectRoom));
  137. }
  138. private void SetUpSaveLoad()
  139. {
  140. NGUIWindow nguiwindow = this.m_SwitchingWindowDic["セーブロード"];
  141. KasizukiSaveAndLoadCtrl component = nguiwindow.GetComponent<KasizukiSaveAndLoadCtrl>();
  142. NDebug.Assert(component != null, "セーブロードUIが取得できない");
  143. KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl = component;
  144. kasizukiSaveAndLoadCtrl.onClickCancel = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl.onClickCancel, new Action(delegate
  145. {
  146. this.OpenSwitchingWindow("メインメニュー", false);
  147. }));
  148. KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl2 = component;
  149. kasizukiSaveAndLoadCtrl2.onClickNewGame = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl2.onClickNewGame, new Action(delegate
  150. {
  151. SceneKasizukiMainMenu mgr = base.parent_mgr as SceneKasizukiMainMenu;
  152. mgr.CameraFadeOut(delegate
  153. {
  154. mgr.UpdateMan(delegate
  155. {
  156. mgr.CameraFadeIn(null);
  157. this.OpenSwitchingWindow("メインメニュー", true);
  158. });
  159. }, 0.5f);
  160. }));
  161. KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl3 = component;
  162. kasizukiSaveAndLoadCtrl3.onLoad = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl3.onLoad, new Action(delegate
  163. {
  164. SceneKasizukiMainMenu mgr = base.parent_mgr as SceneKasizukiMainMenu;
  165. mgr.CameraFadeOut(delegate
  166. {
  167. mgr.UpdateMan(delegate
  168. {
  169. mgr.CameraFadeIn(null);
  170. this.OpenSwitchingWindow("メインメニュー", true);
  171. });
  172. }, 0.5f);
  173. }));
  174. KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl4 = component;
  175. kasizukiSaveAndLoadCtrl4.onSave = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl4.onSave, new Action(delegate
  176. {
  177. int nowOriginSaveDataNumber = GameMain.Instance.KasizukiMgr.NowOriginSaveDataNumber;
  178. if (GameMain.Instance.GetSaveDataHeader(nowOriginSaveDataNumber) == null)
  179. {
  180. NDebug.Assert("本編セーブデータ" + nowOriginSaveDataNumber + "番の取得に失敗しました", false);
  181. return;
  182. }
  183. GameMain.Instance.SerializeKasizukiOnly(nowOriginSaveDataNumber);
  184. }));
  185. KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl5 = component;
  186. kasizukiSaveAndLoadCtrl5.onDelete = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl5.onDelete, new Action(delegate
  187. {
  188. int nowOriginSaveDataNumber = GameMain.Instance.KasizukiMgr.NowOriginSaveDataNumber;
  189. if (GameMain.Instance.GetSaveDataHeader(nowOriginSaveDataNumber) == null)
  190. {
  191. NDebug.Assert("本編セーブデータ" + nowOriginSaveDataNumber + "番の取得に失敗しました", false);
  192. return;
  193. }
  194. GameMain.Instance.SerializeKasizukiOnly(nowOriginSaveDataNumber);
  195. }));
  196. }
  197. private void SetUpManSelect()
  198. {
  199. NGUIWindow nguiwindow = this.m_SwitchingWindowDic["男選択"];
  200. nguiwindow.CacheChildObject<UIButton>("OK", "OK");
  201. nguiwindow.CacheChildObject<UIButton>("Cancel", "Cancel");
  202. EventDelegate.Add(nguiwindow.GetCache<UIButton>("OK").onClick, delegate
  203. {
  204. this.OpenSwitchingWindow("メインメニュー", false);
  205. });
  206. EventDelegate.Add(nguiwindow.GetCache<UIButton>("Cancel").onClick, delegate
  207. {
  208. this.OpenSwitchingWindow("メインメニュー", false);
  209. });
  210. KasizukiManSelectCtrl compManSelect = nguiwindow.GetComponent<KasizukiManSelectCtrl>();
  211. if (compManSelect)
  212. {
  213. NGUIWindow nguiwindow2 = nguiwindow;
  214. nguiwindow2.OnOpen = (Action)Delegate.Combine(nguiwindow2.OnOpen, new Action(delegate
  215. {
  216. int nowManType = GameMain.Instance.KasizukiMgr.GetNowManType();
  217. compManSelect.OnClickManListButton(nowManType);
  218. }));
  219. KasizukiManSelectCtrl compManSelect2 = compManSelect;
  220. compManSelect2.OnClickManTypeButton = (Action<int>)Delegate.Combine(compManSelect2.OnClickManTypeButton, new Action<int>(delegate(int manTypeID)
  221. {
  222. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  223. kasizukiMgr.SetNowManType(manTypeID);
  224. SceneKasizukiMainMenu sceneMgr = this.parent_mgr as SceneKasizukiMainMenu;
  225. sceneMgr.UpdateMan(delegate
  226. {
  227. sceneMgr.CameraFadeIn(null);
  228. });
  229. }));
  230. }
  231. }
  232. private void SetUpPlayInfo()
  233. {
  234. NGUIWindow window = this.m_SwitchingWindowDic["施設情報"];
  235. window.CacheChildObject<UIButton>("OK", "OK");
  236. window.CacheChildObject<UIButton>("Cancel", "Cancel");
  237. KasizukiPlayInfoCtrl comp = window.GetComponent<KasizukiPlayInfoCtrl>();
  238. RoomData.Data selectingRoomData = null;
  239. ManData.Data selectingManData = null;
  240. PlayData.Data selectingPlayData = null;
  241. EventDelegate.Add(window.GetCache<UIButton>("OK").onClick, delegate
  242. {
  243. MaidMiniManagementCtrl maidMiniManagementCtrl = this.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  244. this.StartFree(maidMiniManagementCtrl.selectMaid, selectingRoomData, selectingManData, selectingPlayData);
  245. });
  246. EventDelegate.Set(window.GetCache<UIButton>("Cancel").onClick, delegate
  247. {
  248. this.OpenSwitchingWindow("メインメニュー", false);
  249. });
  250. Action actResetDescriptionWindow = delegate
  251. {
  252. UILabel cache = comp.descriptionCache.GetCache<UILabel>("説明文");
  253. uGUIListViewer cache2 = comp.descriptionCache.GetCache<uGUIListViewer>("条件一覧");
  254. cache.text = string.Empty;
  255. cache2.ResetList();
  256. };
  257. Action<PlayData.Data> actSetDescriptionWindow = delegate(PlayData.Data playData)
  258. {
  259. UILabel cache = comp.descriptionCache.GetCache<UILabel>("説明文");
  260. cache.text = playData.strDescription;
  261. uGUIListViewer cache2 = comp.descriptionCache.GetCache<uGUIListViewer>("条件一覧");
  262. string[] strConditionArray = playData.strConditionArray;
  263. cache2.Show<Transform>(strConditionArray.Length, delegate(int index, Transform trans)
  264. {
  265. UILabel component = UTY.GetChildObject(trans.gameObject, "Value", false).GetComponent<UILabel>();
  266. UILabel component2 = UTY.GetChildObject(trans.gameObject, "Number", false).GetComponent<UILabel>();
  267. component.text = strConditionArray[index];
  268. component2.text = (index + 1).ToString();
  269. });
  270. cache2.GetComponent<UIGrid>().Reposition();
  271. };
  272. Action<RoomData.Data, ManData.Data, PlayData.Data> actSetOKButtonEnable = delegate(RoomData.Data roomData, ManData.Data manData, PlayData.Data playData)
  273. {
  274. UIButton cache = window.GetCache<UIButton>("OK");
  275. cache.isEnabled = (roomData != null && manData != null && playData != null);
  276. };
  277. NGUIWindow window2 = window;
  278. window2.OnOpen = (Action)Delegate.Combine(window2.OnOpen, new Action(delegate
  279. {
  280. selectingManData = ManData.GetData(GameMain.Instance.KasizukiMgr.GetNowManType());
  281. List<RoomData.Data> datas;
  282. if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  283. {
  284. datas = RoomData.GetDatas((RoomData.Data data) => data.isExistUpwardRoom && !data.isOnlyNTR);
  285. }
  286. else
  287. {
  288. datas = RoomData.GetDatas(delegate(RoomData.Data data)
  289. {
  290. RoomData.Data subordinateRoomData = data.GetSubordinateRoomData();
  291. if (subordinateRoomData != null)
  292. {
  293. return false;
  294. }
  295. if (!data.enableManTypeDic[ManDataType.主人公])
  296. {
  297. return false;
  298. }
  299. if (!data.isEnableNTR && !data.isOnlyNTR)
  300. {
  301. return false;
  302. }
  303. List<PlayData.Data> playDatas = data.GetPlayDatas();
  304. for (int i = 0; i < playDatas.Count; i++)
  305. {
  306. if (playDatas[i].enableManTypeDic[ManDataType.主人公])
  307. {
  308. return true;
  309. }
  310. }
  311. return false;
  312. });
  313. }
  314. comp.OpenRoomList(datas, selectingRoomData);
  315. actResetDescriptionWindow();
  316. actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
  317. }));
  318. KasizukiPlayInfoCtrl comp6 = comp;
  319. comp6.onClickRoom = (Action<RoomData.Data>)Delegate.Combine(comp6.onClickRoom, new Action<RoomData.Data>(delegate(RoomData.Data roomData)
  320. {
  321. selectingRoomData = roomData;
  322. comp.OpenManList(ManData.GetAllDatas(true, true), selectingManData, delegate(UIWFTabButton item, ManData.Data data)
  323. {
  324. bool flag = selectingRoomData.enableManTypeDic[data.manType];
  325. if (!flag && item.isSelected)
  326. {
  327. item.SetSelect(false);
  328. }
  329. item.gameObject.SetActive(flag);
  330. });
  331. List<PlayData.Data> datas = PlayData.GetDatas((PlayData.Data data) => data.roomID == selectingRoomData.ID && data.enableManTypeDic[selectingManData.manType]);
  332. comp.OpenPlayList(datas, null);
  333. actResetDescriptionWindow();
  334. selectingPlayData = null;
  335. actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
  336. }));
  337. KasizukiPlayInfoCtrl comp2 = comp;
  338. comp2.onClickMan = (Action<ManData.Data>)Delegate.Combine(comp2.onClickMan, new Action<ManData.Data>(delegate(ManData.Data manData)
  339. {
  340. selectingManData = manData;
  341. List<PlayData.Data> datas = PlayData.GetDatas((PlayData.Data data) => data.roomID == selectingRoomData.ID && data.enableManTypeDic[selectingManData.manType]);
  342. comp.OpenPlayList(datas, null);
  343. actResetDescriptionWindow();
  344. selectingPlayData = null;
  345. actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
  346. }));
  347. KasizukiPlayInfoCtrl comp3 = comp;
  348. comp3.onClickPlay = (Action<PlayData.Data>)Delegate.Combine(comp3.onClickPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
  349. {
  350. selectingPlayData = playData;
  351. actSetDescriptionWindow(selectingPlayData);
  352. actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
  353. }));
  354. KasizukiPlayInfoCtrl comp4 = comp;
  355. comp4.onHoverPlay = (Action<PlayData.Data>)Delegate.Combine(comp4.onHoverPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
  356. {
  357. actSetDescriptionWindow(playData);
  358. }));
  359. KasizukiPlayInfoCtrl comp5 = comp;
  360. comp5.onOutPlay = (Action<PlayData.Data>)Delegate.Combine(comp5.onOutPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
  361. {
  362. if (selectingPlayData == null)
  363. {
  364. actResetDescriptionWindow();
  365. }
  366. else
  367. {
  368. actSetDescriptionWindow(selectingPlayData);
  369. }
  370. }));
  371. }
  372. protected void OnClickButton()
  373. {
  374. NGUIWindow nguiwindow = this.m_SwitchingWindowDic["メインメニュー"];
  375. List<UnityEngine.Object> values = nguiwindow.cachedObjectDic.Values;
  376. if (!values.Contains(UIButton.current))
  377. {
  378. NDebug.Warning(string.Format("クリックされたボタン名に対応するボタンがありません\n{0}", UIButton.current.name));
  379. }
  380. string name = UIButton.current.name;
  381. if (name == "男選択")
  382. {
  383. this.OpenSwitchingWindow("男選択", false);
  384. }
  385. else if (name == "クラブ")
  386. {
  387. if (!this.CheckPlayableRoom())
  388. {
  389. GameMain.Instance.SysDlg.Show("利用可能な施設がありません。", SystemDialog.TYPE.OK, null, null);
  390. return;
  391. }
  392. if (!this.CheckPlayableMaid())
  393. {
  394. GameMain.Instance.SysDlg.Show("プレイ可能なメイドがいません。", SystemDialog.TYPE.OK, null, null);
  395. return;
  396. }
  397. this.OnSelectRoom(null);
  398. this.OpenSwitchingWindow("部屋選択", false);
  399. (this.m_SwitchingWindowDic["部屋選択"] as ClubRoomSelectCtrl).SetData();
  400. }
  401. else if (name == "セーブ")
  402. {
  403. this.OpenSwitchingWindow("セーブロード", false);
  404. KasizukiSaveAndLoadCtrl component = this.m_SwitchingWindowDic["セーブロード"].GetComponent<KasizukiSaveAndLoadCtrl>();
  405. component.Open(SaveAndLoadMgr.ViewType.Save, true);
  406. }
  407. else if (name == "ロード")
  408. {
  409. this.OpenSwitchingWindow("セーブロード", false);
  410. KasizukiSaveAndLoadCtrl component2 = this.m_SwitchingWindowDic["セーブロード"].GetComponent<KasizukiSaveAndLoadCtrl>();
  411. component2.Open(SaveAndLoadMgr.ViewType.Load, true);
  412. }
  413. else if (name == "ヒロイン")
  414. {
  415. this.OpenSwitchingWindow("メイド情報", false);
  416. this.SetMaidInfoWindowParameter("ヒロイン情報");
  417. }
  418. else if (name == "フリー")
  419. {
  420. this.OpenSwitchingWindow("メイド情報", false);
  421. this.SetMaidInfoWindowParameter("フリーモード");
  422. }
  423. else if (name == "タイトルに戻る")
  424. {
  425. GameMain.Instance.SysDlg.Show("保存されていない情報は失われます。\nタイトルに戻りますか?", SystemDialog.TYPE.YES_NO, delegate
  426. {
  427. GameMain.Instance.SysDlg.Close();
  428. GameMain.Instance.LoadScene("SceneToTitle");
  429. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  430. }, delegate
  431. {
  432. GameMain.Instance.SysDlg.Close();
  433. });
  434. }
  435. }
  436. public void OpenSwitchingWindow(string name, bool isImmediate = false)
  437. {
  438. Dictionary<string, NGUIWindow> switchingWindowDic = this.m_SwitchingWindowDic;
  439. if (switchingWindowDic == null)
  440. {
  441. NDebug.Assert("ウィンドウの配列にnullが指定されました", false);
  442. }
  443. if (!switchingWindowDic.ContainsKey(name))
  444. {
  445. NDebug.Assert(string.Format("ウィンドウの配列には「{0}」のキーが存在しません", name), false);
  446. }
  447. if (name == "メインメニュー")
  448. {
  449. MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  450. maidMiniManagementCtrl.selectMaid = null;
  451. }
  452. foreach (KeyValuePair<string, NGUIWindow> keyValuePair in switchingWindowDic)
  453. {
  454. if (keyValuePair.Key == name)
  455. {
  456. if (isImmediate)
  457. {
  458. keyValuePair.Value.Open(0.01f, null);
  459. }
  460. else
  461. {
  462. keyValuePair.Value.Open(0.25f, null);
  463. }
  464. }
  465. else if (isImmediate)
  466. {
  467. keyValuePair.Value.Close(0.01f, null);
  468. }
  469. else
  470. {
  471. keyValuePair.Value.Close(0.25f, null);
  472. }
  473. }
  474. }
  475. public void CloseSwitchingWindowAll(bool isImmediate = false)
  476. {
  477. Dictionary<string, NGUIWindow> switchingWindowDic = this.m_SwitchingWindowDic;
  478. if (switchingWindowDic == null)
  479. {
  480. NDebug.Assert("ウィンドウの配列にnullが指定されました", false);
  481. }
  482. foreach (KeyValuePair<string, NGUIWindow> keyValuePair in switchingWindowDic)
  483. {
  484. if (isImmediate)
  485. {
  486. keyValuePair.Value.Close(0.01f, null);
  487. }
  488. else
  489. {
  490. keyValuePair.Value.Close(0.25f, null);
  491. }
  492. }
  493. }
  494. private bool CheckPlayableRoom()
  495. {
  496. ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
  497. foreach (RoomData.Data data in RoomData.GetAllDatas(true))
  498. {
  499. if (data.enableManTypeDic[nowManType])
  500. {
  501. if (data.IsExistFacility())
  502. {
  503. return true;
  504. }
  505. }
  506. }
  507. return false;
  508. }
  509. private bool CheckPlayableMaid()
  510. {
  511. ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
  512. foreach (RoomData.Data data in RoomData.GetAllDatas(true))
  513. {
  514. if (data.enableManTypeDic[nowManType])
  515. {
  516. if (data.IsExistFacility())
  517. {
  518. foreach (PlayData.Data data2 in data.GetPlayDatas())
  519. {
  520. if (data2.enableManTypeDic[nowManType])
  521. {
  522. List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
  523. if (filteringPlayDataMaidArray != null && filteringPlayDataMaidArray.Count > 0)
  524. {
  525. return true;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. }
  532. return false;
  533. }
  534. private void OnSelectRoom(RoomData.Data roomData)
  535. {
  536. KasizukiMainMenu.m_NowSelectingRoom = roomData;
  537. this.m_SwitchingWindowDic["部屋選択"].GetCache<UIButton>("OK").isEnabled = (KasizukiMainMenu.m_NowSelectingRoom != null);
  538. }
  539. private void OnOKRoom()
  540. {
  541. if (KasizukiMainMenu.m_NowSelectingRoom == null)
  542. {
  543. NDebug.Warning("現在選択している部屋の情報がnullでした");
  544. return;
  545. }
  546. MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  547. KasizukiCharacterSelectCtrl charaSelect = maidMiniManagementCtrl.charaSelectMgr;
  548. maidMiniManagementCtrl.selectMaid = null;
  549. charaSelect.callbackGetMaidList = delegate
  550. {
  551. ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
  552. List<PlayData.Data> playDatas = KasizukiMainMenu.m_NowSelectingRoom.GetPlayDatas();
  553. List<PlayData.Data> list = new List<PlayData.Data>();
  554. foreach (PlayData.Data data in playDatas)
  555. {
  556. if (data.enableManTypeDic[nowManType])
  557. {
  558. list.Add(data);
  559. }
  560. }
  561. HashSet<Maid> hashSet = new HashSet<Maid>();
  562. foreach (PlayData.Data data2 in list)
  563. {
  564. List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
  565. foreach (Maid item in filteringPlayDataMaidArray)
  566. {
  567. hashSet.Add(item);
  568. }
  569. }
  570. charaSelect.callbackGetMaidList = null;
  571. return new List<Maid>(hashSet);
  572. };
  573. GameMain.Instance.KasizukiMgr.SetSystemData<int>(SystemDataType.選択部屋, KasizukiMainMenu.m_NowSelectingRoom.ID, true);
  574. this.OpenSwitchingWindow("メイド情報", false);
  575. this.SetMaidInfoWindowParameter("ヒロイン選択");
  576. }
  577. private void SetMaidInfoWindowParameter(string openType)
  578. {
  579. MaidMiniManagementCtrl window = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  580. window.Open();
  581. window.Call();
  582. if (openType == "ヒロイン情報")
  583. {
  584. window.onClickOK = delegate
  585. {
  586. this.OpenSwitchingWindow("メインメニュー", false);
  587. };
  588. window.buttonDic["OK"].isEnabled = true;
  589. window.buttonDic["Cancel"].gameObject.SetActive(false);
  590. if (window.selectMaid == null)
  591. {
  592. window.CloseSwitchingWindowAll(true);
  593. }
  594. window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
  595. MaidMiniStatusCtrl window4 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
  596. Collider component = window4.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
  597. component.enabled = true;
  598. window4.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(true);
  599. window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.one;
  600. }
  601. else if (openType == "ヒロイン選択")
  602. {
  603. window.onClickOK = delegate
  604. {
  605. this.StartSenario(window.selectMaid, KasizukiMainMenu.m_NowSelectingRoom);
  606. };
  607. window.onClickCancel = delegate
  608. {
  609. this.OpenSwitchingWindow("部屋選択", false);
  610. this.OnSelectRoom(null);
  611. (this.m_SwitchingWindowDic["部屋選択"] as ClubRoomSelectCtrl).SetData();
  612. };
  613. window.buttonDic["OK"].isEnabled = (window.selectMaid != null);
  614. window.buttonDic["Cancel"].gameObject.SetActive(true);
  615. if (window.selectMaid == null)
  616. {
  617. window.CloseSwitchingWindowAll(true);
  618. }
  619. window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
  620. MaidMiniStatusCtrl window2 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
  621. Collider component2 = window2.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
  622. component2.enabled = false;
  623. window2.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(false);
  624. window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.one;
  625. }
  626. else if (openType == "フリーモード")
  627. {
  628. window.onClickOK = delegate
  629. {
  630. this.OpenSwitchingWindow("施設情報", false);
  631. UIButton cache = this.m_SwitchingWindowDic["施設情報"].GetCache<UIButton>("Cancel");
  632. EventDelegate.Set(cache.onClick, delegate
  633. {
  634. this.OpenSwitchingWindow("メイド情報", false);
  635. this.SetMaidInfoWindowParameter("フリーモード");
  636. });
  637. };
  638. window.onClickCancel = delegate
  639. {
  640. this.OpenSwitchingWindow("メインメニュー", false);
  641. };
  642. window.buttonDic["OK"].isEnabled = (window.selectMaid != null);
  643. window.buttonDic["Cancel"].gameObject.SetActive(true);
  644. if (window.selectMaid == null)
  645. {
  646. window.CloseSwitchingWindowAll(true);
  647. }
  648. window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
  649. MaidMiniStatusCtrl window3 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
  650. Collider component3 = window3.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
  651. component3.enabled = false;
  652. window3.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(false);
  653. window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.zero;
  654. }
  655. else
  656. {
  657. NDebug.Warning(string.Format("メイド情報ウィンドウのレイアウト設定の文字列が対応していません\n渡された文字列:{0}", openType));
  658. }
  659. KasizukiMainMenu.m_BackUpBeforeMaidInfoParameter = openType;
  660. }
  661. private void StartSenario(Maid targetMaid, RoomData.Data targetRoom)
  662. {
  663. ManData.Data data = ManData.GetData(GameMain.Instance.KasizukiMgr.GetNowManType());
  664. Debug.LogFormat("傅きモードのシナリオを開始します\r\n選択状態↓\r\nメイド:{0}\r\n選択した部屋:{1}\r\n選択した男:{2}\r\n", new object[]
  665. {
  666. targetMaid.status.fullNameJpStyle,
  667. targetRoom.drawName,
  668. data.drawName
  669. });
  670. PlayData.Data optimalConditionData = PlayData.GetOptimalConditionData(targetMaid, targetRoom, data.manType);
  671. string scenarioFileNameReplace = optimalConditionData.GetScenarioFileNameReplace(targetMaid);
  672. Debug.LogFormat("呼び出すシナリオは「{0}」になりました", new object[]
  673. {
  674. scenarioFileNameReplace
  675. });
  676. if (!GameUty.FileSystem.IsExistentFile(scenarioFileNameReplace + ".ks"))
  677. {
  678. NDebug.Warning(string.Format("シナリオファイル「{0}」が見つかりません。\nシナリオ呼び出しは行いません。", scenarioFileNameReplace + ".ks"));
  679. return;
  680. }
  681. SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
  682. if (!sceneKasizukiMainMenu.moveScreen.IsExistNextLabel())
  683. {
  684. sceneKasizukiMainMenu.moveScreen.SetNextLabel(sceneKasizukiMainMenu.strScriptReturnLabel);
  685. }
  686. this.Finish();
  687. }
  688. private void StartFree(Maid targetMaid, RoomData.Data targetRoom, ManData.Data targetMan, PlayData.Data targetPlay)
  689. {
  690. Debug.LogFormat("傅きモードの回想を開始します\r\n選択状態↓\r\nメイド:{0}\r\n選択した部屋:{1}\r\n選択した男:{2}\r\n選択したプレイ情報:{3}\r\n", new object[]
  691. {
  692. targetMaid.status.fullNameJpStyle,
  693. targetRoom.drawName,
  694. targetMan.drawName,
  695. targetPlay.drawName
  696. });
  697. string scenarioFileNameReplace = targetPlay.GetScenarioFileNameReplace(targetMaid);
  698. Debug.LogFormat("呼び出すシナリオは「{0}」になりました", new object[]
  699. {
  700. scenarioFileNameReplace
  701. });
  702. if (!GameUty.FileSystem.IsExistentFile(scenarioFileNameReplace + ".ks"))
  703. {
  704. NDebug.Warning(string.Format("シナリオファイル「{0}」が見つかりません。\nシナリオ呼び出しは行いません。", scenarioFileNameReplace + ".ks"));
  705. return;
  706. }
  707. Debug.Log("システムデータのフラグを一時的に書き換え");
  708. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  709. kasizukiMgr.SetSystemData<int>(SystemDataType.選択部屋, targetRoom.ID, false);
  710. kasizukiMgr.SetNowManType(targetMan.ID);
  711. GameMain.Instance.ScriptMgr.EvalScript("tf['傅き再生_ファイル名'] = '" + scenarioFileNameReplace + "';");
  712. SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
  713. if (!sceneKasizukiMainMenu.moveScreen.IsExistNextLabel())
  714. {
  715. sceneKasizukiMainMenu.moveScreen.SetNextLabel(sceneKasizukiMainMenu.strScriptReturnLabelFree);
  716. }
  717. this.Finish();
  718. }
  719. protected override void OnFinish()
  720. {
  721. this.CloseSwitchingWindowAll(true);
  722. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  723. Maid man = kasizukiMgr.GetMan();
  724. kasizukiMgr.SetManModel(man, (ManDataType)kasizukiMgr.GetNowManType());
  725. kasizukiMgr.UpdateManModel(man, null);
  726. man.Visible = false;
  727. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  728. MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
  729. characterMgr.SetActiveMaid(maidMiniManagementCtrl.selectMaid, 0);
  730. maidMiniManagementCtrl.selectMaid.Visible = true;
  731. maidMiniManagementCtrl.selectMaid.AllProcPropSeqStart();
  732. base.StartCoroutine(this.CoroutineWaitPropSeq(maidMiniManagementCtrl.selectMaid, delegate
  733. {
  734. SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
  735. if (!string.IsNullOrEmpty(sceneKasizukiMainMenu.moveScreen.next_label))
  736. {
  737. sceneKasizukiMainMenu.CallScreen("Move");
  738. }
  739. }));
  740. }
  741. private IEnumerator CoroutineWaitPropSeq(Maid target, Action callback)
  742. {
  743. while (target.IsBusy)
  744. {
  745. yield return null;
  746. }
  747. if (callback != null)
  748. {
  749. callback();
  750. }
  751. yield break;
  752. }
  753. private static string m_BackUpBeforeMaidInfoParameter = string.Empty;
  754. private const string STR_MESSAGE_NOTHING_ROOM = "利用可能な施設がありません。";
  755. private const string STR_MESSAGE_NOTHING_MAID = "プレイ可能なメイドがいません。";
  756. private const string STR_MESSAGE_END = "保存されていない情報は失われます。\nタイトルに戻りますか?";
  757. private static RoomData.Data m_NowSelectingRoom;
  758. private Dictionary<string, NGUIWindow> m_SwitchingWindowDic;
  759. }
  760. }