InnWriter.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // InnWriter.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 System.Collections.Generic;
  12. using Microsoft.Xna.Framework;
  13. using Microsoft.Xna.Framework.Graphics;
  14. using Microsoft.Xna.Framework.Content.Pipeline;
  15. using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
  16. using Microsoft.Xna.Framework.Content.Pipeline.Processors;
  17. using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
  18. using RolePlaying.Data;
  19. #endregion
  20. namespace RolePlaying.Processors
  21. {
  22. /// <summary>
  23. /// This class will be instantiated by the XNA Framework Content Pipeline
  24. /// to write the specified data type into binary .xnb format.
  25. ///
  26. /// This should be part of a Content Pipeline Extension Library project.
  27. /// </summary>
  28. [ContentTypeWriter]
  29. public class InnWriter : RolePlayingGameWriter<Inn>
  30. {
  31. WorldObjectWriter worldObjectWriter = null;
  32. protected override void Initialize(ContentCompiler compiler)
  33. {
  34. worldObjectWriter = compiler.GetTypeWriter(typeof(WorldObject))
  35. as WorldObjectWriter;
  36. base.Initialize(compiler);
  37. }
  38. protected override void Write(ContentWriter output, Inn value)
  39. {
  40. output.WriteRawObject<WorldObject>(value as WorldObject, worldObjectWriter);
  41. output.Write(value.ChargePerPlayer);
  42. output.Write(value.WelcomeMessage);
  43. output.Write(value.PaidMessage);
  44. output.Write(value.NotEnoughGoldMessage);
  45. output.Write(value.ShopkeeperTextureName);
  46. }
  47. }
  48. }