YotogiOldSubCharacterSelectManager.cs 6.2 KB

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