YotogiSkillSelectManager.cs 16 KB

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