DownloadManager.DownloadCounter.DownloadCounterNode.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 loyalsoft. All rights reserved.
  4. // Homepage: http://www.game7000.com/
  5. // Feedback: http://www.game7000.com/
  6. //------------------------------------------------------------
  7. namespace GameFramework.Download
  8. {
  9. internal sealed partial class DownloadManager : GameFrameworkModule, IDownloadManager
  10. {
  11. private sealed partial class DownloadCounter
  12. {
  13. private sealed class DownloadCounterNode : IReference
  14. {
  15. private long m_DeltaLength;
  16. private float m_ElapseSeconds;
  17. public DownloadCounterNode()
  18. {
  19. m_DeltaLength = 0L;
  20. m_ElapseSeconds = 0f;
  21. }
  22. public long DeltaLength
  23. {
  24. get
  25. {
  26. return m_DeltaLength;
  27. }
  28. }
  29. public float ElapseSeconds
  30. {
  31. get
  32. {
  33. return m_ElapseSeconds;
  34. }
  35. }
  36. public static DownloadCounterNode Create()
  37. {
  38. return ReferencePool.Acquire<DownloadCounterNode>();
  39. }
  40. public void Update(float elapseSeconds, float realElapseSeconds)
  41. {
  42. m_ElapseSeconds += realElapseSeconds;
  43. }
  44. public void AddDeltaLength(int deltaLength)
  45. {
  46. m_DeltaLength += deltaLength;
  47. }
  48. public void Clear()
  49. {
  50. m_DeltaLength = 0L;
  51. m_ElapseSeconds = 0f;
  52. }
  53. }
  54. }
  55. }
  56. }