|
|
@ -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 |
|
|
|