#region File Description //----------------------------------------------------------------------------- // QuestLine.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.IO; using Microsoft.Xna.Framework.Content; #endregion namespace RolePlayingGameData { /// /// A line of quests, presented to the player in order. /// /// /// In other words, only one quest is presented at a time and /// must be competed before the line can continue. /// public class QuestLine : ContentObject #if WINDOWS , ICloneable #endif { /// /// The name of the quest line. /// private string name; /// /// The name of the quest line. /// public string Name { get { return name; } set { name = value; } } /// /// An ordered list of content names of quests that will be presented in order. /// private List questContentNames = new List(); /// /// An ordered list of content names of quests that will be presented in order. /// public List QuestContentNames { get { return questContentNames; } set { questContentNames = value; } } /// /// An ordered list of quests that will be presented in order. /// private List quests = new List(); /// /// An ordered list of quests that will be presented in order. /// [ContentSerializerIgnore] public List Quests { get { return quests; } } #region Content Type Reader /// /// Reads a QuestLine object from the content pipeline. /// public class QuestLineReader : ContentTypeReader { /// /// Reads a QuestLine object from the content pipeline. /// protected override QuestLine Read(ContentReader input, QuestLine existingInstance) { QuestLine questLine = existingInstance; if (questLine == null) { questLine = new QuestLine(); } questLine.AssetName = input.AssetName; questLine.Name = input.ReadString(); questLine.QuestContentNames.AddRange(input.ReadObject>()); foreach (string contentName in questLine.QuestContentNames) { questLine.quests.Add(input.ContentManager.Load( Path.Combine("Quests", contentName))); } return questLine; } } #endregion #region ICloneable Members public object Clone() { QuestLine questLine = new QuestLine(); questLine.AssetName = AssetName; questLine.name = name; questLine.questContentNames.AddRange(questContentNames); foreach (Quest quest in quests) { questLine.quests.Add(quest.Clone() as Quest); } return questLine; } #endregion } }