SequenceBankData.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // SequenceBankData.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Diagnostics;
  13. using System.Text;
  14. using Microsoft.Xna.Framework.Graphics;
  15. #endregion
  16. namespace SceneDataLibrary
  17. {
  18. /// <summary>
  19. /// This class manages multiple sequence groups.
  20. /// In Layout, sequence banks correspond to these sequence groups.
  21. /// The display priority can be specified by the sequence bank property of Layout.
  22. ///
  23. /// 複数のシーケンスグループを保持するクラスです。
  24. /// Layoutでは、シーケンスバンクが相当します。
  25. /// 表示プライオリティーは、Layoutのシーケンスバンクプロパティーで
  26. /// 設定できます。
  27. /// </summary>
  28. public class SequenceBankData
  29. {
  30. #region Fields
  31. private int zPosition;//Display priority //表示プライオリティー
  32. //Sequence group data
  33. //シーケンスグループデータ
  34. private List<SequenceGroupData> sequenceGroupList =
  35. new List<SequenceGroupData>();
  36. #endregion
  37. #region Properties
  38. /// <summary>
  39. /// Obtains and sets the display order.
  40. ///
  41. /// 表示順位を設定取得します。
  42. /// </summary>
  43. public int ZPos
  44. {
  45. get
  46. {
  47. return zPosition;
  48. }
  49. set
  50. {
  51. zPosition = value;
  52. }
  53. }
  54. /// <summary>
  55. /// Obtains the list of sequence groups.
  56. ///
  57. /// シーケンスグループののリストを設定取得します。
  58. /// </summary>
  59. public List<SequenceGroupData> SequenceGroupList
  60. {
  61. get { return sequenceGroupList; }
  62. }
  63. /// <summary>
  64. /// Obtains whether the held sequences are being played or not.
  65. /// If they are not being played, returns false.
  66. ///
  67. /// 保持しているシーケンス群が再生中かどうかを取得します。
  68. /// 停止している場合はfalseです。
  69. /// </summary>
  70. public bool IsPlay
  71. {
  72. get
  73. {
  74. bool result = false;
  75. foreach (SequenceGroupData group in SequenceGroupList)
  76. {
  77. if (!group.IsStop)
  78. {
  79. result = true;
  80. break;
  81. }
  82. }
  83. return result;
  84. }
  85. }
  86. #endregion
  87. /// <summary>
  88. /// Sets the held sequence time forward.
  89. ///
  90. /// 保持しているシーケンスの時間を進めます。
  91. /// </summary>
  92. /// <param name="playFrames">
  93. /// Frame of each current sequence
  94. ///
  95. /// 現在の各シーケンスのフレーム
  96. /// </param>
  97. /// <param name="elapsedGameTime">
  98. /// Time to be forwarded
  99. ///
  100. /// 進める時間
  101. /// </param>
  102. /// <param name="bReverse">
  103. /// Specifies true in case of reverse play
  104. ///
  105. /// 逆再生の場合true
  106. /// </param>
  107. public void Update(float[] playFrames, TimeSpan elapsedGameTime, bool bReverse)
  108. {
  109. int nIndex = 0;
  110. foreach(SequenceGroupData group in SequenceGroupList)
  111. {
  112. playFrames[nIndex] = group.Update( playFrames[nIndex],
  113. elapsedGameTime,
  114. bReverse);
  115. nIndex++;
  116. }
  117. }
  118. /// <summary>
  119. /// Draws the held sequence group.
  120. /// Conversion settings can be applied to the entire sequence by specifying
  121. /// values to baseDrawData.
  122. ///
  123. /// 保持しているシーケンスグループを描画します。
  124. /// baseDrawDataに値を設定することで、シーケンス全体に変換を適用することが
  125. /// 出来ます。
  126. /// </summary>
  127. /// <param name="sb">
  128. /// SpriteBatch
  129. ///
  130. /// スプライトバッチ
  131. /// </param>
  132. /// <param name="baseDrawData">
  133. /// Conversion information that affects the entire drawing target
  134. ///
  135. /// 描画対象全体影響する変換用情報
  136. /// </param>
  137. public void Draw(SpriteBatch sb, DrawData baseDrawData)
  138. {
  139. foreach (SequenceGroupData group in SequenceGroupList)
  140. {
  141. group.Draw(sb, baseDrawData);
  142. }
  143. }
  144. /// <summary>
  145. /// Obtains the conversion information for the patterns belonging
  146. /// to the held sequence. Any display operation related to animations
  147. /// can be performed by using this data.
  148. ///
  149. /// 保持しているシーケンスに所属するパターンの変換情報を取得します。
  150. /// このデータを用いてアニメーションに追随した任意の表示を行うことができます。
  151. /// </summary>
  152. /// <param name="sequenceGroupId">
  153. /// Sequence group ID
  154. ///
  155. /// シーケンスグループのID
  156. /// </param>
  157. /// <param name="sequenceObjectId">
  158. /// Sequence object ID
  159. ///
  160. /// シーケンスオブジェクトのID
  161. /// </param>
  162. /// <param name="patternObjectId">
  163. /// Pattern object ID
  164. ///
  165. /// パターンオブジェクトのID
  166. /// </param>
  167. /// <returns></returns>
  168. public DrawData GetDrawPatternObjectDrawData( int sequenceGroupId,
  169. int sequenceObjectId,
  170. int patternObjectId)
  171. {
  172. return SequenceGroupList[sequenceGroupId].
  173. SequenceObjectList[sequenceObjectId].
  174. PatternObjectList[patternObjectId].InterpolationDrawData;
  175. }
  176. /// <summary>
  177. /// Obtains the conversion information for the patterns belonging
  178. /// to the sequence object that is being drawn in the held sequence.
  179. /// Any display operation related to animations can be performed
  180. /// by using this data.
  181. ///
  182. /// 保持しているシーケンスの現在描画中のシーケンスオブジェクトに所属する
  183. /// パターンの変換情報を取得します。
  184. /// このデータを用いてアニメーションに追随した任意の表示を行うことができます。
  185. /// </summary>
  186. /// <param name="sequenceGroupId">
  187. /// Sequence group ID
  188. ///
  189. /// シーケンスグループのID
  190. /// </param>
  191. /// <param name="patternObjectId">
  192. /// Pattern object ID
  193. ///
  194. /// パターンオブジェクトのID
  195. /// </param>
  196. /// <returns></returns>
  197. public DrawData GetDrawPatternObjectDrawData(int sequenceGroupId,
  198. int patternObjectId)
  199. {
  200. return SequenceGroupList[sequenceGroupId].CurrentObjectList.
  201. PatternObjectList[patternObjectId].InterpolationDrawData;
  202. }
  203. }
  204. }