FreeSkillSelect.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using I2.Loc;
  5. using MaidStatus;
  6. using UnityEngine;
  7. using wf;
  8. using Yotogis;
  9. public class FreeSkillSelect : MonoBehaviour
  10. {
  11. public void Awake()
  12. {
  13. if (this.update_obj_dic_ != null)
  14. {
  15. return;
  16. }
  17. this.update_obj_dic_ = new Dictionary<string, FreeSkillSelect.UpdateObject>();
  18. Func<GameObject, FreeSkillSelect.UpdateObject> func = delegate(GameObject top_obj)
  19. {
  20. GameObject childObject = UTY.GetChildObject(top_obj, "Content", false);
  21. FreeSkillSelect.UpdateObject updateObject = new FreeSkillSelect.UpdateObject();
  22. updateObject.storage_obj = UTY.GetChildObject(childObject, "StorageRoom", true);
  23. updateObject.arrow_obj = UTY.GetChildObject(top_obj, "Arrow", false);
  24. updateObject.ui_panel = childObject.GetComponent<UIPanel>();
  25. updateObject.scroll_view = childObject.GetComponent<UIScrollView>();
  26. updateObject.button_parent = UTY.GetChildObject(childObject, "GridParent", false);
  27. updateObject.ui_grid = updateObject.button_parent.GetComponent<UIGrid>();
  28. updateObject.tab_panel = updateObject.button_parent.GetComponent<UIWFTabPanel>();
  29. return updateObject;
  30. };
  31. string[] array = new string[]
  32. {
  33. "TypeCategoryViewer",
  34. "CategoryViewer",
  35. "SkillSelectViewer",
  36. "LevelViewer",
  37. "StageSelectViewer"
  38. };
  39. string[] array2 = new string[]
  40. {
  41. "タイプ",
  42. "カテゴリー",
  43. "スキル",
  44. "レベル",
  45. "ステージ"
  46. };
  47. for (int i = 0; i < array.Length; i++)
  48. {
  49. this.update_obj_dic_.Add(array2[i], func(UTY.GetChildObject(base.gameObject, array[i], false)));
  50. }
  51. this.select_stage_ = (this.user_request_stage = YotogiStage.GetAllDatas(true)[0]);
  52. }
  53. public void Start()
  54. {
  55. }
  56. public void SetMaid(Maid maid)
  57. {
  58. this.maid_ = maid;
  59. }
  60. public void SetYotogiManager(YotogiManager yotogi_mgr)
  61. {
  62. this.yotogi_mgr_ = yotogi_mgr;
  63. }
  64. public void CreateInstanceButton()
  65. {
  66. if (this.button_data_list_ != null)
  67. {
  68. return;
  69. }
  70. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["ステージ"];
  71. FreeSkillSelect.UpdateObject updateObject2 = this.update_obj_dic_["タイプ"];
  72. FreeSkillSelect.UpdateObject updateObject3 = this.update_obj_dic_["レベル"];
  73. foreach (KeyValuePair<string, FreeSkillSelect.UpdateObject> keyValuePair in this.update_obj_dic_)
  74. {
  75. FreeSkillSelect.UpdateObject value = keyValuePair.Value;
  76. value.Clear();
  77. value.Update();
  78. }
  79. int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
  80. HashSet<int> hashSet = new HashSet<int>();
  81. List<YotogiStage.Data> allDatas = YotogiStage.GetAllDatas(true);
  82. allDatas.Sort();
  83. foreach (YotogiStage.Data data in allDatas)
  84. {
  85. if (data.isYotogiPlayable(this.maid_, clubGrade, false))
  86. {
  87. string a = string.Empty;
  88. for (int i = 0; i < 2; i++)
  89. {
  90. if (!string.IsNullOrEmpty(data.prefabName[i]) && !(a == data.prefabName[i]))
  91. {
  92. GameObject gameObject = Utility.CreatePrefab(updateObject.button_parent, "SceneYotogi/StageSelect/Prefab/StageUnit", true);
  93. a = (gameObject.name = data.prefabName[0]);
  94. YotogiStageUnit component = gameObject.GetComponent<YotogiStageUnit>();
  95. component.SetStageData(data, true, i == 0);
  96. component.SetOnSelectEvent(new YotogiStageUnit.OnSelectEvent(this.OnClickStageEvent));
  97. component.is_change_bg = false;
  98. if (!hashSet.Contains(data.id))
  99. {
  100. hashSet.Add(data.id);
  101. }
  102. }
  103. }
  104. }
  105. }
  106. updateObject.Update();
  107. this.button_data_list_ = FreeSkillSelect.CreateButtonData(this.maid_, hashSet);
  108. GameObject button_parent = updateObject3.button_parent;
  109. for (int j = 0; j < 3; j++)
  110. {
  111. EventDelegate onclick_event = new EventDelegate(this, "OnClickLevelBtnEvent");
  112. UIWFTabButton uiwftabButton = this.CreateTypeAndCategoryButton(updateObject3, "Lv." + (j + 1).ToString(), null, true, onclick_event);
  113. uiwftabButton.name = (j + 1).ToString();
  114. }
  115. updateObject3.Update();
  116. List<Transform> childList = updateObject3.ui_grid.GetChildList();
  117. for (int k = 0; k < childList.Count; k++)
  118. {
  119. UIWFTabButton componentInChildren = childList[k].gameObject.GetComponentInChildren<UIWFTabButton>();
  120. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  121. {
  122. updateObject3.tab_panel.Select(componentInChildren);
  123. break;
  124. }
  125. }
  126. GameObject button_parent2 = updateObject2.button_parent;
  127. for (int l = 0; l < this.button_data_list_.Count; l++)
  128. {
  129. FreeSkillSelect.ButtonData buttonData = this.button_data_list_[l];
  130. EventDelegate eventDelegate = new EventDelegate(this, "OnClickTypeBtnEvent");
  131. eventDelegate.parameters[0].value = buttonData;
  132. if (buttonData.children_list.Count != 0)
  133. {
  134. buttonData.tab_button_obj = this.CreateTypeAndCategoryButton(updateObject2, buttonData.name, buttonData.nameTerm, 0 < this.button_data_list_[l].children_list.Count, eventDelegate);
  135. bool flag = false;
  136. foreach (FreeSkillSelect.ButtonData buttonData2 in buttonData.children_list)
  137. {
  138. foreach (FreeSkillSelect.ButtonData buttonData3 in buttonData2.children_list)
  139. {
  140. Skill.Data skill_data = buttonData3.skill_data;
  141. if (1 < skill_data.user_player_num)
  142. {
  143. int num = 1;
  144. while (num < skill_data.user_player_num && !flag)
  145. {
  146. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  147. if (maid != null)
  148. {
  149. bool flag2 = !PersonalEventBlocker.IsEnabledYotodiSkill(maid.status.personal, skill_data.id);
  150. if (!skill_data.recollectionHaremLockPersonalIds.Contains(maid.status.personal.id) && !flag2)
  151. {
  152. flag = true;
  153. }
  154. }
  155. num++;
  156. }
  157. }
  158. else
  159. {
  160. flag = true;
  161. }
  162. if (flag)
  163. {
  164. break;
  165. }
  166. }
  167. }
  168. buttonData.tab_button_obj.isEnabled = flag;
  169. }
  170. }
  171. updateObject2.Update();
  172. childList = updateObject2.ui_grid.GetChildList();
  173. for (int m = 0; m < childList.Count; m++)
  174. {
  175. UIWFTabButton componentInChildren2 = childList[m].gameObject.GetComponentInChildren<UIWFTabButton>();
  176. if (!(componentInChildren2 == null) && componentInChildren2.isEnabled)
  177. {
  178. updateObject2.tab_panel.Select(componentInChildren2);
  179. break;
  180. }
  181. }
  182. }
  183. public void SelectSkill(Skill.Data skill, YotogiStage.Data stage_data)
  184. {
  185. if (skill == null)
  186. {
  187. return;
  188. }
  189. FreeSkillSelect.ButtonData buttonData = null;
  190. FreeSkillSelect.ButtonData buttonData2 = null;
  191. FreeSkillSelect.ButtonData buttonData3 = null;
  192. bool flag = true;
  193. int num = 0;
  194. while (num < this.button_data_list_.Count && flag)
  195. {
  196. buttonData = this.button_data_list_[num];
  197. int num2 = 0;
  198. while (num2 < buttonData.children_list.Count && flag)
  199. {
  200. buttonData2 = buttonData.children_list[num2];
  201. int num3 = 0;
  202. while (num3 < buttonData2.children_list.Count && flag)
  203. {
  204. buttonData3 = buttonData2.children_list[num3];
  205. if (buttonData3.skill_data == skill)
  206. {
  207. flag = false;
  208. }
  209. num3++;
  210. }
  211. num2++;
  212. }
  213. num++;
  214. }
  215. if (flag)
  216. {
  217. return;
  218. }
  219. if (!buttonData.tab_button_obj.isSelected)
  220. {
  221. this.update_obj_dic_["タイプ"].tab_panel.Select(buttonData.tab_button_obj);
  222. }
  223. if (!buttonData2.tab_button_obj.isSelected)
  224. {
  225. this.update_obj_dic_["カテゴリー"].tab_panel.Select(buttonData2.tab_button_obj);
  226. }
  227. this.user_request_stage = stage_data;
  228. if (!buttonData3.tab_button_obj.isSelected)
  229. {
  230. this.update_obj_dic_["スキル"].tab_panel.Select(buttonData3.tab_button_obj);
  231. }
  232. }
  233. public void FixSkill()
  234. {
  235. if (this.yotogi_mgr_ == null || this.yotogi_mgr_.maid == null)
  236. {
  237. return;
  238. }
  239. YotogiStageSelectManager.SelectStage(this.select_stage, this.is_day_time_);
  240. KeyValuePair<Skill.Data, bool>[] playSkillArray = new KeyValuePair<Skill.Data, bool>[]
  241. {
  242. new KeyValuePair<Skill.Data, bool>(this.select_skill, false)
  243. };
  244. this.yotogi_mgr_.SetPlaySkillArray(playSkillArray);
  245. }
  246. private void CreateCategory(FreeSkillSelect.ButtonData type_button_data)
  247. {
  248. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["カテゴリー"];
  249. updateObject.MoveStorageRoom(true);
  250. updateObject.Clear();
  251. GameObject button_parent = updateObject.button_parent;
  252. bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay;
  253. int i = 0;
  254. while (i < type_button_data.children_list.Count)
  255. {
  256. FreeSkillSelect.ButtonData buttonData = type_button_data.children_list[i];
  257. if (!lockNTRPlay)
  258. {
  259. goto IL_87;
  260. }
  261. Yotogi.Category category = (Yotogi.Category)Enum.Parse(typeof(Yotogi.Category), buttonData.name);
  262. if (category != Yotogi.Category.交換 && category != Yotogi.Category.乱交)
  263. {
  264. goto IL_87;
  265. }
  266. IL_EE:
  267. i++;
  268. continue;
  269. IL_87:
  270. bool flag = buttonData.children_list != null && 0 < buttonData.children_list.Count;
  271. EventDelegate eventDelegate = null;
  272. if (flag)
  273. {
  274. eventDelegate = new EventDelegate(this, "OnClickCategoryBtnEvent");
  275. eventDelegate.parameters[0].value = buttonData;
  276. }
  277. buttonData.tab_button_obj = this.CreateTypeAndCategoryButton(updateObject, buttonData.name, buttonData.nameTerm, flag, eventDelegate);
  278. goto IL_EE;
  279. }
  280. updateObject.Update();
  281. List<Transform> childList = updateObject.ui_grid.GetChildList();
  282. for (int j = 0; j < childList.Count; j++)
  283. {
  284. UIWFTabButton componentInChildren = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  285. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  286. {
  287. updateObject.tab_panel.Select(componentInChildren);
  288. break;
  289. }
  290. }
  291. }
  292. private void CreateSkill(FreeSkillSelect.ButtonData skill_button_data)
  293. {
  294. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["スキル"];
  295. updateObject.MoveStorageRoom(true);
  296. updateObject.Clear();
  297. GameObject button_parent = updateObject.button_parent;
  298. for (int i = 0; i < skill_button_data.children_list.Count; i++)
  299. {
  300. FreeSkillSelect.ButtonData buttonData = skill_button_data.children_list[i];
  301. if (buttonData.skill_data != null)
  302. {
  303. EventDelegate eventDelegate = new EventDelegate(this, "OnClickSkillBtnEvent");
  304. eventDelegate.parameters[0].value = buttonData;
  305. buttonData.tab_button_obj = this.CreateSkillButton(buttonData.skill_data, eventDelegate);
  306. }
  307. }
  308. updateObject.Update();
  309. List<Transform> childList = updateObject.ui_grid.GetChildList();
  310. for (int j = 0; j < childList.Count; j++)
  311. {
  312. UIWFTabButton componentInChildren = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  313. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  314. {
  315. updateObject.tab_panel.Select(componentInChildren);
  316. break;
  317. }
  318. }
  319. }
  320. private void CreateStage(Skill.Data skill_data)
  321. {
  322. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["ステージ"];
  323. YotogiStage.Data data = this.user_request_stage;
  324. UIWFTabButton uiwftabButton = null;
  325. updateObject.tab_panel.ResetSelect();
  326. List<Transform> childList = updateObject.ui_grid.GetChildList();
  327. for (int i = 0; i < childList.Count; i++)
  328. {
  329. YotogiStageUnit component = childList[i].gameObject.GetComponent<YotogiStageUnit>();
  330. UIWFTabButton componentInChildren = childList[i].gameObject.GetComponentInChildren<UIWFTabButton>();
  331. if (componentInChildren.isSelected)
  332. {
  333. componentInChildren.SetSelect(false);
  334. }
  335. if (componentInChildren.isEnabled != skill_data.IsExecStage(component.stage_data))
  336. {
  337. componentInChildren.isEnabled = skill_data.IsExecStage(component.stage_data);
  338. if (componentInChildren.isEnabled)
  339. {
  340. component.thumbnail_sprite.color = new Color(1f, 1f, 1f, 1f);
  341. }
  342. else
  343. {
  344. component.thumbnail_sprite.color = new Color(0.6f, 0.6f, 0.6f, 1f);
  345. }
  346. }
  347. if (data == component.stage_data && componentInChildren.isEnabled)
  348. {
  349. uiwftabButton = componentInChildren;
  350. }
  351. }
  352. if (uiwftabButton != null)
  353. {
  354. updateObject.tab_panel.Select(uiwftabButton);
  355. }
  356. else
  357. {
  358. for (int j = 0; j < childList.Count; j++)
  359. {
  360. UIWFTabButton componentInChildren2 = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  361. if (!(componentInChildren2 == null) && componentInChildren2.isEnabled)
  362. {
  363. updateObject.tab_panel.Select(componentInChildren2);
  364. break;
  365. }
  366. }
  367. this.user_request_stage = data;
  368. }
  369. }
  370. private UIWFTabButton CreateSkillButton(Skill.Data skill_data, EventDelegate onclick_event)
  371. {
  372. if (skill_data == null)
  373. {
  374. return null;
  375. }
  376. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["スキル"];
  377. GameObject gameObject = updateObject.MoveButtonParent();
  378. if (gameObject == null)
  379. {
  380. gameObject = Utility.CreatePrefab(updateObject.button_parent, "SceneYotogi/FreeMode/FreeSkillButton", true);
  381. }
  382. UILabel component = UTY.GetChildObject(gameObject, "title", false).GetComponent<UILabel>();
  383. Localize component2 = component.GetComponent<Localize>();
  384. component.text = skill_data.name;
  385. gameObject.name = skill_data.name;
  386. if (component2 != null)
  387. {
  388. component2.SetTerm(skill_data.termName);
  389. }
  390. bool flag = true;
  391. if (1 < skill_data.user_player_num)
  392. {
  393. int num = 1;
  394. while (num < skill_data.user_player_num && flag)
  395. {
  396. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num);
  397. if (maid != null)
  398. {
  399. bool flag2 = !PersonalEventBlocker.IsEnabledYotodiSkill(maid.status.personal, skill_data.id);
  400. if (skill_data.recollectionHaremLockPersonalIds.Contains(maid.status.personal.id) || flag2)
  401. {
  402. flag = false;
  403. }
  404. }
  405. num++;
  406. }
  407. }
  408. UIWFTabButton component3 = UTY.GetChildObject(gameObject, "BG", false).GetComponent<UIWFTabButton>();
  409. component3.isEnabled = flag;
  410. if (onclick_event != null)
  411. {
  412. component3.onClick.Add(onclick_event);
  413. }
  414. return component3;
  415. }
  416. private UIWFTabButton CreateTypeAndCategoryButton(FreeSkillSelect.UpdateObject update_obj, string name, string nameTerm, bool enabled, EventDelegate onclick_event)
  417. {
  418. GameObject gameObject = update_obj.MoveButtonParent();
  419. if (gameObject == null)
  420. {
  421. gameObject = Utility.CreatePrefab(update_obj.button_parent, "SceneYotogi/SkillSelect/Prefab/CategoryBtn", true);
  422. }
  423. UILabel component = UTY.GetChildObject(gameObject, "Label", false).GetComponent<UILabel>();
  424. Localize component2 = component.GetComponent<Localize>();
  425. component.text = name;
  426. if (component2 != null && !string.IsNullOrEmpty(nameTerm))
  427. {
  428. component2.SetTerm(nameTerm);
  429. }
  430. UIWFTabButton component3 = UTY.GetChildObject(gameObject, "Button", false).GetComponent<UIWFTabButton>();
  431. gameObject.name = name;
  432. component3.isEnabled = enabled;
  433. if (enabled && onclick_event != null)
  434. {
  435. component3.onClick.Add(onclick_event);
  436. }
  437. return component3;
  438. }
  439. private void OnClickTypeBtnEvent(FreeSkillSelect.ButtonData type_btn_data)
  440. {
  441. this.update_obj_dic_["タイプ"].UpdateArrow(type_btn_data.tab_button_obj.gameObject);
  442. this.CreateCategory(type_btn_data);
  443. }
  444. private void OnClickCategoryBtnEvent(FreeSkillSelect.ButtonData categorybtn_data)
  445. {
  446. this.update_obj_dic_["カテゴリー"].UpdateArrow(categorybtn_data.tab_button_obj.gameObject);
  447. this.CreateSkill(categorybtn_data);
  448. }
  449. private void OnClickSkillBtnEvent(FreeSkillSelect.ButtonData skill_data)
  450. {
  451. this.update_obj_dic_["スキル"].UpdateArrow(skill_data.tab_button_obj.gameObject);
  452. this.select_skill_ = skill_data.skill_data;
  453. this.CreateStage(skill_data.skill_data);
  454. FreeSkillSelect.ButtonData buttonData = (skill_data.parent == null) ? null : ((skill_data.parent.parent == null) ? null : skill_data.parent.parent);
  455. string item = (buttonData == null) ? FreeSkillSelect.RootType.Null.ToString() : buttonData.root_type;
  456. HashSet<string> hashSet = new HashSet<string>();
  457. foreach (FreeSkillSelect.RootType rootType in new FreeSkillSelect.RootType[]
  458. {
  459. FreeSkillSelect.RootType.Null,
  460. FreeSkillSelect.RootType.Drunk,
  461. FreeSkillSelect.RootType.Mask,
  462. FreeSkillSelect.RootType.Drug,
  463. FreeSkillSelect.RootType.Faint,
  464. FreeSkillSelect.RootType.Confess
  465. })
  466. {
  467. hashSet.Add(rootType.ToString());
  468. }
  469. if (!hashSet.Contains(item))
  470. {
  471. List<Transform> childList = this.update_obj_dic_["レベル"].ui_grid.GetChildList();
  472. bool flag = true;
  473. for (int j = childList.Count - 1; j >= 0; j--)
  474. {
  475. UIWFTabButton componentInChildren = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  476. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  477. {
  478. if (flag)
  479. {
  480. this.update_obj_dic_["レベル"].tab_panel.Select(componentInChildren);
  481. }
  482. else
  483. {
  484. componentInChildren.isEnabled = false;
  485. }
  486. flag = false;
  487. }
  488. }
  489. }
  490. else
  491. {
  492. List<Transform> childList2 = this.update_obj_dic_["レベル"].ui_grid.GetChildList();
  493. for (int k = 0; k < childList2.Count; k++)
  494. {
  495. UIWFTabButton componentInChildren2 = childList2[k].gameObject.GetComponentInChildren<UIWFTabButton>();
  496. if (!(componentInChildren2 == null))
  497. {
  498. componentInChildren2.isEnabled = true;
  499. }
  500. }
  501. }
  502. }
  503. private void OnClickLevelBtnEvent()
  504. {
  505. this.update_obj_dic_["レベル"].UpdateArrow(UIButton.current.gameObject);
  506. this.yotogi_mgr_.fix_skill_level = int.Parse(UIButton.current.gameObject.name);
  507. }
  508. private void OnClickStageEvent(YotogiStageUnit stage_unit)
  509. {
  510. this.select_stage_ = (this.user_request_stage = stage_unit.stage_data);
  511. this.is_day_time_ = stage_unit.is_daytime;
  512. this.FixSkill();
  513. }
  514. private static List<FreeSkillSelect.ButtonData> CreateButtonData(Maid maid, HashSet<int> selectableStageIds)
  515. {
  516. List<FreeSkillSelect.ButtonData> top_btn_data_list = new List<FreeSkillSelect.ButtonData>();
  517. Dictionary<string, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>> type_data_dic = new Dictionary<string, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>>();
  518. List<KeyValuePair<string, string>> baseCategoryDefine = new List<KeyValuePair<string, string>>();
  519. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Null.ToString(), "通常"));
  520. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Drunk.ToString(), "酔い"));
  521. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Mask.ToString(), "目隠し"));
  522. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Drug.ToString(), "媚薬"));
  523. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Confess.ToString(), "告白"));
  524. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.Faint.ToString(), "気絶"));
  525. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP01Harem.ToString(), "GP-01ハーレム"));
  526. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP01Swapping.ToString(), "GP-01スワッピング"));
  527. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP01NTR.ToString(), "GP-01寝取らせ"));
  528. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP01NTRReport.ToString(), "GP-01寝取らせ報告"));
  529. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP02Harem.ToString(), "GP-02ハーレム"));
  530. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP02Swapping.ToString(), "GP-02スワッピング"));
  531. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP02NTR.ToString(), "GP-02寝取らせ"));
  532. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP02NTRReport.ToString(), "GP-02寝取らせ報告"));
  533. baseCategoryDefine.Add(new KeyValuePair<string, string>(FreeSkillSelect.RootType.GP02Yuri.ToString(), "GP-02百合"));
  534. Func<string, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>> func = delegate(string typeName)
  535. {
  536. KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>> result;
  537. if (type_data_dic.TryGetValue(typeName, out result))
  538. {
  539. return result;
  540. }
  541. FreeSkillSelect.ButtonData buttonData4 = new FreeSkillSelect.ButtonData();
  542. buttonData4.children_list = new List<FreeSkillSelect.ButtonData>();
  543. foreach (KeyValuePair<string, string> keyValuePair3 in baseCategoryDefine)
  544. {
  545. if (!(keyValuePair3.Key != typeName))
  546. {
  547. buttonData4.name = keyValuePair3.Value;
  548. break;
  549. }
  550. }
  551. if (string.IsNullOrEmpty(buttonData4.name))
  552. {
  553. buttonData4.name = typeName;
  554. }
  555. buttonData4.nameTerm = "SceneYotogi/スキル所属/" + buttonData4.name;
  556. buttonData4.root_type = typeName;
  557. top_btn_data_list.Add(buttonData4);
  558. type_data_dic.Add(buttonData4.root_type, new KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>(buttonData4, new Dictionary<string, FreeSkillSelect.ButtonData>()));
  559. FreeSkillSelect.ButtonData buttonData5 = top_btn_data_list[top_btn_data_list.Count - 1];
  560. for (int l = 0; l < 8; l++)
  561. {
  562. FreeSkillSelect.ButtonData buttonData6 = new FreeSkillSelect.ButtonData();
  563. buttonData6.children_list = new List<FreeSkillSelect.ButtonData>();
  564. FreeSkillSelect.ButtonData buttonData7 = buttonData6;
  565. Yotogi.Category category2 = (Yotogi.Category)l;
  566. buttonData7.name = category2.ToString();
  567. buttonData6.nameTerm = "SceneYotogi/スキルカテゴリー/" + buttonData6.name;
  568. buttonData6.parent = buttonData5;
  569. buttonData5.children_list.Add(buttonData6);
  570. type_data_dic[buttonData5.root_type].Value.Add(buttonData6.name, buttonData6);
  571. }
  572. return type_data_dic[buttonData4.root_type];
  573. };
  574. for (int i = 0; i < baseCategoryDefine.Count; i++)
  575. {
  576. func(baseCategoryDefine[i].Key);
  577. }
  578. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  579. int[] keyArray = maid.status.yotogiSkill.datas.GetKeyArray();
  580. Dictionary<int, List<Skill.Data>> dictionary = new Dictionary<int, List<Skill.Data>>();
  581. for (int j = 0; j < keyArray.Length; j++)
  582. {
  583. Skill.Data data = Skill.Get(keyArray[j]);
  584. if (data.specialConditionType != Skill.Data.SpecialConditionType.NewType)
  585. {
  586. if (PersonalEventBlocker.IsEnabledYotodiSkill(maid.status.personal, data.id))
  587. {
  588. if (data.IsExecPersonal(maid.status.personal))
  589. {
  590. bool flag = false;
  591. foreach (int item in data.playable_stageid_list)
  592. {
  593. flag = selectableStageIds.Contains(item);
  594. if (flag)
  595. {
  596. break;
  597. }
  598. }
  599. if (flag)
  600. {
  601. int category = (int)data.category;
  602. if (!dictionary.ContainsKey(category))
  603. {
  604. dictionary.Add(category, new List<Skill.Data>());
  605. }
  606. dictionary[category].Add(data);
  607. }
  608. }
  609. }
  610. }
  611. }
  612. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair in dictionary)
  613. {
  614. List<Skill.Data> value = keyValuePair.Value;
  615. value.Sort((Skill.Data a, Skill.Data b) => a.sortId - b.sortId);
  616. }
  617. List<Skill.Data> list = new List<Skill.Data>();
  618. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair2 in dictionary)
  619. {
  620. List<Skill.Data> value2 = keyValuePair2.Value;
  621. foreach (Skill.Data item2 in value2)
  622. {
  623. list.Add(item2);
  624. }
  625. }
  626. foreach (Skill.Data data2 in list)
  627. {
  628. int user_player_num = data2.user_player_num;
  629. if (1 < user_player_num)
  630. {
  631. int num = 0;
  632. for (int k = 0; k < characterMgr.GetMaidCount(); k++)
  633. {
  634. if (!(characterMgr.GetMaid(k) != null))
  635. {
  636. break;
  637. }
  638. num++;
  639. }
  640. if (num < user_player_num)
  641. {
  642. continue;
  643. }
  644. }
  645. if (data2.IsExecMaid(maid.status))
  646. {
  647. string arg = FreeSkillSelect.RootType.Null.ToString();
  648. if (Skill.Data.SpecialConditionType.Null <= data2.specialConditionType && data2.specialConditionType <= Skill.Data.SpecialConditionType.Confess)
  649. {
  650. arg = ((FreeSkillSelect.RootType)data2.specialConditionType).ToString();
  651. }
  652. else if (data2.specialConditionType == Skill.Data.SpecialConditionType.GP01Recollect)
  653. {
  654. FreeSkillSelect.RootType rootType;
  655. if (data2.category == Yotogi.Category.ハ\u30FCレム)
  656. {
  657. rootType = FreeSkillSelect.RootType.GP01Harem;
  658. }
  659. else
  660. {
  661. rootType = FreeSkillSelect.RootType.GP01Swapping;
  662. if (data2.name.Contains("報告"))
  663. {
  664. rootType = FreeSkillSelect.RootType.GP01NTRReport;
  665. }
  666. else if (data2.name.Contains("寝取り"))
  667. {
  668. rootType = FreeSkillSelect.RootType.GP01NTR;
  669. }
  670. }
  671. arg = rootType.ToString();
  672. }
  673. else if (data2.specialConditionType == Skill.Data.SpecialConditionType.GP02Recollect)
  674. {
  675. FreeSkillSelect.RootType rootType2;
  676. if (data2.category == Yotogi.Category.ハ\u30FCレム)
  677. {
  678. if (data2.name.Contains("百合"))
  679. {
  680. rootType2 = FreeSkillSelect.RootType.GP02Yuri;
  681. }
  682. else
  683. {
  684. rootType2 = FreeSkillSelect.RootType.GP02Harem;
  685. }
  686. }
  687. else
  688. {
  689. rootType2 = FreeSkillSelect.RootType.GP02Swapping;
  690. if (data2.name.Contains("報告"))
  691. {
  692. rootType2 = FreeSkillSelect.RootType.GP02NTRReport;
  693. }
  694. else if (data2.name.Contains("寝取り"))
  695. {
  696. rootType2 = FreeSkillSelect.RootType.GP02NTR;
  697. }
  698. }
  699. arg = rootType2.ToString();
  700. }
  701. else
  702. {
  703. if (data2.specialConditionType != Skill.Data.SpecialConditionType.OnlyRecollect)
  704. {
  705. continue;
  706. }
  707. arg = (string.IsNullOrEmpty(data2.customRecollectionCategoryName) ? "-" : data2.customRecollectionCategoryName);
  708. }
  709. FreeSkillSelect.ButtonData buttonData = func(arg).Value[data2.category.ToString()];
  710. if (buttonData != null)
  711. {
  712. FreeSkillSelect.ButtonData buttonData2 = new FreeSkillSelect.ButtonData();
  713. buttonData2.parent = buttonData;
  714. buttonData2.name = data2.name;
  715. buttonData2.skill_data = data2;
  716. buttonData.children_list.Add(buttonData2);
  717. }
  718. }
  719. }
  720. Action<string> action = delegate(string type)
  721. {
  722. Dictionary<string, FreeSkillSelect.ButtonData> value3 = type_data_dic[type].Value;
  723. HashSet<string> hashSet = new HashSet<string>();
  724. List<FreeSkillSelect.ButtonData> list2 = new List<FreeSkillSelect.ButtonData>();
  725. foreach (KeyValuePair<string, FreeSkillSelect.ButtonData> keyValuePair3 in value3)
  726. {
  727. if (keyValuePair3.Value.children_list != null && 1 <= keyValuePair3.Value.children_list.Count && !hashSet.Contains(keyValuePair3.Key))
  728. {
  729. hashSet.Add(keyValuePair3.Key);
  730. list2.Add(keyValuePair3.Value);
  731. }
  732. }
  733. type_data_dic[type].Key.children_list = list2;
  734. };
  735. foreach (FreeSkillSelect.ButtonData buttonData3 in top_btn_data_list)
  736. {
  737. if (buttonData3.root_type != FreeSkillSelect.RootType.Null.ToString())
  738. {
  739. action(buttonData3.root_type);
  740. }
  741. }
  742. return top_btn_data_list;
  743. }
  744. private static FreeSkillSelect.ButtonData GetButtonData(List<FreeSkillSelect.ButtonData> check_list, string name)
  745. {
  746. FreeSkillSelect.ButtonData result = null;
  747. if (check_list == null || string.IsNullOrEmpty(name))
  748. {
  749. return result;
  750. }
  751. for (int i = 0; i < check_list.Count; i++)
  752. {
  753. if (check_list[i] != null)
  754. {
  755. if (!string.IsNullOrEmpty(check_list[i].name) && check_list[i].name == name)
  756. {
  757. result = check_list[i];
  758. break;
  759. }
  760. }
  761. }
  762. return result;
  763. }
  764. public YotogiStage.Data select_stage
  765. {
  766. get
  767. {
  768. return this.select_stage_;
  769. }
  770. }
  771. public Skill.Data select_skill
  772. {
  773. get
  774. {
  775. return this.select_skill_;
  776. }
  777. }
  778. private Maid maid_;
  779. private List<FreeSkillSelect.ButtonData> button_data_list_;
  780. private Dictionary<string, FreeSkillSelect.UpdateObject> update_obj_dic_;
  781. private YotogiManager yotogi_mgr_;
  782. private Skill.Data select_skill_;
  783. private YotogiStage.Data select_stage_;
  784. private bool is_day_time_ = true;
  785. private YotogiStage.Data user_request_stage;
  786. private enum RootType
  787. {
  788. Null,
  789. Drunk,
  790. Mask,
  791. Drug,
  792. Faint,
  793. Confess,
  794. GP01Harem,
  795. GP01Swapping,
  796. GP01NTR,
  797. GP01NTRReport,
  798. GP02Harem,
  799. GP02Swapping,
  800. GP02NTR,
  801. GP02NTRReport,
  802. GP02Yuri
  803. }
  804. private class ButtonData
  805. {
  806. public UIWFTabButton tab_button_obj;
  807. public FreeSkillSelect.ButtonData parent;
  808. public List<FreeSkillSelect.ButtonData> children_list;
  809. public string name;
  810. public string nameTerm;
  811. public Skill.Data skill_data;
  812. public string root_type;
  813. }
  814. private class UpdateObject
  815. {
  816. public void Update()
  817. {
  818. this.ui_grid.Reposition();
  819. this.tab_panel.UpdateChildren();
  820. this.scroll_view.ResetPosition();
  821. this.ui_panel.UpdateAnchors();
  822. }
  823. public void MoveStorageRoom(bool click_event_clear)
  824. {
  825. if (this.storage_obj == null)
  826. {
  827. return;
  828. }
  829. Transform transform = this.button_parent.transform;
  830. Transform transform2 = this.storage_obj.transform;
  831. while (0 < transform.childCount)
  832. {
  833. GameObject gameObject = transform.GetChild(0).gameObject;
  834. UIWFTabButton componentInChildren = gameObject.GetComponentInChildren<UIWFTabButton>();
  835. if (componentInChildren != null)
  836. {
  837. componentInChildren.SetSelect(false);
  838. if (click_event_clear)
  839. {
  840. componentInChildren.onClick.Clear();
  841. }
  842. }
  843. gameObject.transform.SetParent(transform2, false);
  844. gameObject.transform.localPosition = Vector3.zero;
  845. }
  846. transform.DetachChildren();
  847. }
  848. public GameObject MoveButtonParent()
  849. {
  850. if (this.storage_obj == null)
  851. {
  852. return null;
  853. }
  854. GameObject gameObject = null;
  855. Transform transform = this.button_parent.transform;
  856. Transform transform2 = this.storage_obj.transform;
  857. if (0 < transform2.childCount)
  858. {
  859. gameObject = transform2.GetChild(0).gameObject;
  860. gameObject.transform.SetParent(transform, false);
  861. }
  862. return gameObject;
  863. }
  864. public GameObject MoveButtonParent(string object_name)
  865. {
  866. if (this.storage_obj == null || string.IsNullOrEmpty(object_name))
  867. {
  868. return null;
  869. }
  870. GameObject gameObject = null;
  871. Transform transform = this.button_parent.transform;
  872. Transform transform2 = this.storage_obj.transform;
  873. for (int i = 0; i < transform2.childCount; i++)
  874. {
  875. if (transform2.GetChild(i).name == object_name)
  876. {
  877. gameObject = transform2.GetChild(i).gameObject;
  878. gameObject.transform.SetParent(transform, false);
  879. break;
  880. }
  881. }
  882. return gameObject;
  883. }
  884. public void UpdateArrow(GameObject target_obj)
  885. {
  886. if (this.arrow_obj == null || target_obj == null)
  887. {
  888. return;
  889. }
  890. Vector3 position = target_obj.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  891. Vector3 local_pos = this.arrow_obj.transform.parent.InverseTransformPoint(position);
  892. local_pos.x = this.arrow_obj.transform.localPosition.x;
  893. local_pos.y += 18f;
  894. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  895. iTween.MoveTo(this.arrow_obj, args);
  896. }
  897. public void Clear()
  898. {
  899. Transform transform = this.button_parent.transform;
  900. for (int i = 0; i < transform.childCount; i++)
  901. {
  902. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  903. }
  904. transform.DetachChildren();
  905. }
  906. public GameObject button_parent;
  907. public UIGrid ui_grid;
  908. public UIWFTabPanel tab_panel;
  909. public UIScrollView scroll_view;
  910. public UIPanel ui_panel;
  911. public GameObject arrow_obj;
  912. public GameObject storage_obj;
  913. }
  914. }