FreeSkillSelect.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  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. FreeSkillSelect.RootType rootType = (buttonData == null) ? FreeSkillSelect.RootType.Null : buttonData.root_type;
  456. if (FreeSkillSelect.RootType.GP01Harem <= rootType && rootType <= FreeSkillSelect.RootType.GP02Yuri)
  457. {
  458. List<Transform> childList = this.update_obj_dic_["レベル"].ui_grid.GetChildList();
  459. bool flag = true;
  460. for (int i = childList.Count - 1; i >= 0; i--)
  461. {
  462. UIWFTabButton componentInChildren = childList[i].gameObject.GetComponentInChildren<UIWFTabButton>();
  463. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  464. {
  465. if (flag)
  466. {
  467. this.update_obj_dic_["レベル"].tab_panel.Select(componentInChildren);
  468. }
  469. else
  470. {
  471. componentInChildren.isEnabled = false;
  472. }
  473. flag = false;
  474. }
  475. }
  476. }
  477. else
  478. {
  479. List<Transform> childList2 = this.update_obj_dic_["レベル"].ui_grid.GetChildList();
  480. for (int j = 0; j < childList2.Count; j++)
  481. {
  482. UIWFTabButton componentInChildren2 = childList2[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  483. if (!(componentInChildren2 == null))
  484. {
  485. componentInChildren2.isEnabled = true;
  486. }
  487. }
  488. }
  489. }
  490. private void OnClickLevelBtnEvent()
  491. {
  492. this.update_obj_dic_["レベル"].UpdateArrow(UIButton.current.gameObject);
  493. this.yotogi_mgr_.fix_skill_level = int.Parse(UIButton.current.gameObject.name);
  494. }
  495. private void OnClickStageEvent(YotogiStageUnit stage_unit)
  496. {
  497. this.select_stage_ = (this.user_request_stage = stage_unit.stage_data);
  498. this.is_day_time_ = stage_unit.is_daytime;
  499. this.FixSkill();
  500. }
  501. private static List<FreeSkillSelect.ButtonData> CreateButtonData(Maid maid, HashSet<int> selectableStageIds)
  502. {
  503. List<FreeSkillSelect.ButtonData> list = new List<FreeSkillSelect.ButtonData>();
  504. Dictionary<FreeSkillSelect.RootType, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>> type_data_dic = new Dictionary<FreeSkillSelect.RootType, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>>();
  505. List<KeyValuePair<FreeSkillSelect.RootType, string>> list2 = new List<KeyValuePair<FreeSkillSelect.RootType, string>>();
  506. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Null, "通常"));
  507. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Drunk, "酔い"));
  508. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Mask, "目隠し"));
  509. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Drug, "媚薬"));
  510. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Confess, "告白"));
  511. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.Faint, "気絶"));
  512. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP01Harem, "GP-01ハーレム"));
  513. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP01Swapping, "GP-01スワッピング"));
  514. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP01NTR, "GP-01寝取らせ"));
  515. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP01NTRReport, "GP-01寝取らせ報告"));
  516. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP02Harem, "GP-02ハーレム"));
  517. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP02Swapping, "GP-02スワッピング"));
  518. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP02NTR, "GP-02寝取らせ"));
  519. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP02NTRReport, "GP-02寝取らせ報告"));
  520. list2.Add(new KeyValuePair<FreeSkillSelect.RootType, string>(FreeSkillSelect.RootType.GP02Yuri, "GP-02百合"));
  521. for (int i = 0; i < list2.Count; i++)
  522. {
  523. FreeSkillSelect.ButtonData buttonData = new FreeSkillSelect.ButtonData();
  524. buttonData.children_list = new List<FreeSkillSelect.ButtonData>();
  525. buttonData.name = list2[i].Value;
  526. buttonData.nameTerm = "SceneYotogi/スキル所属/" + buttonData.name;
  527. buttonData.root_type = list2[i].Key;
  528. list.Add(buttonData);
  529. type_data_dic.Add(buttonData.root_type, new KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>(buttonData, new Dictionary<string, FreeSkillSelect.ButtonData>()));
  530. }
  531. for (int j = 0; j < list.Count; j++)
  532. {
  533. for (int k = 0; k < 8; k++)
  534. {
  535. FreeSkillSelect.ButtonData buttonData2 = list[j];
  536. FreeSkillSelect.ButtonData buttonData3 = new FreeSkillSelect.ButtonData();
  537. buttonData3.children_list = new List<FreeSkillSelect.ButtonData>();
  538. FreeSkillSelect.ButtonData buttonData4 = buttonData3;
  539. Yotogi.Category category = (Yotogi.Category)k;
  540. buttonData4.name = category.ToString();
  541. buttonData3.nameTerm = "SceneYotogi/スキルカテゴリー/" + buttonData3.name;
  542. buttonData3.parent = buttonData2;
  543. buttonData2.children_list.Add(buttonData3);
  544. type_data_dic[list[j].root_type].Value.Add(buttonData3.name, buttonData3);
  545. }
  546. }
  547. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  548. int[] keyArray = maid.status.yotogiSkill.datas.GetKeyArray();
  549. Dictionary<int, List<Skill.Data>> dictionary = new Dictionary<int, List<Skill.Data>>();
  550. for (int l = 0; l < keyArray.Length; l++)
  551. {
  552. Skill.Data data = Skill.Get(keyArray[l]);
  553. if (data.specialConditionType != Skill.Data.SpecialConditionType.NewType)
  554. {
  555. if (PersonalEventBlocker.IsEnabledYotodiSkill(maid.status.personal, data.id))
  556. {
  557. if (data.IsExecPersonal(maid.status.personal))
  558. {
  559. bool flag = false;
  560. foreach (int item in data.playable_stageid_list)
  561. {
  562. flag = selectableStageIds.Contains(item);
  563. if (flag)
  564. {
  565. break;
  566. }
  567. }
  568. if (flag)
  569. {
  570. int category2 = (int)data.category;
  571. if (!dictionary.ContainsKey(category2))
  572. {
  573. dictionary.Add(category2, new List<Skill.Data>());
  574. }
  575. dictionary[category2].Add(data);
  576. }
  577. }
  578. }
  579. }
  580. }
  581. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair in dictionary)
  582. {
  583. List<Skill.Data> value = keyValuePair.Value;
  584. value.Sort((Skill.Data a, Skill.Data b) => a.sortId - b.sortId);
  585. }
  586. List<Skill.Data> list3 = new List<Skill.Data>();
  587. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair2 in dictionary)
  588. {
  589. List<Skill.Data> value2 = keyValuePair2.Value;
  590. foreach (Skill.Data item2 in value2)
  591. {
  592. list3.Add(item2);
  593. }
  594. }
  595. foreach (Skill.Data data2 in list3)
  596. {
  597. int user_player_num = data2.user_player_num;
  598. if (1 < user_player_num)
  599. {
  600. int num = 0;
  601. for (int m = 0; m < characterMgr.GetMaidCount(); m++)
  602. {
  603. if (!(characterMgr.GetMaid(m) != null))
  604. {
  605. break;
  606. }
  607. num++;
  608. }
  609. if (num < user_player_num)
  610. {
  611. continue;
  612. }
  613. }
  614. if (data2.IsExecMaid(maid.status))
  615. {
  616. FreeSkillSelect.RootType key;
  617. if (Skill.Data.SpecialConditionType.Null <= data2.specialConditionType && data2.specialConditionType <= Skill.Data.SpecialConditionType.Confess)
  618. {
  619. key = (FreeSkillSelect.RootType)data2.specialConditionType;
  620. }
  621. else if (data2.specialConditionType == Skill.Data.SpecialConditionType.GP01Recollect)
  622. {
  623. if (data2.category == Yotogi.Category.ハ\u30FCレム)
  624. {
  625. key = FreeSkillSelect.RootType.GP01Harem;
  626. }
  627. else
  628. {
  629. key = FreeSkillSelect.RootType.GP01Swapping;
  630. if (data2.name.Contains("報告"))
  631. {
  632. key = FreeSkillSelect.RootType.GP01NTRReport;
  633. }
  634. else if (data2.name.Contains("寝取り"))
  635. {
  636. key = FreeSkillSelect.RootType.GP01NTR;
  637. }
  638. }
  639. }
  640. else
  641. {
  642. if (data2.specialConditionType != Skill.Data.SpecialConditionType.GP02Recollect)
  643. {
  644. continue;
  645. }
  646. if (data2.category == Yotogi.Category.ハ\u30FCレム)
  647. {
  648. if (data2.name.Contains("百合"))
  649. {
  650. key = FreeSkillSelect.RootType.GP02Yuri;
  651. }
  652. else
  653. {
  654. key = FreeSkillSelect.RootType.GP02Harem;
  655. }
  656. }
  657. else
  658. {
  659. key = FreeSkillSelect.RootType.GP02Swapping;
  660. if (data2.name.Contains("報告"))
  661. {
  662. key = FreeSkillSelect.RootType.GP02NTRReport;
  663. }
  664. else if (data2.name.Contains("寝取り"))
  665. {
  666. key = FreeSkillSelect.RootType.GP02NTR;
  667. }
  668. }
  669. }
  670. FreeSkillSelect.ButtonData buttonData5 = type_data_dic[key].Value[data2.category.ToString()];
  671. if (buttonData5 != null)
  672. {
  673. FreeSkillSelect.ButtonData buttonData6 = new FreeSkillSelect.ButtonData();
  674. buttonData6.parent = buttonData5;
  675. buttonData6.name = data2.name;
  676. buttonData6.skill_data = data2;
  677. buttonData5.children_list.Add(buttonData6);
  678. }
  679. }
  680. }
  681. Action<FreeSkillSelect.RootType> action = delegate(FreeSkillSelect.RootType type)
  682. {
  683. Dictionary<string, FreeSkillSelect.ButtonData> value3 = type_data_dic[type].Value;
  684. HashSet<string> hashSet = new HashSet<string>();
  685. List<FreeSkillSelect.ButtonData> list4 = new List<FreeSkillSelect.ButtonData>();
  686. foreach (KeyValuePair<string, FreeSkillSelect.ButtonData> keyValuePair3 in value3)
  687. {
  688. if (keyValuePair3.Value.children_list != null && 1 <= keyValuePair3.Value.children_list.Count && !hashSet.Contains(keyValuePair3.Key))
  689. {
  690. hashSet.Add(keyValuePair3.Key);
  691. list4.Add(keyValuePair3.Value);
  692. }
  693. }
  694. type_data_dic[type].Key.children_list = list4;
  695. };
  696. foreach (FreeSkillSelect.ButtonData buttonData7 in list)
  697. {
  698. if (buttonData7.root_type != FreeSkillSelect.RootType.Null)
  699. {
  700. action(buttonData7.root_type);
  701. }
  702. }
  703. return list;
  704. }
  705. private static FreeSkillSelect.ButtonData GetButtonData(List<FreeSkillSelect.ButtonData> check_list, string name)
  706. {
  707. FreeSkillSelect.ButtonData result = null;
  708. if (check_list == null || string.IsNullOrEmpty(name))
  709. {
  710. return result;
  711. }
  712. for (int i = 0; i < check_list.Count; i++)
  713. {
  714. if (check_list[i] != null)
  715. {
  716. if (!string.IsNullOrEmpty(check_list[i].name) && check_list[i].name == name)
  717. {
  718. result = check_list[i];
  719. break;
  720. }
  721. }
  722. }
  723. return result;
  724. }
  725. public YotogiStage.Data select_stage
  726. {
  727. get
  728. {
  729. return this.select_stage_;
  730. }
  731. }
  732. public Skill.Data select_skill
  733. {
  734. get
  735. {
  736. return this.select_skill_;
  737. }
  738. }
  739. private Maid maid_;
  740. private List<FreeSkillSelect.ButtonData> button_data_list_;
  741. private Dictionary<string, FreeSkillSelect.UpdateObject> update_obj_dic_;
  742. private YotogiManager yotogi_mgr_;
  743. private Skill.Data select_skill_;
  744. private YotogiStage.Data select_stage_;
  745. private bool is_day_time_ = true;
  746. private YotogiStage.Data user_request_stage;
  747. private enum RootType
  748. {
  749. Null,
  750. Drunk,
  751. Mask,
  752. Drug,
  753. Faint,
  754. Confess,
  755. GP01Harem,
  756. GP01Swapping,
  757. GP01NTR,
  758. GP01NTRReport,
  759. GP02Harem,
  760. GP02Swapping,
  761. GP02NTR,
  762. GP02NTRReport,
  763. GP02Yuri
  764. }
  765. private class ButtonData
  766. {
  767. public UIWFTabButton tab_button_obj;
  768. public FreeSkillSelect.ButtonData parent;
  769. public List<FreeSkillSelect.ButtonData> children_list;
  770. public string name;
  771. public string nameTerm;
  772. public Skill.Data skill_data;
  773. public FreeSkillSelect.RootType root_type;
  774. }
  775. private class UpdateObject
  776. {
  777. public void Update()
  778. {
  779. this.ui_grid.Reposition();
  780. this.tab_panel.UpdateChildren();
  781. this.scroll_view.ResetPosition();
  782. this.ui_panel.UpdateAnchors();
  783. }
  784. public void MoveStorageRoom(bool click_event_clear)
  785. {
  786. if (this.storage_obj == null)
  787. {
  788. return;
  789. }
  790. Transform transform = this.button_parent.transform;
  791. Transform transform2 = this.storage_obj.transform;
  792. while (0 < transform.childCount)
  793. {
  794. GameObject gameObject = transform.GetChild(0).gameObject;
  795. UIWFTabButton componentInChildren = gameObject.GetComponentInChildren<UIWFTabButton>();
  796. if (componentInChildren != null)
  797. {
  798. componentInChildren.SetSelect(false);
  799. if (click_event_clear)
  800. {
  801. componentInChildren.onClick.Clear();
  802. }
  803. }
  804. gameObject.transform.SetParent(transform2, false);
  805. gameObject.transform.localPosition = Vector3.zero;
  806. }
  807. transform.DetachChildren();
  808. }
  809. public GameObject MoveButtonParent()
  810. {
  811. if (this.storage_obj == null)
  812. {
  813. return null;
  814. }
  815. GameObject gameObject = null;
  816. Transform transform = this.button_parent.transform;
  817. Transform transform2 = this.storage_obj.transform;
  818. if (0 < transform2.childCount)
  819. {
  820. gameObject = transform2.GetChild(0).gameObject;
  821. gameObject.transform.SetParent(transform, false);
  822. }
  823. return gameObject;
  824. }
  825. public GameObject MoveButtonParent(string object_name)
  826. {
  827. if (this.storage_obj == null || string.IsNullOrEmpty(object_name))
  828. {
  829. return null;
  830. }
  831. GameObject gameObject = null;
  832. Transform transform = this.button_parent.transform;
  833. Transform transform2 = this.storage_obj.transform;
  834. for (int i = 0; i < transform2.childCount; i++)
  835. {
  836. if (transform2.GetChild(i).name == object_name)
  837. {
  838. gameObject = transform2.GetChild(i).gameObject;
  839. gameObject.transform.SetParent(transform, false);
  840. break;
  841. }
  842. }
  843. return gameObject;
  844. }
  845. public void UpdateArrow(GameObject target_obj)
  846. {
  847. if (this.arrow_obj == null || target_obj == null)
  848. {
  849. return;
  850. }
  851. Vector3 position = target_obj.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  852. Vector3 local_pos = this.arrow_obj.transform.parent.InverseTransformPoint(position);
  853. local_pos.x = this.arrow_obj.transform.localPosition.x;
  854. local_pos.y += 18f;
  855. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  856. iTween.MoveTo(this.arrow_obj, args);
  857. }
  858. public void Clear()
  859. {
  860. Transform transform = this.button_parent.transform;
  861. for (int i = 0; i < transform.childCount; i++)
  862. {
  863. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  864. }
  865. transform.DetachChildren();
  866. }
  867. public GameObject button_parent;
  868. public UIGrid ui_grid;
  869. public UIWFTabPanel tab_panel;
  870. public UIScrollView scroll_view;
  871. public UIPanel ui_panel;
  872. public GameObject arrow_obj;
  873. public GameObject storage_obj;
  874. }
  875. }