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);
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-53869.html