#region File Description //----------------------------------------------------------------------------- // WeightedContentEntry.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using Microsoft.Xna.Framework.Content; #endregion namespace RolePlayingGameData { /// /// A description of a piece of content, quantity and weight for various purposes. /// public class WeightedContentEntry : ContentEntry where T : ContentObject { /// /// The weight of this content within the group, for statistical distribution. /// private int weight; /// /// The weight of this content within the group, for statistical distribution. /// public int Weight { get { return weight; } set { weight = value; } } #region Content Type Reader /// /// Reads a WeightedContentEntry object from the content pipeline. /// public class WeightedContentEntryReader : ContentTypeReader> { /// /// Reads a WeightedContentEntry object from the content pipeline. /// protected override WeightedContentEntry Read(ContentReader input, WeightedContentEntry existingInstance) { WeightedContentEntry entry = existingInstance; if (entry == null) { entry = new WeightedContentEntry(); } input.ReadRawObject>(entry as ContentEntry); entry.Weight = input.ReadInt32(); return entry; } } #endregion } }