AssetAsyncAgent.cs 734 B

123456789101112131415161718192021222324252627282930
  1. namespace XGame.Framework.Asset
  2. {
  3. internal class AssetAsyncAgent : IAssetAsyncAgent
  4. {
  5. public IAssetAsync AssetAsync { get; private set; }
  6. public AgentStatus Start(IAssetAsync assetAsync)
  7. {
  8. //Assert.IsNotNull(assetAsync);
  9. if (assetAsync == null)
  10. return AgentStatus.Done;
  11. assetAsync.Start();
  12. return assetAsync.IsCompleted ? AgentStatus.Done : AgentStatus.CanResume;
  13. }
  14. public void Stop()
  15. {
  16. if (AssetAsync != null && AssetAsync.IsCompleted)
  17. {
  18. }
  19. AssetAsync = null;
  20. }
  21. public void Dispose()
  22. {
  23. AssetAsync = null;
  24. }
  25. }
  26. }