YotogiSkillSelectManager.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using I2.Loc;
  5. using MaidStatus;
  6. using UnityEngine;
  7. using wf;
  8. using Yotogis;
  9. public class YotogiSkillSelectManager : WfScreenChildren
  10. {
  11. public override void Awake()
  12. {
  13. base.Awake();
  14. this.yotogi_mgr_ = base.GetComponentInParent<YotogiManager>();
  15. this.common_buttons_ = UTY.GetChildObject(base.root_obj, "CommonPanel", false).GetComponent<YotogiCommonButtons>();
  16. string path = "SceneYotogi/Common/Prefab/ParameterViewer";
  17. if (Product.supportMultiLanguage)
  18. {
  19. path = "SceneYotogi/Common/Prefab/ParameterViewerWidth";
  20. }
  21. GameObject gameObject = Utility.CreatePrefab(base.root_obj, path, true);
  22. gameObject.transform.localPosition = new Vector3(782f, 449f, 0f);
  23. this.paramenter_viewer_ = gameObject.GetComponent<YotogiParameterViewer>();
  24. this.paramenter_viewer_.SetAttributeViewer(UTY.GetChildObject(base.root_obj.transform.parent.gameObject, "AttributeViewer", false).GetComponent<AttributeViewer>());
  25. EventDelegate.Add(this.paramenter_viewer_.costume_button.onClick, new EventDelegate.Callback(this.OnClickEdit));
  26. this.skill_container_mgr_ = new YotogiSkillContainerViewer(base.root_obj, this);
  27. this.skill_container_mgr_.SetOnSkillChangeEvent(new Action<YotogiSkillContainerViewer>(this.OnSkillChangeEvent));
  28. this.arrow_obj_ = UTY.GetChildObject(base.root_obj, "CategoryViewer/Arrow", false);
  29. GameObject childObject = UTY.GetChildObject(base.root_obj, "CategoryViewer/Content", false);
  30. GameObject childObject2 = UTY.GetChildObject(childObject, "CategoryUnitParent", false);
  31. bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay;
  32. this.category_data_array_ = new YotogiSkillSelectManager.CategoryData[8];
  33. for (int i = 0; i < this.category_data_array_.Length; i++)
  34. {
  35. this.category_data_array_[i].skill_list = new List<YotogiSkillListManager.Data>();
  36. this.category_data_array_[i].category = (Yotogi.Category)i;
  37. this.category_data_array_[i].obj = Utility.CreatePrefab(childObject2, "SceneYotogi/SkillSelect/Prefab/CategoryBtn", true);
  38. this.category_data_array_[i].obj.name = this.category_data_array_[i].category.ToString();
  39. this.category_data_array_[i].obj.GetComponentInChildren<UILabel>().text = this.category_data_array_[i].obj.name;
  40. string term = "SceneYotogi/スキルカテゴリー/" + this.category_data_array_[i].obj.name;
  41. this.category_data_array_[i].obj.GetComponentInChildren<Localize>().SetTerm(term);
  42. UIWFTabButton component = UTY.GetChildObject(this.category_data_array_[i].obj, "Button", false).GetComponent<UIWFTabButton>();
  43. EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromCategoryButton");
  44. EventDelegate.Parameter[] parameters = eventDelegate.parameters;
  45. parameters[0].value = this.category_data_array_[i].obj;
  46. parameters[1].value = (Yotogi.Category)i;
  47. if (lockNTRPlay && (this.category_data_array_[i].category == Yotogi.Category.交換 || this.category_data_array_[i].category == Yotogi.Category.乱交))
  48. {
  49. this.category_data_array_[i].obj.SetActive(false);
  50. }
  51. component.onClick.Add(eventDelegate);
  52. }
  53. this.tab_panel_ = childObject2.GetComponent<UIWFTabPanel>();
  54. this.tab_panel_.UpdateChildren();
  55. Utility.ResetNGUI(childObject2.GetComponent<UIGrid>());
  56. Utility.ResetNGUI(childObject.GetComponent<UIScrollView>());
  57. childObject.GetComponent<UIPanel>().UpdateAnchors();
  58. this.conditionSetting.onChangeSelectedTypeEvent = new Action<Skill.Data.SpecialConditionType>(this.CreateSkillButtons);
  59. }
  60. protected override bool IsCallFadeIn()
  61. {
  62. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  63. Maid man = characterMgr.GetMan(0);
  64. bool result = false;
  65. if (!man.IsBusy && !this.maid_.IsBusy)
  66. {
  67. man.Visible = false;
  68. this.maid_.SetPosOffset(Vector3.zero);
  69. if (YotogiSkillSelectWaitMotion.ApplyMaidGesture(this.maid_, this.setting_stage_data_))
  70. {
  71. result = true;
  72. }
  73. }
  74. return result;
  75. }
  76. protected override void OnCall()
  77. {
  78. this.maid_ = this.yotogi_mgr_.maid;
  79. this.paramenter_viewer_.SetMaid(this.maid_);
  80. this.possible_maid_num_ = this.yotogi_mgr_.GetPlayPossibleMaidCount();
  81. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  82. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  83. {
  84. Maid maid = characterMgr.GetMaid(i);
  85. if (maid != null && maid != this.maid_ && maid.Visible)
  86. {
  87. maid.Visible = false;
  88. }
  89. }
  90. if (!this.yotogi_mgr_.is_new_yotogi_mode)
  91. {
  92. uGUITutorialPanel.OpenTutorial("YotogiSkill", null, false);
  93. GameMain.Instance.SysShortcut.strSceneHelpName = "YotogiSkill";
  94. }
  95. GameMain.Instance.MainLight.Reset();
  96. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  97. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  98. GameMain.Instance.SoundMgr.VoiceStopAll();
  99. if (YotogiStageSelectManager.SelectedStage != null)
  100. {
  101. this.setting_stage_data_ = YotogiStageSelectManager.SelectedStage;
  102. }
  103. else
  104. {
  105. this.setting_stage_data_ = YotogiStage.GetAllDatas(true)[0];
  106. }
  107. GameMain.Instance.SoundMgr.PlayBGM(this.setting_stage_data_.bgmFileName, 1.5f, true);
  108. this.yotogi_mgr_.CreateBackUpSkillID();
  109. this.yotogi_mgr_.CreateBackUpYotogiClass();
  110. this.yotogi_mgr_.fix_skill_level = 0;
  111. int num = (!GameMain.Instance.CharacterMgr.status.isDaytime) ? 1 : 0;
  112. GameMain.Instance.BgMgr.ChangeBg(this.setting_stage_data_.prefabName[num]);
  113. foreach (Skill.Data.SpecialConditionType type in this.conditionSetting.checkBoxTypes)
  114. {
  115. bool enabled = false;
  116. Dictionary<int, YotogiSkillListManager.Data> dictionary = YotogiSkillListManager.CreateDatas(this.maid_.status, true, type);
  117. foreach (KeyValuePair<int, YotogiSkillListManager.Data> keyValuePair in dictionary)
  118. {
  119. YotogiSkillListManager.Data value = keyValuePair.Value;
  120. if (value.skillData.IsExecStage(this.setting_stage_data_))
  121. {
  122. enabled = true;
  123. break;
  124. }
  125. }
  126. this.conditionSetting.SetTypeCheckBoxEnabled(type, enabled);
  127. }
  128. this.maid_.status.currentHp = this.maid_.status.maxHp;
  129. this.maid_.status.currentMind = this.maid_.status.maxMind;
  130. this.maid_.status.currentSensual = 0;
  131. Maid man = characterMgr.GetMan(0);
  132. man.Visible = true;
  133. this.maid_.Visible = true;
  134. man.AllProcPropSeqStart();
  135. this.maid_.AllProcPropSeqStart();
  136. this.common_buttons_.next_btn.onClick.Clear();
  137. EventDelegate.Add(this.common_buttons_.next_btn.onClick, new EventDelegate.Callback(this.OnClickNext));
  138. this.common_buttons_.viwe_reset_btn.gameObject.SetActive(false);
  139. this.paramenter_viewer_.SetMaid(this.maid_);
  140. this.paramenter_viewer_.UpdateTextCommon();
  141. this.paramenter_viewer_.UpdateTextParam();
  142. this.skill_container_mgr_.Init(this.maid_);
  143. this.skill_container_mgr_.SetMaxHp(this.maid_.status.maxHp);
  144. this.skill_container_mgr_.SetCurrentHp(this.maid_.status.currentHp);
  145. this.checkBoxStatusLock.check = this.maid_.status.enabledYotogiStatusLock;
  146. this.checkBoxStatusLock.onClick.Clear();
  147. this.checkBoxStatusLock.onClick.Add(delegate(WFCheckBox check_box)
  148. {
  149. this.maid_.status.enabledYotogiStatusLock = check_box.check;
  150. });
  151. GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.Yotogi, false);
  152. this.conditionSetting.selectedType = Skill.Data.SpecialConditionType.Null;
  153. }
  154. public void CreateSkillButtons(Skill.Data.SpecialConditionType type)
  155. {
  156. this.OnClickAllReset();
  157. for (int i = 0; i < this.category_data_array_.Length; i++)
  158. {
  159. this.category_data_array_[i].skill_list.Clear();
  160. }
  161. Dictionary<int, YotogiSkillListManager.Data> dictionary = YotogiSkillListManager.CreateDatas(this.maid_.status, true, type);
  162. foreach (KeyValuePair<int, YotogiSkillListManager.Data> keyValuePair in dictionary)
  163. {
  164. YotogiSkillListManager.Data value = keyValuePair.Value;
  165. if (value.skillData.IsExecStage(this.setting_stage_data_))
  166. {
  167. this.category_data_array_[(int)value.skillData.category].skill_list.Add(value);
  168. }
  169. }
  170. for (int j = 0; j < this.category_data_array_.Length; j++)
  171. {
  172. this.category_data_array_[j].skill_list.Sort((YotogiSkillListManager.Data a, YotogiSkillListManager.Data b) => a.skillData.sortId - b.skillData.sortId);
  173. if (this.category_data_array_[j].obj != null)
  174. {
  175. UIWFTabButton component = UTY.GetChildObject(this.category_data_array_[j].obj, "Button", false).GetComponent<UIWFTabButton>();
  176. component.SetSelect(false);
  177. component.isEnabled = (0 < this.category_data_array_[j].skill_list.Count);
  178. }
  179. }
  180. for (int k = 0; k < this.category_data_array_.Length; k++)
  181. {
  182. if (0 < this.category_data_array_[k].skill_list.Count && this.category_data_array_[k].obj != null)
  183. {
  184. this.tab_panel_.Select(UTY.GetChildObject(this.category_data_array_[k].obj, "Button", false).GetComponent<UIWFTabButton>());
  185. break;
  186. }
  187. }
  188. }
  189. private void SetCategorySkill(Yotogi.Category category)
  190. {
  191. GameObject childObject = UTY.GetChildObject(base.root_obj, "SkillViewer/Contents", false);
  192. GameObject childObject2 = UTY.GetChildObject(childObject, "SkillUnitParent", false);
  193. Transform transform = childObject2.transform;
  194. this.skill_unit_list_.Clear();
  195. for (int i = 0; i < transform.childCount; i++)
  196. {
  197. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  198. }
  199. transform.DetachChildren();
  200. GameObject childObject3 = UTY.GetChildObject(base.root_obj, "YotogiSkillConditionsPanel", false);
  201. List<YotogiSkillListManager.Data> skill_list = this.category_data_array_[(int)category].skill_list;
  202. for (int j = 0; j < skill_list.Count; j++)
  203. {
  204. GameObject gameObject = this.CreateNewSkillUnit(childObject2);
  205. YotogiSkillLockUnit componentInChildren = gameObject.GetComponentInChildren<YotogiSkillLockUnit>();
  206. YotogiSkillUnit componentInChildren2 = gameObject.GetComponentInChildren<YotogiSkillUnit>();
  207. componentInChildren2.SetSkillData(this.maid_, skill_list[j].skillData, skill_list[j].maidStatusSkillData, componentInChildren, skill_list[j].conditionDatas);
  208. componentInChildren2.SetConditionsPanel(childObject3);
  209. this.skill_unit_list_.Add(componentInChildren2.gameObject);
  210. }
  211. Utility.ResetNGUI(childObject2.GetComponent<UIGrid>());
  212. Utility.ResetNGUI(childObject.GetComponent<UIScrollView>());
  213. this.OnSkillChangeEvent(this.skill_container_mgr_);
  214. }
  215. private void OnClickFromSkillUnit(GameObject game_obj)
  216. {
  217. YotogiSkillUnit component = game_obj.GetComponent<YotogiSkillUnit>();
  218. this.skill_container_mgr_.AddSkill(component.skill_data, component.skill_param_data.lockSkillExp);
  219. }
  220. private void OnClickFromCategoryButton(GameObject obj, Yotogi.Category category)
  221. {
  222. for (int i = 0; i < this.category_data_array_.Length; i++)
  223. {
  224. if (this.category_data_array_[i].category == category)
  225. {
  226. this.SetCategorySkill(this.category_data_array_[i].category);
  227. Vector3 position = this.category_data_array_[i].obj.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  228. Vector3 local_pos = this.arrow_obj_.transform.parent.InverseTransformPoint(position);
  229. local_pos.x = this.arrow_obj_.transform.localPosition.x;
  230. local_pos.y += 18f;
  231. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  232. iTween.MoveTo(this.arrow_obj_, args);
  233. }
  234. }
  235. }
  236. private void OnSkillChangeEvent(YotogiSkillContainerViewer obj)
  237. {
  238. Skill.Data[] settingSkillArray = obj.GetSettingSkillArray();
  239. int num = this.yotogi_mgr_.skill_select_max_hp;
  240. for (int i = 0; i < settingSkillArray.Length; i++)
  241. {
  242. num -= settingSkillArray[i].exec_need_hp;
  243. }
  244. bool flag = settingSkillArray.Length != 7 && 0 < num;
  245. for (int j = 0; j < this.skill_unit_list_.Count; j++)
  246. {
  247. YotogiSkillUnit component = this.skill_unit_list_[j].GetComponent<YotogiSkillUnit>();
  248. Skill.Data skill_data = component.skill_data;
  249. bool flag2 = flag;
  250. if ((flag2 && this.possible_maid_num_ < skill_data.player_num) || component.skill_param_data == null)
  251. {
  252. flag2 = false;
  253. }
  254. if (flag2 && skill_data.ban_id_array != null && 0 < skill_data.ban_id_array.Length)
  255. {
  256. for (int k = 0; k < skill_data.ban_id_array.Length; k++)
  257. {
  258. for (int l = 0; l < settingSkillArray.Length; l++)
  259. {
  260. if (skill_data.ban_id_array[k] == settingSkillArray[l].id)
  261. {
  262. flag2 = false;
  263. break;
  264. }
  265. }
  266. if (!flag2)
  267. {
  268. break;
  269. }
  270. }
  271. }
  272. component.isEnabled = flag2;
  273. }
  274. this.skill_container_mgr_.SetCurrentHp(num);
  275. this.maid_.status.currentHp = num;
  276. this.paramenter_viewer_.UpdateTextParam();
  277. this.common_buttons_.next_btn.isEnabled = (0 < settingSkillArray.Length);
  278. }
  279. public void SetEditNextLabel(string label)
  280. {
  281. this.edit_next_label_ = label;
  282. }
  283. public void OnClickAllReset()
  284. {
  285. this.skill_container_mgr_.ResetAllSkill();
  286. }
  287. public void OnClickAllLockSkillExp()
  288. {
  289. foreach (YotogiSkillData yotogiSkillData in this.maid_.status.yotogiSkill.datas.GetValueArray())
  290. {
  291. yotogiSkillData.lockSkillExp = true;
  292. }
  293. foreach (GameObject gameObject in this.skill_unit_list_)
  294. {
  295. YotogiSkillLockUnit componentInChildren = gameObject.transform.parent.GetComponentInChildren<YotogiSkillLockUnit>();
  296. if (componentInChildren.enabled)
  297. {
  298. componentInChildren.checkBox.check = componentInChildren.skillData.lockSkillExp;
  299. }
  300. }
  301. }
  302. public void OnClickAllUnLockExp()
  303. {
  304. foreach (YotogiSkillData yotogiSkillData in this.maid_.status.yotogiSkill.datas.GetValueArray())
  305. {
  306. yotogiSkillData.lockSkillExp = false;
  307. }
  308. foreach (GameObject gameObject in this.skill_unit_list_)
  309. {
  310. YotogiSkillLockUnit componentInChildren = gameObject.transform.parent.GetComponentInChildren<YotogiSkillLockUnit>();
  311. if (componentInChildren.enabled)
  312. {
  313. componentInChildren.checkBox.check = componentInChildren.skillData.lockSkillExp;
  314. }
  315. }
  316. }
  317. private GameObject CreateNewSkillUnit(GameObject root)
  318. {
  319. GameObject gameObject = new GameObject();
  320. gameObject.transform.SetParent(root.transform, false);
  321. gameObject.name = "SkillUnit:" + (root.transform.childCount - 1).ToString();
  322. GameObject gameObject2 = Utility.CreatePrefab(gameObject, "SceneYotogi/SkillSelect/Prefab/YotogiSkillUnit", true);
  323. EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromSkillUnit");
  324. EventDelegate.Parameter parameter = eventDelegate.parameters[0];
  325. parameter.obj = gameObject2;
  326. GameObject childObject = UTY.GetChildObject(gameObject2, "Button", false);
  327. childObject.GetComponent<UIButton>().onClick.Add(eventDelegate);
  328. GameObject gameObject3 = Utility.CreatePrefab(gameObject, "SceneYotogi/SkillSelect/Prefab/YotogiSkillLockUnit", true);
  329. Vector3 localPosition = gameObject3.transform.localPosition;
  330. gameObject3.transform.localPosition = new Vector3(230f, localPosition.y, localPosition.z);
  331. return gameObject;
  332. }
  333. private void OnClickEdit()
  334. {
  335. if (string.IsNullOrEmpty(this.edit_next_label_))
  336. {
  337. return;
  338. }
  339. this.yotogi_mgr_.null_mgr.SetNextLabel(this.edit_next_label_);
  340. this.Finish();
  341. }
  342. private void OnClickNext()
  343. {
  344. Skill.Data[] settingSkillArray = this.skill_container_mgr_.GetSettingSkillArray();
  345. bool[] settingSkillLockArray = this.skill_container_mgr_.GetSettingSkillLockArray();
  346. KeyValuePair<Skill.Data, bool>[] array = new KeyValuePair<Skill.Data, bool>[settingSkillArray.Length];
  347. for (int i = 0; i < settingSkillArray.Length; i++)
  348. {
  349. array[i] = new KeyValuePair<Skill.Data, bool>(settingSkillArray[i], settingSkillLockArray[i]);
  350. }
  351. this.yotogi_mgr_.SetPlaySkillArray(array);
  352. if (this.maid_.status.currentHp <= 0)
  353. {
  354. GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/気絶注意", null, SystemDialog.TYPE.OK_CANCEL, delegate
  355. {
  356. GameMain.Instance.SysDlg.Close();
  357. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  358. {
  359. this.Finish();
  360. }
  361. }, null);
  362. }
  363. else if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  364. {
  365. this.Finish();
  366. }
  367. }
  368. protected override void OnFinish()
  369. {
  370. UIWFTabButton selectButtonObject = this.tab_panel_.GetSelectButtonObject();
  371. if (selectButtonObject != null)
  372. {
  373. selectButtonObject.SetSelect(false);
  374. }
  375. GameMain.Instance.CharacterMgr.SetCharaAllPos(Vector3.zero);
  376. GameMain.Instance.CharacterMgr.SetCharaAllRot(Vector3.zero);
  377. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  378. GameMain.Instance.ScriptMgr.StopMotionScript();
  379. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  380. {
  381. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString());
  382. }
  383. }
  384. [SerializeField]
  385. public WFCheckBox checkBoxStatusLock;
  386. [SerializeField]
  387. public YotogiSkillSelectSpecialCondition conditionSetting;
  388. private Maid maid_;
  389. private YotogiManager yotogi_mgr_;
  390. private YotogiStage.Data setting_stage_data_;
  391. private YotogiCommonButtons common_buttons_;
  392. private UIWFTabPanel tab_panel_;
  393. private GameObject arrow_obj_;
  394. private YotogiParameterViewer paramenter_viewer_;
  395. private YotogiSkillSelectManager.CategoryData[] category_data_array_;
  396. private List<GameObject> skill_unit_list_ = new List<GameObject>();
  397. private YotogiSkillContainerViewer skill_container_mgr_;
  398. private string edit_next_label_ = string.Empty;
  399. private int possible_maid_num_;
  400. private struct CategoryData
  401. {
  402. public GameObject obj;
  403. public Yotogi.Category category;
  404. public List<YotogiSkillListManager.Data> skill_list;
  405. }
  406. }