123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- #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
- {
- /// <summary>
- /// A gear store, where the party can buy and sell gear, organized into categories.
- /// </summary>
- public class Store : WorldObject
- {
- #region Shopping Data
- /// <summary>
- /// A purchasing multiplier applied to the price of all gear.
- /// </summary>
- private float buyMultiplier;
- /// <summary>
- /// A purchasing multiplier applied to the price of all gear.
- /// </summary>
- public float BuyMultiplier
- {
- get { return buyMultiplier; }
- set { buyMultiplier = value; }
- }
- /// <summary>
- /// A sell-back multiplier applied to the price of all gear.
- /// </summary>
- private float sellMultiplier;
- /// <summary>
- /// A sell-back multiplier applied to the price of all gear.
- /// </summary>
- public float SellMultiplier
- {
- get { return sellMultiplier; }
- set { sellMultiplier = value; }
- }
- /// <summary>
- /// The categories of gear in this store.
- /// </summary>
- private List<StoreCategory> storeCategories = new List<StoreCategory>();
- /// <summary>
- /// The categories of gear in this store.
- /// </summary>
- public List<StoreCategory> StoreCategories
- {
- get { return storeCategories; }
- set { storeCategories = value; }
- }
- #endregion
- #region Menu Messages
- /// <summary>
- /// The message shown when the party enters the store.
- /// </summary>
- private string welcomeMessage;
- /// <summary>
- /// The message shown when the party enters the store.
- /// </summary>
- public string WelcomeMessage
- {
- get { return welcomeMessage; }
- set { welcomeMessage = value; }
- }
- #endregion
- #region Graphics Data
- /// <summary>
- /// The content path and name of the texture for the shopkeeper.
- /// </summary>
- private string shopkeeperTextureName;
- /// <summary>
- /// The content path and name of the texture for the shopkeeper.
- /// </summary>
- public string ShopkeeperTextureName
- {
- get { return shopkeeperTextureName; }
- set { shopkeeperTextureName = value; }
- }
- /// <summary>
- /// The texture for the shopkeeper.
- /// </summary>
- private Texture2D shopkeeperTexture;
- /// <summary>
- /// The texture for the shopkeeper.
- /// </summary>
- [ContentSerializerIgnore]
- public Texture2D ShopkeeperTexture
- {
- get { return shopkeeperTexture; }
- }
- #endregion
- #region Content Type Reader
- /// <summary>
- /// Reads an Store object from the content pipeline.
- /// </summary>
- public class StoreReader : ContentTypeReader<Store>
- {
- protected override Store Read(ContentReader input, Store existingInstance)
- {
- Store store = existingInstance;
- if (store == null)
- {
- store = new Store();
- }
- input.ReadRawObject<WorldObject>(store as WorldObject);
- store.BuyMultiplier = input.ReadSingle();
- store.SellMultiplier = input.ReadSingle();
- store.StoreCategories.AddRange(input.ReadObject<List<StoreCategory>>());
- store.WelcomeMessage = input.ReadString();
- store.ShopkeeperTextureName = input.ReadString();
- store.shopkeeperTexture = input.ContentManager.Load<Texture2D>(
- System.IO.Path.Combine(@"Textures\Characters\Portraits",
- store.ShopkeeperTextureName));
- return store;
- }
- }
- #endregion
- }
- }
|