WorldEntry.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // WorldEntry.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using Microsoft.Xna.Framework;
  12. using Microsoft.Xna.Framework.Content;
  13. #endregion
  14. namespace RolePlayingGameData
  15. {
  16. /// <summary>
  17. /// A description of a piece of content, including the name of the map it's on.
  18. /// </summary>
  19. public class WorldEntry<T> : MapEntry<T> where T : ContentObject
  20. {
  21. /// <summary>
  22. /// The name of the map where the content is added.
  23. /// </summary>
  24. private string mapContentName;
  25. /// <summary>
  26. /// The name of the map where the content is added.
  27. /// </summary>
  28. public string MapContentName
  29. {
  30. get { return mapContentName; }
  31. set { mapContentName = value; }
  32. }
  33. #region Content Type Reader
  34. /// <summary>
  35. /// Reads a WorldEntry object from the content pipeline.
  36. /// </summary>
  37. public class WorldEntryReader : ContentTypeReader<WorldEntry<T>>
  38. {
  39. /// <summary>
  40. /// Reads a WorldEntry object from the content pipeline.
  41. /// </summary>
  42. protected override WorldEntry<T> Read(ContentReader input,
  43. WorldEntry<T> existingInstance)
  44. {
  45. WorldEntry<T> desc = existingInstance;
  46. if (desc == null)
  47. {
  48. desc = new WorldEntry<T>();
  49. }
  50. input.ReadRawObject<MapEntry<T>>(desc as MapEntry<T>);
  51. desc.MapContentName = input.ReadString();
  52. return desc;
  53. }
  54. }
  55. #endregion
  56. }
  57. }