#region File Description //----------------------------------------------------------------------------- // Store.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; #endregion namespace RolePlayingGameData { /// /// A gear store, where the party can buy and sell gear, organized into categories. /// public class Store : WorldObject { #region Shopping Data /// /// A purchasing multiplier applied to the price of all gear. /// private float buyMultiplier; /// /// A purchasing multiplier applied to the price of all gear. /// public float BuyMultiplier { get { return buyMultiplier; } set { buyMultiplier = value; } } /// /// A sell-back multiplier applied to the price of all gear. /// private float sellMultiplier; /// /// A sell-back multiplier applied to the price of all gear. /// public float SellMultiplier { get { return sellMultiplier; } set { sellMultiplier = value; } } /// /// The categories of gear in this store. /// private List storeCategories = new List(); /// /// The categories of gear in this store. /// public List StoreCategories { get { return storeCategories; } set { storeCategories = value; } } #endregion #region Menu Messages /// /// The message shown when the party enters the store. /// private string welcomeMessage; /// /// The message shown when the party enters the store. /// public string WelcomeMessage { get { return welcomeMessage; } set { welcomeMessage = value; } } #endregion #region Graphics Data /// /// The content path and name of the texture for the shopkeeper. /// private string shopkeeperTextureName; /// /// The content path and name of the texture for the shopkeeper. /// public string ShopkeeperTextureName { get { return shopkeeperTextureName; } set { shopkeeperTextureName = value; } } /// /// The texture for the shopkeeper. /// private Texture2D shopkeeperTexture; /// /// The texture for the shopkeeper. /// [ContentSerializerIgnore] public Texture2D ShopkeeperTexture { get { return shopkeeperTexture; } } #endregion #region Content Type Reader /// /// Reads an Store object from the content pipeline. /// public class StoreReader : ContentTypeReader { protected override Store Read(ContentReader input, Store existingInstance) { Store store = existingInstance; if (store == null) { store = new Store(); } input.ReadRawObject(store as WorldObject); store.BuyMultiplier = input.ReadSingle(); store.SellMultiplier = input.ReadSingle(); store.StoreCategories.AddRange(input.ReadObject>()); store.WelcomeMessage = input.ReadString(); store.ShopkeeperTextureName = input.ReadString(); store.shopkeeperTexture = input.ContentManager.Load( System.IO.Path.Combine(@"Textures\Characters\Portraits", store.ShopkeeperTextureName)); return store; } } #endregion } }