FreeSkillSelect.cs 27 KB

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