MotionKagManager.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using System;
  2. public class MotionKagManager : BaseKagManager
  3. {
  4. public MotionKagManager(TJSScript tjs, ScriptManager script_mgr) : base(tjs, script_mgr)
  5. {
  6. for (int i = 0; i < this.last_maid_motion_set_log_.Length; i++)
  7. {
  8. this.last_maid_motion_set_log_[i] = string.Empty;
  9. }
  10. for (int j = 0; j < this.last_man_motion_set_log_.Length; j++)
  11. {
  12. this.last_man_motion_set_log_[j] = string.Empty;
  13. }
  14. }
  15. public override void Initialize()
  16. {
  17. base.Initialize();
  18. this.kag_.RemoveTagCallBack("motionscript");
  19. this.kag_.RemoveTagCallBack("allprocpropseqstart");
  20. this.kag_.AddTagCallBack("allprocpropseqstart", new KagScript.KagTagCallBack(this.TagMotAllProcPropSeqStart));
  21. this.kag_.RemoveTagCallBack("setmaidoffsetmultipos");
  22. this.kag_.AddTagCallBack("setmaidoffsetmultipos", new KagScript.KagTagCallBack(this.TagSetMaidOffsetMultiPos2));
  23. this.kag_.RemoveTagCallBack("face");
  24. this.kag_.AddTagCallBack("face", new KagScript.KagTagCallBack(this.TagMotFace));
  25. this.kag_.RemoveTagCallBack("faceblend");
  26. this.kag_.AddTagCallBack("faceblend", new KagScript.KagTagCallBack(this.TagMotFaceBlend));
  27. }
  28. public Maid SetMainMaid(Maid maid)
  29. {
  30. this.main_maid_ = maid;
  31. return this.main_maid_;
  32. }
  33. public Maid SetMainMaid(string maid_guid)
  34. {
  35. if (string.IsNullOrEmpty(maid_guid))
  36. {
  37. this.main_maid_ = null;
  38. return null;
  39. }
  40. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
  41. {
  42. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
  43. if (maid != null && maid.status.guid == maid_guid)
  44. {
  45. this.main_maid_ = maid;
  46. break;
  47. }
  48. }
  49. return this.main_maid_;
  50. }
  51. public Maid SetMainMan(Maid man)
  52. {
  53. this.main_man_ = man;
  54. return this.main_man_;
  55. }
  56. public Maid SetMainMan(string man_guid)
  57. {
  58. if (string.IsNullOrEmpty(man_guid))
  59. {
  60. this.main_man_ = null;
  61. return null;
  62. }
  63. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetManCount(); i++)
  64. {
  65. Maid man = GameMain.Instance.CharacterMgr.GetMan(i);
  66. if (man != null && man.status.guid == man_guid)
  67. {
  68. this.main_man_ = man;
  69. break;
  70. }
  71. }
  72. return this.main_man_;
  73. }
  74. private bool TagSetMaidOffsetMultiPos2(KagTagSupport tag_data)
  75. {
  76. if (this.valid_pos)
  77. {
  78. base.TagSetMaidOffsetMultiPos(tag_data);
  79. }
  80. return false;
  81. }
  82. private bool TagMotAllProcPropSeqStart(KagTagSupport tag_data)
  83. {
  84. Maid maidAndMan = base.GetMaidAndMan(tag_data);
  85. if (maidAndMan == null)
  86. {
  87. return false;
  88. }
  89. if (tag_data.IsValid("fix"))
  90. {
  91. maidAndMan.AllProcProp();
  92. }
  93. else
  94. {
  95. NDebug.Assert(!this.script_mgr_.is_motion_all_prop_seq, "MotionKagManager AllProcPropSeqStart error.");
  96. this.script_mgr_.is_motion_all_prop_seq = true;
  97. this.script_mgr_.motion_all_prop_seq_maid = maidAndMan;
  98. }
  99. return false;
  100. }
  101. private bool TagMotFace(KagTagSupport tag_data)
  102. {
  103. return !this.face_fix_ && base.TagFace(tag_data);
  104. }
  105. private bool TagMotFaceBlend(KagTagSupport tag_data)
  106. {
  107. return !this.face_fix_ && base.TagFaceBlend(tag_data);
  108. }
  109. public void SetNextMotion(bool is_next)
  110. {
  111. this.next_flag_ = is_next;
  112. }
  113. public void SetFaceFix(bool is_fix)
  114. {
  115. this.face_fix_ = is_fix;
  116. }
  117. protected override void PlayMaidMotion(Maid maid, string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f)
  118. {
  119. if (this.next_flag_)
  120. {
  121. boAddQue = true;
  122. this.next_flag_ = false;
  123. }
  124. base.PlayMaidMotion(maid, fn, additive, loop, boAddQue, val);
  125. if (!maid.boMAN && !boAddQue && 0 <= maid.ActiveSlotNo && maid.ActiveSlotNo < this.last_maid_motion_set_log_.Length)
  126. {
  127. this.last_maid_motion_set_log_[maid.ActiveSlotNo] = fn.ToLower();
  128. }
  129. else if (maid.boMAN && !boAddQue && 0 <= maid.ActiveSlotNo && maid.ActiveSlotNo < this.last_man_motion_set_log_.Length)
  130. {
  131. this.last_man_motion_set_log_[maid.ActiveSlotNo] = fn.ToLower();
  132. }
  133. }
  134. public void ClearMotion()
  135. {
  136. this.exec_wait_data_.Clear();
  137. this.wait_event_list_.Clear();
  138. }
  139. public void SetSloatNo(int no)
  140. {
  141. this.sloat_no_ = no;
  142. }
  143. public override string GetKagClassName()
  144. {
  145. return "モーションkag : " + this.sloat_no_.ToString();
  146. }
  147. public override Maid GetMaid(int no)
  148. {
  149. if (no == 0 && this.main_maid_ != null)
  150. {
  151. return this.main_maid_;
  152. }
  153. return base.GetMaid(no);
  154. }
  155. public override Maid GetMan(int man_no)
  156. {
  157. if (man_no == 0 && this.main_man_ != null)
  158. {
  159. return this.main_man_;
  160. }
  161. return base.GetMan(man_no);
  162. }
  163. public bool valid_pos
  164. {
  165. get
  166. {
  167. return this.valid_pos_;
  168. }
  169. set
  170. {
  171. this.valid_pos_ = value;
  172. }
  173. }
  174. public Maid main_maid
  175. {
  176. get
  177. {
  178. return this.main_maid_;
  179. }
  180. }
  181. public Maid main_man
  182. {
  183. get
  184. {
  185. return this.main_man_;
  186. }
  187. }
  188. public string[] last_maid_motion_set_log
  189. {
  190. get
  191. {
  192. return this.last_maid_motion_set_log_;
  193. }
  194. }
  195. public string[] last_man_motion_set_log
  196. {
  197. get
  198. {
  199. return this.last_man_motion_set_log_;
  200. }
  201. }
  202. private int sloat_no_;
  203. private bool next_flag_;
  204. private bool face_fix_;
  205. private Maid main_maid_;
  206. private Maid main_man_;
  207. private bool valid_pos_ = true;
  208. protected string[] last_maid_motion_set_log_ = new string[6];
  209. protected string[] last_man_motion_set_log_ = new string[6];
  210. }