YotogiSkillSelectManager.cs 16 KB

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