FreeSkillSelect.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  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. }
  135. }
  136. updateObject2.Update();
  137. childList = updateObject2.ui_grid.GetChildList();
  138. for (int m = 0; m < childList.Count; m++)
  139. {
  140. UIWFTabButton componentInChildren2 = childList[m].gameObject.GetComponentInChildren<UIWFTabButton>();
  141. if (!(componentInChildren2 == null) && componentInChildren2.isEnabled)
  142. {
  143. updateObject2.tab_panel.Select(componentInChildren2);
  144. break;
  145. }
  146. }
  147. }
  148. public void SelectSkill(Skill.Data skill, YotogiStage.Data stage_data)
  149. {
  150. if (skill == null)
  151. {
  152. return;
  153. }
  154. FreeSkillSelect.ButtonData buttonData = null;
  155. FreeSkillSelect.ButtonData buttonData2 = null;
  156. FreeSkillSelect.ButtonData buttonData3 = null;
  157. bool flag = true;
  158. int num = 0;
  159. while (num < this.button_data_list_.Count && flag)
  160. {
  161. buttonData = this.button_data_list_[num];
  162. int num2 = 0;
  163. while (num2 < buttonData.children_list.Count && flag)
  164. {
  165. buttonData2 = buttonData.children_list[num2];
  166. int num3 = 0;
  167. while (num3 < buttonData2.children_list.Count && flag)
  168. {
  169. buttonData3 = buttonData2.children_list[num3];
  170. if (buttonData3.skill_data == skill)
  171. {
  172. flag = false;
  173. }
  174. num3++;
  175. }
  176. num2++;
  177. }
  178. num++;
  179. }
  180. if (flag)
  181. {
  182. return;
  183. }
  184. if (!buttonData.tab_button_obj.isSelected)
  185. {
  186. this.update_obj_dic_["タイプ"].tab_panel.Select(buttonData.tab_button_obj);
  187. }
  188. if (!buttonData2.tab_button_obj.isSelected)
  189. {
  190. this.update_obj_dic_["カテゴリー"].tab_panel.Select(buttonData2.tab_button_obj);
  191. }
  192. this.user_request_stage = stage_data;
  193. if (!buttonData3.tab_button_obj.isSelected)
  194. {
  195. this.update_obj_dic_["スキル"].tab_panel.Select(buttonData3.tab_button_obj);
  196. }
  197. }
  198. public void FixSkill()
  199. {
  200. if (this.yotogi_mgr_ == null || this.yotogi_mgr_.maid == null)
  201. {
  202. return;
  203. }
  204. YotogiStageSelectManager.SelectStage(this.select_stage, this.is_day_time_);
  205. KeyValuePair<Skill.Data, bool>[] playSkillArray = new KeyValuePair<Skill.Data, bool>[]
  206. {
  207. new KeyValuePair<Skill.Data, bool>(this.select_skill, false)
  208. };
  209. this.yotogi_mgr_.SetPlaySkillArray(playSkillArray);
  210. }
  211. private void CreateCategory(FreeSkillSelect.ButtonData type_button_data)
  212. {
  213. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["カテゴリー"];
  214. updateObject.MoveStorageRoom(true);
  215. updateObject.Clear();
  216. GameObject button_parent = updateObject.button_parent;
  217. bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay;
  218. int i = 0;
  219. while (i < type_button_data.children_list.Count)
  220. {
  221. FreeSkillSelect.ButtonData buttonData = type_button_data.children_list[i];
  222. if (!lockNTRPlay)
  223. {
  224. goto IL_87;
  225. }
  226. Yotogi.Category category = (Yotogi.Category)Enum.Parse(typeof(Yotogi.Category), buttonData.name);
  227. if (category != Yotogi.Category.交換 && category != Yotogi.Category.乱交)
  228. {
  229. goto IL_87;
  230. }
  231. IL_EE:
  232. i++;
  233. continue;
  234. IL_87:
  235. bool flag = buttonData.children_list != null && 0 < buttonData.children_list.Count;
  236. EventDelegate eventDelegate = null;
  237. if (flag)
  238. {
  239. eventDelegate = new EventDelegate(this, "OnClickCategoryBtnEvent");
  240. eventDelegate.parameters[0].value = buttonData;
  241. }
  242. buttonData.tab_button_obj = this.CreateTypeAndCategoryButton(updateObject, buttonData.name, buttonData.nameTerm, flag, eventDelegate);
  243. goto IL_EE;
  244. }
  245. updateObject.Update();
  246. List<Transform> childList = updateObject.ui_grid.GetChildList();
  247. for (int j = 0; j < childList.Count; j++)
  248. {
  249. UIWFTabButton componentInChildren = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  250. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  251. {
  252. updateObject.tab_panel.Select(componentInChildren);
  253. break;
  254. }
  255. }
  256. }
  257. private void CreateSkill(FreeSkillSelect.ButtonData skill_button_data)
  258. {
  259. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["スキル"];
  260. updateObject.MoveStorageRoom(true);
  261. updateObject.Clear();
  262. GameObject button_parent = updateObject.button_parent;
  263. for (int i = 0; i < skill_button_data.children_list.Count; i++)
  264. {
  265. FreeSkillSelect.ButtonData buttonData = skill_button_data.children_list[i];
  266. if (buttonData.skill_data != null)
  267. {
  268. EventDelegate eventDelegate = new EventDelegate(this, "OnClickSkillBtnEvent");
  269. eventDelegate.parameters[0].value = buttonData;
  270. buttonData.tab_button_obj = this.CreateSkillButton(buttonData.skill_data, eventDelegate);
  271. }
  272. }
  273. updateObject.Update();
  274. List<Transform> childList = updateObject.ui_grid.GetChildList();
  275. for (int j = 0; j < childList.Count; j++)
  276. {
  277. UIWFTabButton componentInChildren = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  278. if (!(componentInChildren == null) && componentInChildren.isEnabled)
  279. {
  280. updateObject.tab_panel.Select(componentInChildren);
  281. break;
  282. }
  283. }
  284. }
  285. private void CreateStage(Skill.Data skill_data)
  286. {
  287. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["ステージ"];
  288. YotogiStage.Data data = this.user_request_stage;
  289. UIWFTabButton uiwftabButton = null;
  290. updateObject.tab_panel.ResetSelect();
  291. List<Transform> childList = updateObject.ui_grid.GetChildList();
  292. for (int i = 0; i < childList.Count; i++)
  293. {
  294. YotogiStageUnit component = childList[i].gameObject.GetComponent<YotogiStageUnit>();
  295. UIWFTabButton componentInChildren = childList[i].gameObject.GetComponentInChildren<UIWFTabButton>();
  296. if (componentInChildren.isSelected)
  297. {
  298. componentInChildren.SetSelect(false);
  299. }
  300. if (componentInChildren.isEnabled != skill_data.IsExecStage(component.stage_data))
  301. {
  302. componentInChildren.isEnabled = skill_data.IsExecStage(component.stage_data);
  303. if (componentInChildren.isEnabled)
  304. {
  305. component.thumbnail_sprite.color = new Color(1f, 1f, 1f, 1f);
  306. }
  307. else
  308. {
  309. component.thumbnail_sprite.color = new Color(0.6f, 0.6f, 0.6f, 1f);
  310. }
  311. }
  312. if (data == component.stage_data && componentInChildren.isEnabled)
  313. {
  314. uiwftabButton = componentInChildren;
  315. }
  316. }
  317. if (uiwftabButton != null)
  318. {
  319. updateObject.tab_panel.Select(uiwftabButton);
  320. }
  321. else
  322. {
  323. for (int j = 0; j < childList.Count; j++)
  324. {
  325. UIWFTabButton componentInChildren2 = childList[j].gameObject.GetComponentInChildren<UIWFTabButton>();
  326. if (!(componentInChildren2 == null) && componentInChildren2.isEnabled)
  327. {
  328. updateObject.tab_panel.Select(componentInChildren2);
  329. break;
  330. }
  331. }
  332. this.user_request_stage = data;
  333. }
  334. }
  335. private UIWFTabButton CreateSkillButton(Skill.Data skill_data, EventDelegate onclick_event)
  336. {
  337. if (skill_data == null)
  338. {
  339. return null;
  340. }
  341. FreeSkillSelect.UpdateObject updateObject = this.update_obj_dic_["スキル"];
  342. GameObject gameObject = updateObject.MoveButtonParent();
  343. if (gameObject == null)
  344. {
  345. gameObject = Utility.CreatePrefab(updateObject.button_parent, "SceneYotogi/FreeMode/FreeSkillButton", true);
  346. }
  347. UILabel component = UTY.GetChildObject(gameObject, "title", false).GetComponent<UILabel>();
  348. Localize component2 = component.GetComponent<Localize>();
  349. component.text = skill_data.name;
  350. gameObject.name = skill_data.name;
  351. if (component2 != null)
  352. {
  353. component2.SetTerm(skill_data.termName);
  354. }
  355. UIWFTabButton component3 = UTY.GetChildObject(gameObject, "BG", false).GetComponent<UIWFTabButton>();
  356. if (onclick_event != null)
  357. {
  358. component3.onClick.Add(onclick_event);
  359. }
  360. return component3;
  361. }
  362. private UIWFTabButton CreateTypeAndCategoryButton(FreeSkillSelect.UpdateObject update_obj, string name, string nameTerm, bool enabled, EventDelegate onclick_event)
  363. {
  364. GameObject gameObject = update_obj.MoveButtonParent();
  365. if (gameObject == null)
  366. {
  367. gameObject = Utility.CreatePrefab(update_obj.button_parent, "SceneYotogi/SkillSelect/Prefab/CategoryBtn", true);
  368. }
  369. UILabel component = UTY.GetChildObject(gameObject, "Label", false).GetComponent<UILabel>();
  370. Localize component2 = component.GetComponent<Localize>();
  371. component.text = name;
  372. if (component2 != null && !string.IsNullOrEmpty(nameTerm))
  373. {
  374. component2.SetTerm(nameTerm);
  375. }
  376. UIWFTabButton component3 = UTY.GetChildObject(gameObject, "Button", false).GetComponent<UIWFTabButton>();
  377. gameObject.name = name;
  378. component3.isEnabled = enabled;
  379. if (enabled && onclick_event != null)
  380. {
  381. component3.onClick.Add(onclick_event);
  382. }
  383. return component3;
  384. }
  385. private void OnClickTypeBtnEvent(FreeSkillSelect.ButtonData type_btn_data)
  386. {
  387. this.update_obj_dic_["タイプ"].UpdateArrow(type_btn_data.tab_button_obj.gameObject);
  388. this.CreateCategory(type_btn_data);
  389. }
  390. private void OnClickCategoryBtnEvent(FreeSkillSelect.ButtonData categorybtn_data)
  391. {
  392. this.update_obj_dic_["カテゴリー"].UpdateArrow(categorybtn_data.tab_button_obj.gameObject);
  393. this.CreateSkill(categorybtn_data);
  394. }
  395. private void OnClickSkillBtnEvent(FreeSkillSelect.ButtonData skill_data)
  396. {
  397. this.update_obj_dic_["スキル"].UpdateArrow(skill_data.tab_button_obj.gameObject);
  398. this.select_skill_ = skill_data.skill_data;
  399. this.CreateStage(skill_data.skill_data);
  400. }
  401. private void OnClickLevelBtnEvent()
  402. {
  403. this.update_obj_dic_["レベル"].UpdateArrow(UIButton.current.gameObject);
  404. this.yotogi_mgr_.fix_skill_level = int.Parse(UIButton.current.gameObject.name);
  405. }
  406. private void OnClickStageEvent(YotogiStageUnit stage_unit)
  407. {
  408. this.select_stage_ = (this.user_request_stage = stage_unit.stage_data);
  409. this.is_day_time_ = stage_unit.is_daytime;
  410. this.FixSkill();
  411. }
  412. private static List<FreeSkillSelect.ButtonData> CreateButtonData(Maid maid, HashSet<int> selectableStageIds)
  413. {
  414. List<FreeSkillSelect.ButtonData> list = new List<FreeSkillSelect.ButtonData>();
  415. Dictionary<Skill.Data.SpecialConditionType, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>> type_data_dic = new Dictionary<Skill.Data.SpecialConditionType, KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>>();
  416. List<KeyValuePair<Skill.Data.SpecialConditionType, string>> list2 = new List<KeyValuePair<Skill.Data.SpecialConditionType, string>>();
  417. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Null, "通常"));
  418. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Drunk, "酔い"));
  419. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Mask, "目隠し"));
  420. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Drug, "媚薬"));
  421. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Confess, "告白"));
  422. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.Faint, "気絶"));
  423. list2.Add(new KeyValuePair<Skill.Data.SpecialConditionType, string>(Skill.Data.SpecialConditionType.NewType, "新夜伽"));
  424. for (int i = 0; i < list2.Count; i++)
  425. {
  426. FreeSkillSelect.ButtonData buttonData = new FreeSkillSelect.ButtonData();
  427. buttonData.children_list = new List<FreeSkillSelect.ButtonData>();
  428. buttonData.name = list2[i].Value;
  429. buttonData.nameTerm = "SceneYotogi/スキル所属/" + buttonData.name;
  430. buttonData.condition_type = list2[i].Key;
  431. list.Add(buttonData);
  432. type_data_dic.Add(buttonData.condition_type, new KeyValuePair<FreeSkillSelect.ButtonData, Dictionary<string, FreeSkillSelect.ButtonData>>(buttonData, new Dictionary<string, FreeSkillSelect.ButtonData>()));
  433. }
  434. for (int j = 0; j < list.Count; j++)
  435. {
  436. for (int k = 0; k < 8; k++)
  437. {
  438. FreeSkillSelect.ButtonData buttonData2 = list[j];
  439. FreeSkillSelect.ButtonData buttonData3 = new FreeSkillSelect.ButtonData();
  440. buttonData3.children_list = new List<FreeSkillSelect.ButtonData>();
  441. FreeSkillSelect.ButtonData buttonData4 = buttonData3;
  442. Yotogi.Category category = (Yotogi.Category)k;
  443. buttonData4.name = category.ToString();
  444. buttonData3.nameTerm = "SceneYotogi/スキルカテゴリー/" + buttonData3.name;
  445. buttonData3.parent = buttonData2;
  446. buttonData2.children_list.Add(buttonData3);
  447. type_data_dic[list[j].condition_type].Value.Add(buttonData3.name, buttonData3);
  448. }
  449. }
  450. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  451. int[] keyArray = maid.status.yotogiSkill.datas.GetKeyArray();
  452. Dictionary<int, List<Skill.Data>> dictionary = new Dictionary<int, List<Skill.Data>>();
  453. for (int l = 0; l < keyArray.Length; l++)
  454. {
  455. Skill.Data data = Skill.Get(keyArray[l]);
  456. if (data.specialConditionType != Skill.Data.SpecialConditionType.NewType)
  457. {
  458. bool flag = false;
  459. foreach (int item in data.playable_stageid_list)
  460. {
  461. flag = selectableStageIds.Contains(item);
  462. if (flag)
  463. {
  464. break;
  465. }
  466. }
  467. if (flag)
  468. {
  469. int category2 = (int)data.category;
  470. if (!dictionary.ContainsKey(category2))
  471. {
  472. dictionary.Add(category2, new List<Skill.Data>());
  473. }
  474. dictionary[category2].Add(data);
  475. }
  476. }
  477. }
  478. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair in dictionary)
  479. {
  480. List<Skill.Data> value = keyValuePair.Value;
  481. value.Sort((Skill.Data a, Skill.Data b) => a.sortId - b.sortId);
  482. }
  483. List<Skill.Data> list3 = new List<Skill.Data>();
  484. foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair2 in dictionary)
  485. {
  486. List<Skill.Data> value2 = keyValuePair2.Value;
  487. foreach (Skill.Data item2 in value2)
  488. {
  489. list3.Add(item2);
  490. }
  491. }
  492. foreach (Skill.Data data2 in list3)
  493. {
  494. if (1 < data2.player_num)
  495. {
  496. int num = 0;
  497. for (int m = 0; m < characterMgr.GetMaidCount(); m++)
  498. {
  499. if (!(characterMgr.GetMaid(m) != null))
  500. {
  501. break;
  502. }
  503. num++;
  504. }
  505. if (num < data2.player_num)
  506. {
  507. continue;
  508. }
  509. }
  510. if (data2.IsExecMaid(maid.status))
  511. {
  512. FreeSkillSelect.ButtonData buttonData5 = type_data_dic[data2.specialConditionType].Value[data2.category.ToString()];
  513. if (buttonData5 != null)
  514. {
  515. FreeSkillSelect.ButtonData buttonData6 = new FreeSkillSelect.ButtonData();
  516. buttonData6.parent = buttonData5;
  517. buttonData6.name = data2.name;
  518. buttonData6.skill_data = data2;
  519. buttonData5.children_list.Add(buttonData6);
  520. }
  521. }
  522. }
  523. Action<Skill.Data.SpecialConditionType> action = delegate(Skill.Data.SpecialConditionType type)
  524. {
  525. Dictionary<string, FreeSkillSelect.ButtonData> value3 = type_data_dic[type].Value;
  526. HashSet<string> hashSet = new HashSet<string>();
  527. List<FreeSkillSelect.ButtonData> list4 = new List<FreeSkillSelect.ButtonData>();
  528. foreach (KeyValuePair<string, FreeSkillSelect.ButtonData> keyValuePair3 in value3)
  529. {
  530. if (keyValuePair3.Value.children_list != null && 1 <= keyValuePair3.Value.children_list.Count && !hashSet.Contains(keyValuePair3.Key))
  531. {
  532. hashSet.Add(keyValuePair3.Key);
  533. list4.Add(keyValuePair3.Value);
  534. }
  535. }
  536. type_data_dic[type].Key.children_list = list4;
  537. };
  538. foreach (FreeSkillSelect.ButtonData buttonData7 in list)
  539. {
  540. if (buttonData7.condition_type != Skill.Data.SpecialConditionType.Null)
  541. {
  542. action(buttonData7.condition_type);
  543. }
  544. }
  545. return list;
  546. }
  547. private static FreeSkillSelect.ButtonData GetButtonData(List<FreeSkillSelect.ButtonData> check_list, string name)
  548. {
  549. FreeSkillSelect.ButtonData result = null;
  550. if (check_list == null || string.IsNullOrEmpty(name))
  551. {
  552. return result;
  553. }
  554. for (int i = 0; i < check_list.Count; i++)
  555. {
  556. if (check_list[i] != null)
  557. {
  558. if (!string.IsNullOrEmpty(check_list[i].name) && check_list[i].name == name)
  559. {
  560. result = check_list[i];
  561. break;
  562. }
  563. }
  564. }
  565. return result;
  566. }
  567. public YotogiStage.Data select_stage
  568. {
  569. get
  570. {
  571. return this.select_stage_;
  572. }
  573. }
  574. public Skill.Data select_skill
  575. {
  576. get
  577. {
  578. return this.select_skill_;
  579. }
  580. }
  581. private Maid maid_;
  582. private List<FreeSkillSelect.ButtonData> button_data_list_;
  583. private Dictionary<string, FreeSkillSelect.UpdateObject> update_obj_dic_;
  584. private YotogiManager yotogi_mgr_;
  585. private Skill.Data select_skill_;
  586. private YotogiStage.Data select_stage_;
  587. private bool is_day_time_ = true;
  588. private YotogiStage.Data user_request_stage;
  589. private class ButtonData
  590. {
  591. public UIWFTabButton tab_button_obj;
  592. public FreeSkillSelect.ButtonData parent;
  593. public List<FreeSkillSelect.ButtonData> children_list;
  594. public string name;
  595. public string nameTerm;
  596. public Skill.Data skill_data;
  597. public Skill.Data.SpecialConditionType condition_type;
  598. }
  599. private class UpdateObject
  600. {
  601. public void Update()
  602. {
  603. this.ui_grid.Reposition();
  604. this.tab_panel.UpdateChildren();
  605. this.scroll_view.ResetPosition();
  606. this.ui_panel.UpdateAnchors();
  607. }
  608. public void MoveStorageRoom(bool click_event_clear)
  609. {
  610. if (this.storage_obj == null)
  611. {
  612. return;
  613. }
  614. Transform transform = this.button_parent.transform;
  615. Transform transform2 = this.storage_obj.transform;
  616. while (0 < transform.childCount)
  617. {
  618. GameObject gameObject = transform.GetChild(0).gameObject;
  619. UIWFTabButton componentInChildren = gameObject.GetComponentInChildren<UIWFTabButton>();
  620. if (componentInChildren != null)
  621. {
  622. componentInChildren.SetSelect(false);
  623. if (click_event_clear)
  624. {
  625. componentInChildren.onClick.Clear();
  626. }
  627. }
  628. gameObject.transform.SetParent(transform2, false);
  629. gameObject.transform.localPosition = Vector3.zero;
  630. }
  631. transform.DetachChildren();
  632. }
  633. public GameObject MoveButtonParent()
  634. {
  635. if (this.storage_obj == null)
  636. {
  637. return null;
  638. }
  639. GameObject gameObject = null;
  640. Transform transform = this.button_parent.transform;
  641. Transform transform2 = this.storage_obj.transform;
  642. if (0 < transform2.childCount)
  643. {
  644. gameObject = transform2.GetChild(0).gameObject;
  645. gameObject.transform.SetParent(transform, false);
  646. }
  647. return gameObject;
  648. }
  649. public GameObject MoveButtonParent(string object_name)
  650. {
  651. if (this.storage_obj == null || string.IsNullOrEmpty(object_name))
  652. {
  653. return null;
  654. }
  655. GameObject gameObject = null;
  656. Transform transform = this.button_parent.transform;
  657. Transform transform2 = this.storage_obj.transform;
  658. for (int i = 0; i < transform2.childCount; i++)
  659. {
  660. if (transform2.GetChild(i).name == object_name)
  661. {
  662. gameObject = transform2.GetChild(i).gameObject;
  663. gameObject.transform.SetParent(transform, false);
  664. break;
  665. }
  666. }
  667. return gameObject;
  668. }
  669. public void UpdateArrow(GameObject target_obj)
  670. {
  671. if (this.arrow_obj == null || target_obj == null)
  672. {
  673. return;
  674. }
  675. Vector3 position = target_obj.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  676. Vector3 local_pos = this.arrow_obj.transform.parent.InverseTransformPoint(position);
  677. local_pos.x = this.arrow_obj.transform.localPosition.x;
  678. local_pos.y += 18f;
  679. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  680. iTween.MoveTo(this.arrow_obj, args);
  681. }
  682. public void Clear()
  683. {
  684. Transform transform = this.button_parent.transform;
  685. for (int i = 0; i < transform.childCount; i++)
  686. {
  687. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  688. }
  689. transform.DetachChildren();
  690. }
  691. public GameObject button_parent;
  692. public UIGrid ui_grid;
  693. public UIWFTabPanel tab_panel;
  694. public UIScrollView scroll_view;
  695. public UIPanel ui_panel;
  696. public GameObject arrow_obj;
  697. public GameObject storage_obj;
  698. }
  699. }