Frames.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.IO;
  2. using System.Collections.Generic;
  3. namespace LibraryEditor
  4. {
  5. public class FrameSet : Dictionary<MirAction, Frame>
  6. {
  7. public FrameSet() { }
  8. public FrameSet(IDictionary<MirAction, Frame> dictionary) : base (dictionary) { }
  9. public static FrameSet DefaultMonsterFrameSet = new FrameSet
  10. {
  11. { MirAction.Standing, new Frame(0, 4, 0, 500) },
  12. { MirAction.Walking, new Frame(32, 6, 0, 100) },
  13. { MirAction.Attack1, new Frame(80, 6, 0, 100) },
  14. { MirAction.Struck, new Frame(128, 2, 0, 200) },
  15. { MirAction.Die, new Frame(144, 10, 0, 100) },
  16. { MirAction.Dead, new Frame(153, 1, 9, 1000) },
  17. { MirAction.Revive, new Frame(144, 10, 0, 100) { Reverse = true } }
  18. };
  19. public static FrameSet DefaultNPCFrameSet = new FrameSet
  20. {
  21. { MirAction.Standing, new Frame(0, 4, 0, 450) },
  22. { MirAction.Harvest, new Frame(12, 10, 0, 200) }
  23. };
  24. }
  25. public class Frame
  26. {
  27. public int Start { get; set; }
  28. public int Count { get; set; }
  29. public int Skip { get; set; }
  30. public int Interval { get; set; }
  31. public int EffectStart { get; set; }
  32. public int EffectCount { get; set; }
  33. public int EffectSkip { get; set; }
  34. public int EffectInterval { get; set; }
  35. public bool Reverse { get; set; }
  36. public bool Blend { get; set; }
  37. public int OffSet
  38. {
  39. get { return Count + Skip; }
  40. }
  41. public Frame(int start, int count, int skip, int interval, int effectstart = 0, int effectcount = 0, int effectskip = 0, int effectinterval = 0)
  42. {
  43. Start = start;
  44. Count = count;
  45. Skip = skip;
  46. Interval = interval;
  47. EffectStart = effectstart;
  48. EffectCount = effectcount;
  49. EffectSkip = effectskip;
  50. EffectInterval = effectinterval;
  51. }
  52. public Frame(BinaryReader reader)
  53. {
  54. Start = reader.ReadInt32();
  55. Count = reader.ReadInt32();
  56. Skip = reader.ReadInt32();
  57. Interval = reader.ReadInt32();
  58. EffectStart = reader.ReadInt32();
  59. EffectCount = reader.ReadInt32();
  60. EffectSkip = reader.ReadInt32();
  61. EffectInterval = reader.ReadInt32();
  62. Reverse = reader.ReadBoolean();
  63. Blend = reader.ReadBoolean();
  64. }
  65. public void Save(BinaryWriter writer)
  66. {
  67. writer.Write(Start);
  68. writer.Write(Count);
  69. writer.Write(Skip);
  70. writer.Write(Interval);
  71. writer.Write(EffectStart);
  72. writer.Write(EffectCount);
  73. writer.Write(EffectSkip);
  74. writer.Write(EffectInterval);
  75. writer.Write(Reverse);
  76. writer.Write(Blend);
  77. }
  78. }
  79. }