KasizukiMainMenu.cs 33 KB

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