#region File Description
//-----------------------------------------------------------------------------
// Inn.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace RolePlayingGameData
{
///
/// An inn in the game world, where the party can rest and restore themselves.
///
public class Inn : WorldObject
{
#region Operation
///
/// The amount that the party has to pay for each member to stay.
///
private int chargePerPlayer;
///
/// The amount that the party has to pay for each member to stay.
///
public int ChargePerPlayer
{
get { return chargePerPlayer; }
set { chargePerPlayer = value; }
}
#endregion
#region Menu Message Data
///
/// The message shown when the player enters the inn.
///
private string welcomeMessage;
///
/// The message shown when the player enters the inn.
///
public string WelcomeMessage
{
get { return welcomeMessage; }
set { welcomeMessage = value; }
}
///
/// The message shown when the party successfully pays to stay the night.
///
private string paidMessage;
///
/// The message shown when the party successfully pays to stay the night.
///
public string PaidMessage
{
get { return paidMessage; }
set { paidMessage = value; }
}
///
/// The message shown when the party tries to stay but lacks the funds.
///
private string notEnoughGoldMessage;
///
/// The message shown when the party tries to stay but lacks the funds.
///
public string NotEnoughGoldMessage
{
get { return notEnoughGoldMessage; }
set { notEnoughGoldMessage = value; }
}
#endregion
#region Graphics Data
///
/// The content name of the texture for the shopkeeper.
///
private string shopkeeperTextureName;
///
/// The content 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 Inn object from the content pipeline.
///
public class InnReader : ContentTypeReader
{
protected override Inn Read(ContentReader input, Inn existingInstance)
{
Inn inn = existingInstance;
if (inn == null)
{
inn = new Inn();
}
input.ReadRawObject(inn as WorldObject);
inn.ChargePerPlayer = input.ReadInt32();
inn.WelcomeMessage = input.ReadString();
inn.PaidMessage = input.ReadString();
inn.NotEnoughGoldMessage = input.ReadString();
inn.ShopkeeperTextureName = input.ReadString();
inn.shopkeeperTexture = input.ContentManager.Load(
System.IO.Path.Combine(@"Textures\Characters\Portraits",
inn.ShopkeeperTextureName));
return inn;
}
}
#endregion
}
}