diff --git a/Assets/MsgTransmitTools/Socket.meta b/Assets/MsgTransmitTools/Socket.meta new file mode 100644 index 0000000..c45c83d --- /dev/null +++ b/Assets/MsgTransmitTools/Socket.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25e1e4fdb38352a4d83d79621f265e32 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MsgTransmitTools/src.meta b/Assets/MsgTransmitTools/src.meta new file mode 100644 index 0000000..bf23e96 --- /dev/null +++ b/Assets/MsgTransmitTools/src.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62f9969ded6e390488fc11942271ab03 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs similarity index 86% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/DataEventModel.cs rename to Assets/MsgTransmitTools/src/DataEventModel.cs index 5757654..ce3196f 100644 --- a/Assets/MsgTransmitTools/TCPClient/Script/Source/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -11,9 +11,8 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis { public IOCContainer mCommandContainer = new IOCContainer(); public UnityStringEvent onDataRecived = new UnityStringEvent(); - - - public void excuteResponseCommand(string json) where T : IResponse, new() + public Color printColor = Color.white; + public void sendResponseCommand(string json) where T : IResponse, new() { if (mCommandContainer.Get>() == null) { @@ -22,13 +21,14 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis mCommandContainer.Get>().setJson(json); this.SendCommand(mCommandContainer.Get>()); } + /// /// 开启接收指定数据 /// /// 数据格式类型 public void onReceive() where T : IResponse, new() { - onDataRecived.AddListener(excuteResponseCommand); + onDataRecived.AddListener(sendResponseCommand); } /// /// 关闭接收指定数据 @@ -36,8 +36,9 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis /// 数据格式类型 public void offReceive() where T : IResponse, new() { - onDataRecived.RemoveListener(excuteResponseCommand); + onDataRecived.RemoveListener(sendResponseCommand); } + /// /// 发送数据 /// @@ -63,6 +64,7 @@ public class ExcuteResponseCommand : AbstractCommand where TResponse { public string json; private TResponse response; + private Color printColor = Color.white; public ExcuteResponseCommand(TResponse response) { if (this.response == null) @@ -94,6 +96,7 @@ public class SendRequestCommand : AbstractCommand where TRequest : IRe } protected override void OnExecute() { + //此处需要修改 this.SendEvent(new RequestMsgEvent(request)); } public void setRequest(TRequest request) @@ -120,22 +123,6 @@ public interface IRequest { string toJson(); } - -//用于标准化通讯方案(具体链接管理,由外部类决定,本接口只提供开启链接跟关闭链接) -public interface IProtocol { - void linkServer(); - void closeServer(); -} -#endregion - -#region Extention -/* -public static class CanGetStateExtention { - public static void GetState(this IProtocol self) { - - } -} -*/ #endregion #region AbstractClass @@ -179,9 +166,11 @@ public struct ResponseMsgEvent res = res_; } }; -public struct RequestMsgEvent { +public struct RequestMsgEvent +{ public IRequest req; - public RequestMsgEvent(IRequest req_) { + public RequestMsgEvent(IRequest req_) + { req = req_; } } diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/DataEventModel.cs.meta b/Assets/MsgTransmitTools/src/DataEventModel.cs.meta similarity index 100% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/DataEventModel.cs.meta rename to Assets/MsgTransmitTools/src/DataEventModel.cs.meta diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/QFramework.cs b/Assets/MsgTransmitTools/src/QFramework.cs similarity index 100% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/QFramework.cs rename to Assets/MsgTransmitTools/src/QFramework.cs diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/QFramework.cs.meta b/Assets/MsgTransmitTools/src/QFramework.cs.meta similarity index 100% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/QFramework.cs.meta rename to Assets/MsgTransmitTools/src/QFramework.cs.meta