Disposer.cs 424 B

123456789101112131415161718192021222324252627282930
  1. using Model;
  2. namespace Hotfix
  3. {
  4. public abstract class Disposer : Object, IDisposable2
  5. {
  6. public long Id { get; set; }
  7. public bool IsFromPool { get; set; }
  8. protected Disposer()
  9. {
  10. this.Id = IdGenerater.GenerateId();
  11. }
  12. protected Disposer(long id)
  13. {
  14. this.Id = id;
  15. }
  16. public virtual void Dispose()
  17. {
  18. this.Id = 0;
  19. if (this.IsFromPool)
  20. {
  21. Hotfix.ObjectPool.Recycle(this);
  22. }
  23. }
  24. }
  25. }