//==========================
// - 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);
}
}
Manager Of Managers(五)RequestManager
最新推荐文章于 2024-02-21 20:34:02 发布