Manager Of Managers(五)RequestManager

    技术2024-12-23  13

    //========================== // - FileName: RequestManager.cs // - Created: true. // - CreateTime: 2020/06/25 23:54:34 // - Email: 1670328571@qq.com // - Region: China WUHAN // - Description: //========================== using ShareProject; using System.Collections; using System.Collections.Generic; using UnityEngine; public class RequestManager:BaseManager { private Dictionary<ActionCode, BaseRequest> requestDic = new Dictionary<ActionCode, BaseRequest>(); public RequestManager(GameManager gameManager):base(gameManager) { } //将自身传递 public void AddRequst(ActionCode actionCode, BaseRequest baseRequest) { requestDic.Add(actionCode, baseRequest); } //移除 public void RemoveRequst(ActionCode actionCode) { requestDic.Remove(actionCode); } //响应 public void HandleReponse(ActionCode actionCode, string data) { BaseRequest request = requestDic.TryGet<ActionCode, BaseRequest>(actionCode); //处理服务器的响应 if (request == null) { Debug.LogError("无法得到 ActionCode[" + actionCode + "]对应的类"); return; } request.OnResponse(data); } }
    Processed: 0.010, SQL: 9