FreeSkillSelect.cs 29 KB

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