/// <summary> /// 增加下载代理辅助器 /// </summary> /// <param name="downloadAgentHelper">要增加的下载代理辅助器</param> public void AddDownloadAgentHelper(DownloadAgentHelperBase downloadAgentHelper) { //使用辅助器来创建下载代理 DownloadAgent agent = new DownloadAgent(downloadAgentHelper); //往下载代理的委托里注册方法 agent.DownloadAgentStart += OnDownloadStart; agent.DownloadAgentUpdate += OnDownloadUpdate; agent.DownloadAgentSuccess += OnDownloadSuccess; agent.DownloadAgentFailure += OnDownloadFailure; //往任务池里增加下载代理 m_TaskPool.AddAgent(agent); }
public DownloadAgent(DownloadAgentHelperBase downloadAgentHelper) { if (downloadAgentHelper == null) { Debug.LogError("用来构造下载任务代理的辅助器为空"); } m_Helper = downloadAgentHelper; Task = null; m_FileStream = null; m_WaitFlushSize = 0; WaitTime = 0f; StartLength = 0; DownloadedSize = 0; SavedLength = 0; m_Disposed = false; DownloadAgentStart = null; DownloadAgentUpdate = null; DownloadAgentSuccess = null; DownloadAgentFailure = null; }