#region File Description //----------------------------------------------------------------------------- // SceneData.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; using Microsoft.Xna.Framework.Graphics; #endregion namespace SceneDataLibrary { /// /// This class manages scene data (pattern and sequence). /// In Layout, stage data corresponds to this scene data. /// /// シーンデータ(パターン、シーケンス)を保持します。 /// Layoutではステージデータに相当します。 /// public class SceneData { #region Fields //List of pattern groups // //パターングループのリスト private Dictionary patternGroupDictionary = new Dictionary(); //List of sequence banks // //シーケンスバンクのリスト private Dictionary sequenceBankDictionary = new Dictionary(); //List of sequence play data // //シーケンス再生データのリスト private List sequencePlayList = new List(); #endregion #region Propaties /// /// Obtains the dictionary list for pattern groups. /// /// パターングループデータの辞書リストを設定取得します。 /// public Dictionary PatternGroupDictionary { get { return patternGroupDictionary; } } /// /// Obtains the dictionary list for sequence bank data. /// /// シーケンスバンクデータの辞書リストを設定取得します。 /// public Dictionary SequenceBankDictionary { get { return sequenceBankDictionary; } } #endregion /// /// Creates data to play the sequence. /// When specifying the target sequence, uses the sequence bank name. /// /// シーケンスを再生するためのデータを作成します。 /// 対象は、シーケンスバンク名で名前で指定します。 /// /// /// Sequence name /// /// シーケンスの名前 /// /// public SequencePlayData CreatePlaySeqData(String name) { return new SequencePlayData(sequenceBankDictionary[name]); } /// /// Adds sequences to be played. /// When adding them to the list, the display priority specified in /// the layout tool must be considered. /// /// 再生するシーケンスを追加します。 /// レイアウトツールで指定された表示優先順位を考慮して /// リストに追加します。 /// /// /// Sequence data to be played /// /// 再生するシーケンスのデータ /// public void AddPlaySeqData(SequencePlayData data) { int nInsertIndex = 0; for(int i = sequencePlayList.Count - 1; i >= 0; i--) { int nZPos = sequencePlayList[i].SequenceData.ZPos; if (nZPos <= data.SequenceData.ZPos) { nInsertIndex = i + 1; break; } } sequencePlayList.Insert(nInsertIndex, data); } /// /// Adds the sequences specified by their names to the play list. /// Creation of sequence play data and addition of it to the list /// can be performed at the same time. /// /// 名前で指定したシーケンスを再生リストに追加します。 /// シーケンス再生データの作成と、リストへの追加を同時に行えます。 /// /// /// Sequence name to be added /// /// 追加するシーケンス名 /// public void AddPlaySeqData(String name) { AddPlaySeqData(CreatePlaySeqData(name)); } /// /// Sets the sequence time in the play list forward. /// Updates the scene data. /// /// 再生リストにあるシーケンスの時間を進めます。 /// シーンデータの更新関数です。 /// /// /// Time to be forwarded /// /// 進める時間 /// public void Update(TimeSpan elapsedGameTime) { foreach (SequencePlayData data in sequencePlayList) data.Update(elapsedGameTime); } /// /// Draws the sequence in the play list. /// /// 再生リストにあるシーケンスを描画します。 /// /// /// SpriteBatch /// /// スプラインバッチ /// /// /// Conversion information that affects the entire drawing target /// /// 描画対象すべてに影響する変換情報 /// public void Draw(SpriteBatch sb, DrawData baseDrawData) { foreach (SequencePlayData data in sequencePlayList) data.Draw(sb, baseDrawData); } /// /// Displays the pattern group specified by its name. /// /// 名前で指定したパターングループを表示します。 /// /// /// SpriteBatch /// /// スプラインバッチ /// /// /// Pattern group name /// /// パターングループの名前 /// /// /// Conversion information that affects the entire drawing target /// /// 描画対象すべてに影響する変換情報 /// public void DrawPattern(SpriteBatch sb, String name, DrawData baseDrawData) { PatternGroupData group = PatternGroupDictionary[name]; foreach (PatternObjectData pattern in group.PatternObjectList) pattern.Draw(sb, pattern.Data, baseDrawData); } /// /// Specifies a pattern group by its name and specifies a pattern object /// in this pattern group by its index to obtain the position information. /// /// パターングループを名前で指定し、 /// その内部にあるパターンオブジェクトをインデックスで指定。 /// 位置情報を取得します。 /// /// /// Pattern group name /// /// パターングループの名前 /// /// /// Pattern object ID /// /// パターンオブジェクトのID /// /// public Point GetPatternPosition(String name, int nObjectId) { return PatternGroupDictionary[name].PatternObjectList[nObjectId]. Data.Position; } } }