AJsonSerializationVersionControl.cs 489 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using UnityEngine;
  3. namespace wf.Serialization
  4. {
  5. [Serializable]
  6. public abstract class AJsonSerializationVersionControl : ISerializationCallbackReceiver
  7. {
  8. public AJsonSerializationVersionControl()
  9. {
  10. this.version = this.FixVersion;
  11. }
  12. public abstract int FixVersion { get; }
  13. public virtual void OnAfterDeserialize()
  14. {
  15. }
  16. public virtual void OnBeforeSerialize()
  17. {
  18. this.version = this.FixVersion;
  19. }
  20. [SerializeField]
  21. public int version;
  22. }
  23. }