private void OnDownloadFailure(DownloadAgent sender, string errorMessage)
        {
            DownloadFailureEventArgs e = ReferencePool.Acquire <DownloadFailureEventArgs>();

            m_eventManager.Fire(this, e.Fill(sender.Task, errorMessage));
            Debug.Log("派发了下载失败的事件");
        }
        private void OnDownloadStart(DownloadAgent sender)
        {
            DownloadStartEventArgs e = ReferencePool.Acquire <DownloadStartEventArgs>();

            m_eventManager.Fire(this, e.Fill(sender.Task, sender.CurrentLength));
            Debug.Log("派发了下载开始的事件");
        }
        private void OnDownloadSuccess(DownloadAgent sender, int DownloadedLength)
        {
            DownloadSuccessEventArgs e = ReferencePool.Acquire <DownloadSuccessEventArgs>();

            m_eventManager.Fire(this, e.Fill(sender.Task, DownloadedLength));
            Debug.Log("派发了下载成功的事件");
        }
        /// <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);
        }