private void OnWebRequestSuccess(WebRequestAgent sender, byte[] webResponseBytes) { WebRequestSuccessEventArgs e = ReferencePool.Acquire <WebRequestSuccessEventArgs>(); m_eventManager.Fire(this, e.Fill(sender.Task.UserData, sender.Task.SerialId, sender.Task.WebRequestUri, webResponseBytes)); Debug.Log("派发了Web请求成功的事件"); }
private void OnWebRequestFailure(WebRequestAgent sender, string errorMessage) { WebRequestStartEventArgs e = ReferencePool.Acquire <WebRequestStartEventArgs>(); m_eventManager.Fire(this, e.Fill(sender.Task.UserData, sender.Task.SerialId, sender.Task.WebRequestUri)); Debug.Log("派发了Web请求失败的事件"); }
/// <summary> /// 增加 Web 请求代理辅助器 /// </summary> /// <param name="webRequestAgentHelper">要增加的 Web 请求代理辅助器</param> public void AddWebRequestAgentHelper(WebRequestAgentHelperBase webRequestAgentHelper) { WebRequestAgent agent = new WebRequestAgent(webRequestAgentHelper); agent.WebRequestAgentStart += OnWebRequestStart; agent.WebRequestAgentSuccess += OnWebRequestSuccess; agent.WebRequestAgentFailure += OnWebRequestFailure; m_TaskPool.AddAgent(agent); }