AnimationInfoReader.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // AnimationInfoReader.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.Content;
  14. using Microsoft.Xna.Framework.Graphics;
  15. using TRead = MovipaLibrary.AnimationInfo;
  16. #endregion
  17. namespace MovipaLibrary
  18. {
  19. /// <summary>
  20. /// This class restores the xnb file converted by
  21. /// the content pipeline to the value of AnimationInfoReader.
  22. /// This ContentTypeReader must be the same as the runtime
  23. /// specified in ContentTypeWriter that was used to write the xnb
  24. /// whose type is AnimationInfoReader.
  25. ///
  26. /// ContentPipelineで変換されたxnbファイルをAnimationInfoReaderの値に復元します。
  27. /// このContentTypeReaderはAnimationInfoReader型のxnbを書き込む際に使用した
  28. /// ContentTypeWriterで指定されたランタイムと同じである必要があります。
  29. /// </summary>
  30. public class AnimationInfoReader : ContentTypeReader<TRead>
  31. {
  32. /// <summary>
  33. /// Reads AnimationInfo from the xnb file.
  34. ///
  35. /// xnbファイルからAnimationInfoを読み込みます。
  36. /// </summary>
  37. protected override TRead Read(ContentReader input, TRead existingInstance)
  38. {
  39. TRead info = new TRead();
  40. // Reads AnimationInfo.
  41. //
  42. // AnimationInfoを読み込みます。
  43. ReadAnimationInfo(input, info);
  44. return info;
  45. }
  46. /// <summary>
  47. /// Reads AnimationInfo.
  48. ///
  49. /// AnimationInfoを読み込みます。
  50. /// </summary>
  51. public static void ReadAnimationInfo(ContentReader input, TRead info)
  52. {
  53. info.Category = input.ReadObject<AnimationInfo.AnimationInfoCategory>();
  54. info.Name = input.ReadString();
  55. info.Size = input.ReadObject<Point>();
  56. }
  57. }
  58. }