YotogiSubCharacterSelectManager.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using Yotogis;
  5. public class YotogiSubCharacterSelectManager : WfScreenChildren
  6. {
  7. public int GetPlayerSelectNum()
  8. {
  9. if (this.yotogi_mgr_ == null)
  10. {
  11. return 0;
  12. }
  13. if (this.yotogi_mgr_.is_free_mode)
  14. {
  15. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  16. int num = 1;
  17. int[] keyArray = maid.status.yotogiSkill.datas.GetKeyArray();
  18. for (int i = 0; i < keyArray.Length; i++)
  19. {
  20. Skill.Data data = Skill.Get(keyArray[i]);
  21. if (PersonalEventBlocker.IsEnabledYotodiSkill(maid.status.personal, data.id))
  22. {
  23. num = Math.Max(num, data.player_num);
  24. }
  25. }
  26. return ((this.yotogi_mgr_.GetPlayPossibleMaidCount() >= num) ? num : this.yotogi_mgr_.GetPlayPossibleMaidCount()) - 1;
  27. }
  28. if (this.yotogi_mgr_.play_skill_array == null)
  29. {
  30. return 0;
  31. }
  32. int num2 = 0;
  33. for (int j = 0; j < this.yotogi_mgr_.play_skill_array.Length; j++)
  34. {
  35. if (this.yotogi_mgr_.play_skill_array[j] != null && this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data != null)
  36. {
  37. if (num2 < this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data.player_num)
  38. {
  39. num2 = this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data.player_num;
  40. }
  41. }
  42. }
  43. return ((this.yotogi_mgr_.GetPlayPossibleMaidCount() >= num2) ? num2 : this.yotogi_mgr_.GetPlayPossibleMaidCount()) - 1;
  44. }
  45. public override void Awake()
  46. {
  47. base.Awake();
  48. this.yotogi_mgr_ = base.GetComponentInParent<YotogiManager>();
  49. this.chara_select_ = base.root_obj.GetComponentInChildren<CharacterSelectManager>();
  50. this.ok_btn_ = UTY.GetChildObject(base.root_obj, "Ok", false).GetComponent<UIButton>();
  51. this.ok_btn_.onClick.Add(new EventDelegate(this, "OnClickOK"));
  52. if (UTY.GetChildObject(base.root_obj, "Cancel", true) != null)
  53. {
  54. UIButton component = UTY.GetChildObject(base.root_obj, "Cancel", false).GetComponent<UIButton>();
  55. component.onClick.Add(new EventDelegate(this, "OnClickCancel"));
  56. }
  57. }
  58. protected override void OnCall()
  59. {
  60. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  61. this.maid_ = this.yotogi_mgr_.maid;
  62. if (UTY.GetChildObject(base.root_obj, "Cancel", true) != null)
  63. {
  64. UTY.GetChildObject(base.root_obj, "Cancel", false).SetActive(!string.IsNullOrEmpty(this.cancel_label));
  65. }
  66. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  67. {
  68. Maid maid = characterMgr.GetMaid(i);
  69. if (maid != null && maid.Visible)
  70. {
  71. maid.Visible = false;
  72. }
  73. }
  74. for (int j = 0; j < characterMgr.GetManCount(); j++)
  75. {
  76. Maid man = characterMgr.GetMan(j);
  77. if (man != null && man.Visible)
  78. {
  79. man.Visible = false;
  80. }
  81. }
  82. this.ok_btn_.isEnabled = false;
  83. this.loded_chara_ = false;
  84. this.loaded_check_maid_.Clear();
  85. int select_chara_num = this.GetPlayerSelectNum();
  86. this.chara_select_.SetCallBackMaidList(new CharacterSelectManager.CallBackMaidList(this.yotogi_mgr_.GetSubMaidList));
  87. if (1 < select_chara_num || select_chara_num == 0)
  88. {
  89. CharacterSelectManager.CallBackOnMultiSelect callBackOnMultiSelect = delegate(Maid[] maid_array)
  90. {
  91. int select_chara_num = select_chara_num;
  92. int num = 0;
  93. this.loaded_check_maid_.Clear();
  94. for (int k = 0; k < maid_array.Length; k++)
  95. {
  96. if (maid_array[k] != null)
  97. {
  98. this.loaded_check_maid_.Add(maid_array[k]);
  99. num++;
  100. }
  101. }
  102. if (0 < select_chara_num)
  103. {
  104. this.ok_btn_.isEnabled = (select_chara_num == num);
  105. }
  106. };
  107. this.chara_select_.SetCallBackOnMultiSelect(callBackOnMultiSelect);
  108. if (select_chara_num == 0)
  109. {
  110. this.chara_select_.Create(CharacterSelectManager.Type.Multiple, 3, true);
  111. }
  112. else
  113. {
  114. this.chara_select_.Create(CharacterSelectManager.Type.Multiple, select_chara_num, true);
  115. }
  116. }
  117. else
  118. {
  119. CharacterSelectManager.CallBackOnSelect callBackCallBackOnSelect = delegate(Maid select_maid)
  120. {
  121. this.loaded_check_maid_.Clear();
  122. this.loaded_check_maid_.Add(select_maid);
  123. };
  124. this.chara_select_.SetCallBackCallBackOnSelect(callBackCallBackOnSelect);
  125. this.chara_select_.Create(CharacterSelectManager.Type.Select, 3, true);
  126. this.ok_btn_.isEnabled = true;
  127. }
  128. }
  129. protected override bool IsCallFadeIn()
  130. {
  131. if (this.maid_.IsBusy)
  132. {
  133. return false;
  134. }
  135. this.maid_.FaceAnime("通常", 0f, 0);
  136. this.maid_.FaceBlend("無し");
  137. return true;
  138. }
  139. private void OnClickOK()
  140. {
  141. if (this.loaded_check_maid_.Count <= 0)
  142. {
  143. return;
  144. }
  145. this.loded_chara_ = true;
  146. this.Finish();
  147. }
  148. private void OnClickCancel()
  149. {
  150. if (string.IsNullOrEmpty(this.cancel_label))
  151. {
  152. return;
  153. }
  154. this.yotogi_mgr_.null_mgr.SetNextLabel(this.cancel_label);
  155. this.Finish();
  156. }
  157. protected override void OnFinish()
  158. {
  159. if (!this.loded_chara_)
  160. {
  161. return;
  162. }
  163. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  164. int num = 1;
  165. for (int i = 0; i < this.loaded_check_maid_.Count; i++)
  166. {
  167. if (!(this.loaded_check_maid_[i] == null))
  168. {
  169. characterMgr.SetActiveMaid(this.loaded_check_maid_[i], num++);
  170. this.loaded_check_maid_[i].Visible = true;
  171. this.loaded_check_maid_[i].AllProcPropSeqStart();
  172. }
  173. }
  174. }
  175. protected override void OnFadeEnd()
  176. {
  177. if (this.loaded_check_maid_.Count == 0 || !this.loded_chara_)
  178. {
  179. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  180. {
  181. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString());
  182. }
  183. else
  184. {
  185. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.SkillSelect.ToString());
  186. }
  187. }
  188. bool flag = true;
  189. for (int i = 0; i < this.loaded_check_maid_.Count; i++)
  190. {
  191. if (!(this.loaded_check_maid_[i] == null))
  192. {
  193. if (this.loaded_check_maid_[i].IsBusy)
  194. {
  195. flag = false;
  196. break;
  197. }
  198. }
  199. }
  200. if (flag)
  201. {
  202. this.loaded_check_maid_.Clear();
  203. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  204. {
  205. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString());
  206. }
  207. else
  208. {
  209. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.SkillSelect.ToString());
  210. }
  211. }
  212. }
  213. public string cancel_label
  214. {
  215. get
  216. {
  217. return this.cancel_label_;
  218. }
  219. set
  220. {
  221. this.cancel_label_ = value;
  222. }
  223. }
  224. private Maid maid_;
  225. private YotogiManager yotogi_mgr_;
  226. private CharacterSelectManager chara_select_;
  227. private UIButton ok_btn_;
  228. private List<Maid> loaded_check_maid_ = new List<Maid>();
  229. private string cancel_label_ = string.Empty;
  230. private bool loded_chara_;
  231. }