SequencePlayData.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // SequencePlayData.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.Text;
  13. using Microsoft.Xna.Framework.Graphics;
  14. #endregion
  15. namespace SceneDataLibrary
  16. {
  17. /// <summary>
  18. /// This class manages the sequence play status.
  19. /// This status is managed for each sequence bank in Layout.
  20. /// This class contains display frame data assigned to each
  21. /// sequence group in a sequence bank.
  22. /// This data value will be the same in all sequence groups
  23. /// unless special operations are performed.
  24. ///
  25. /// シーケンスの再生状況を管理します。
  26. /// 管理するのはLayout上でのシーケンスバンク単位です。
  27. /// 保持するデータは、シーケンスバンク内の各シーケンスグループに割り当てられる
  28. /// 表示フレームです。特別操作しない限り、すべてのシーケンスグループで
  29. /// このデータは同じ値になります。
  30. /// </summary>
  31. public class SequencePlayData
  32. {
  33. #region Fields
  34. //Sequence bank to be displayed
  35. //表示するシーケンスバンク
  36. private SequenceBankData sequenceData;
  37. //Reverse play flag
  38. //逆再生フラグ
  39. private bool reverse;
  40. //Current frame of each sequence group contained
  41. // in the sequence bank to be displayed
  42. //
  43. //表示するシーケンスバンクに含まれる各シーケンスグループの現在のフレーム
  44. private float[] playFrames;
  45. #endregion
  46. #region Properties
  47. /// <summary>
  48. /// Obtains the sequence bank to be displayed.
  49. ///
  50. /// 表示するシーケンスバンクを取得します。
  51. /// </summary>
  52. public SequenceBankData SequenceData
  53. {
  54. get
  55. {
  56. return sequenceData;
  57. }
  58. }
  59. /// <summary>
  60. /// If the sequence data is being played, returns true.
  61. ///
  62. /// 再生中の場合はtrue
  63. /// </summary>
  64. public bool IsPlay
  65. {
  66. get { return sequenceData.IsPlay; }
  67. }
  68. #endregion
  69. /// <summary>
  70. /// Sets the sequence time forward.
  71. ///
  72. /// シーケンスの時間を進めます。
  73. /// </summary>
  74. /// <param name="elapsedGameTime">
  75. /// Time to be forwarded
  76. ///
  77. /// 進める時間
  78. /// </param>
  79. public void Update(TimeSpan elapsedGameTime)
  80. {
  81. sequenceData.Update(playFrames, elapsedGameTime, reverse);
  82. }
  83. /// <summary>
  84. /// Draws the sequence data.
  85. ///
  86. /// 描画します。
  87. /// </summary>
  88. /// <param name="sb">
  89. /// SpriteBatch
  90. ///
  91. /// スプライトバッチ
  92. /// </param>
  93. /// <param name="data">
  94. /// Conversion information for drawing
  95. ///
  96. /// 描画変換情報
  97. /// </param>
  98. public void Draw(SpriteBatch sb, DrawData data)
  99. {
  100. sequenceData.Draw(sb, data);
  101. }
  102. /// <summary>
  103. /// Constructor
  104. /// Sets the sequence bank to be played and resets the time and play direction.
  105. ///
  106. /// コンストラクタ
  107. /// 再生するシーケンスバンクを設定し、時刻と再生方向をリセットします。
  108. /// </summary>
  109. /// <param name="bank">
  110. /// Sets the sequence bank to be drawn
  111. ///
  112. /// 描画するシーケンスバンクを設定します
  113. /// </param>
  114. public SequencePlayData(SequenceBankData bank)
  115. {
  116. sequenceData = bank;
  117. reverse = false;
  118. playFrames = new float[bank.SequenceGroupList.Count];
  119. }
  120. /// <summary>
  121. /// Resets the play time and plays the sequence data from the beginning.
  122. ///
  123. /// 再生時刻をリセットして最初から再生します。
  124. /// </summary>
  125. public void Replay()
  126. {
  127. foreach (SequenceGroupData group in sequenceData.SequenceGroupList)
  128. {
  129. group.Replay();
  130. }
  131. Update(new TimeSpan());
  132. }
  133. }
  134. }