Browse Source

增加发送端指定用类

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
2b3491dc75
  1. 2
      Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs
  2. 4
      Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs

2
Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs

@ -13,7 +13,7 @@ public class TCPClientExample : MonoBehaviour,ITCPClient @@ -13,7 +13,7 @@ public class TCPClientExample : MonoBehaviour,ITCPClient
Debug.Log("TestGetMsg:"+e.msg);
Debug.Log("IpAddress:"+sender);
//应答
this.sendRequest(new StringRequest("Received!"));
this.sendRequest<StringRequest,TCPClientModel>(new StringRequest("Received!"));
//取消接收该数据
this.offReceive<YourResponse>();
});

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

@ -128,6 +128,10 @@ namespace JXSoft { @@ -128,6 +128,10 @@ namespace JXSoft {
{
TCPMangerArchitecture.Interface.GetModel<TCPClientModel>().sendRequest(request);
}
public static void sendRequest<TRequest,TDataModel>(this ITCPClient self, TRequest request) where TRequest : IRequest, new() where TDataModel:DataEventModel
{
TCPMangerArchitecture.Interface.GetModel<TDataModel>().sendRequest(request);
}
}
}

Loading…
Cancel
Save