#region File Description
//-----------------------------------------------------------------------------
// SequencePlayData.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace SceneDataLibrary
{
///
/// This class manages the sequence play status.
/// This status is managed for each sequence bank in Layout.
/// This class contains display frame data assigned to each
/// sequence group in a sequence bank.
/// This data value will be the same in all sequence groups
/// unless special operations are performed.
///
/// シーケンスの再生状況を管理します。
/// 管理するのはLayout上でのシーケンスバンク単位です。
/// 保持するデータは、シーケンスバンク内の各シーケンスグループに割り当てられる
/// 表示フレームです。特別操作しない限り、すべてのシーケンスグループで
/// このデータは同じ値になります。
///
public class SequencePlayData
{
#region Fields
//Sequence bank to be displayed
//表示するシーケンスバンク
private SequenceBankData sequenceData;
//Reverse play flag
//逆再生フラグ
private bool reverse;
//Current frame of each sequence group contained
// in the sequence bank to be displayed
//
//表示するシーケンスバンクに含まれる各シーケンスグループの現在のフレーム
private float[] playFrames;
#endregion
#region Properties
///
/// Obtains the sequence bank to be displayed.
///
/// 表示するシーケンスバンクを取得します。
///
public SequenceBankData SequenceData
{
get
{
return sequenceData;
}
}
///
/// If the sequence data is being played, returns true.
///
/// 再生中の場合はtrue
///
public bool IsPlay
{
get { return sequenceData.IsPlay; }
}
#endregion
///
/// Sets the sequence time forward.
///
/// シーケンスの時間を進めます。
///
///
/// Time to be forwarded
///
/// 進める時間
///
public void Update(TimeSpan elapsedGameTime)
{
sequenceData.Update(playFrames, elapsedGameTime, reverse);
}
///
/// Draws the sequence data.
///
/// 描画します。
///
///
/// SpriteBatch
///
/// スプライトバッチ
///
///
/// Conversion information for drawing
///
/// 描画変換情報
///
public void Draw(SpriteBatch sb, DrawData data)
{
sequenceData.Draw(sb, data);
}
///
/// Constructor
/// Sets the sequence bank to be played and resets the time and play direction.
///
/// コンストラクタ
/// 再生するシーケンスバンクを設定し、時刻と再生方向をリセットします。
///
///
/// Sets the sequence bank to be drawn
///
/// 描画するシーケンスバンクを設定します
///
public SequencePlayData(SequenceBankData bank)
{
sequenceData = bank;
reverse = false;
playFrames = new float[bank.SequenceGroupList.Count];
}
///
/// Resets the play time and plays the sequence data from the beginning.
///
/// 再生時刻をリセットして最初から再生します。
///
public void Replay()
{
foreach (SequenceGroupData group in sequenceData.SequenceGroupList)
{
group.Replay();
}
Update(new TimeSpan());
}
}
}