Browse Source

sendRequestCommand中Command去除

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
b69590bb3a
  1. 2
      Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs
  2. 2
      Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs
  3. 16
      Assets/MsgTransmitTools/src/DataEventModel.cs

2
Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs

@ -53,7 +53,7 @@ namespace JXSoft {
{ {
Debug.Log("TCP链接成功"); Debug.Log("TCP链接成功");
this.GetModel<TCPClientModel>().onReceive<LinkSuccessResponse>(); this.GetModel<TCPClientModel>().onReceive<LinkSuccessResponse>();
this.GetModel<TCPClientModel>().sendRequestCommand(new LinkTCPRequest(deviceId)); this.GetModel<TCPClientModel>().sendRequest(new LinkTCPRequest(deviceId));
onTCPLinkSuccess.Invoke(); onTCPLinkSuccess.Invoke();
} }
if (e.linkState == (int)TCPLinkState.LinkFaild) if (e.linkState == (int)TCPLinkState.LinkFaild)

2
Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs

@ -48,7 +48,7 @@ namespace JXSoft {
{ {
Debug.Log("UDP链接成功"); Debug.Log("UDP链接成功");
this.GetModel<UDPEventModel>().onReceive<LinkSuccessResponse>(); this.GetModel<UDPEventModel>().onReceive<LinkSuccessResponse>();
this.GetModel<UDPEventModel>().sendRequestCommand(new LinkUDPRequest(deviceId)); this.GetModel<UDPEventModel>().sendRequest(new LinkUDPRequest(deviceId));
onUDPLinkSuccess.Invoke(); onUDPLinkSuccess.Invoke();
} }
if (e.state == UDPLinkState.LinkFaild) if (e.state == UDPLinkState.LinkFaild)

16
Assets/MsgTransmitTools/src/DataEventModel.cs

@ -19,7 +19,7 @@ namespace JXSoft {
public Color printColor = Color.white; public Color printColor = Color.white;
#region ReceiveFunctions #region ReceiveFunctions
public void sendResponseCommand<T>(string json) where T : IResponse, new() public void sendResponse<T>(string json) where T : IResponse, new()
{ {
//如果找不到对应命令,则添加命令 //如果找不到对应命令,则添加命令
if (mCommandContainer.Get<ExcuteResponseCommand<T>>() == null) if (mCommandContainer.Get<ExcuteResponseCommand<T>>() == null)
@ -36,7 +36,7 @@ namespace JXSoft {
/// <typeparam name="T">数据格式类型</typeparam> /// <typeparam name="T">数据格式类型</typeparam>
public void onReceive<T>() where T : IResponse, new() public void onReceive<T>() where T : IResponse, new()
{ {
onDataRecived.AddListener(sendResponseCommand<T>); onDataRecived.AddListener(sendResponse<T>);
} }
/// <summary> /// <summary>
/// 关闭接收指定数据 /// 关闭接收指定数据
@ -44,7 +44,7 @@ namespace JXSoft {
/// <typeparam name="T">数据格式类型</typeparam> /// <typeparam name="T">数据格式类型</typeparam>
public void offReceive<T>() where T : IResponse, new() public void offReceive<T>() where T : IResponse, new()
{ {
onDataRecived.RemoveListener(sendResponseCommand<T>); onDataRecived.RemoveListener(sendResponse<T>);
} }
#endregion #endregion
@ -54,7 +54,7 @@ namespace JXSoft {
/// </summary> /// </summary>
/// <typeparam name="T">数据类型</typeparam> /// <typeparam name="T">数据类型</typeparam>
/// <param name="request">请求数据</param> /// <param name="request">请求数据</param>
public void sendRequestCommand<T>(T request) where T : IRequest public void sendRequest<T>(T request) where T : IRequest
{ {
if (mCommandContainer.Get<SendRequestCommand<T>>() == null) if (mCommandContainer.Get<SendRequestCommand<T>>() == null)
{ {
@ -101,8 +101,6 @@ namespace JXSoft {
#endregion #endregion
} }
#region Command #region Command
/// <summary> /// <summary>
/// 处理响应数据,添加对应的Command进行处理,需要提前生成命令池 /// 处理响应数据,添加对应的Command进行处理,需要提前生成命令池
@ -230,7 +228,11 @@ namespace JXSoft {
} }
#endregion #endregion
#region
public static class CanRegistMessageExtention {
}
#endregion
#region event #region event
public struct ResponseMsgEvent public struct ResponseMsgEvent

Loading…
Cancel
Save