diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index ce3196f..37f5c35 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -14,10 +14,12 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis public Color printColor = Color.white; public void sendResponseCommand(string json) where T : IResponse, new() { + //如果找不到对应命令,则添加命令 if (mCommandContainer.Get>() == null) { mCommandContainer.Register(new ExcuteResponseCommand(new T())); } + //找到命令后添加命令 mCommandContainer.Get>().setJson(json); this.SendCommand(mCommandContainer.Get>()); } @@ -87,6 +89,10 @@ public class ExcuteResponseCommand : AbstractCommand where TResponse } } +/// +/// 发送数据 +/// +/// 发送数据格式 public class SendRequestCommand : AbstractCommand where TRequest : IRequest { public TRequest request; @@ -96,7 +102,6 @@ public class SendRequestCommand : AbstractCommand where TRequest : IRe } protected override void OnExecute() { - //此处需要修改 this.SendEvent(new RequestMsgEvent(request)); } public void setRequest(TRequest request) diff --git a/Assets/MsgTransmitTools/src/QFrameCopy.cs b/Assets/MsgTransmitTools/src/QFrameCopy.cs index 9fc8bd0..9ba5ce3 100644 --- a/Assets/MsgTransmitTools/src/QFrameCopy.cs +++ b/Assets/MsgTransmitTools/src/QFrameCopy.cs @@ -557,7 +557,6 @@ namespace QFrameworkCP #endregion #region IOC - public class IOCContainer { private Dictionary mInstances = new Dictionary(); @@ -597,26 +596,6 @@ namespace QFrameworkCP { } - public class EasyEvent : IEasyEvent - { - private Action mOnEvent = () => { }; - - public IUnRegister Register(Action onEvent) - { - mOnEvent += onEvent; - return new CustomUnRegister(() => { UnRegister(onEvent); }); - } - - public void UnRegister(Action onEvent) - { - mOnEvent -= onEvent; - } - - public void Trigger() - { - mOnEvent?.Invoke(); - } - } public class EasyEvent : IEasyEvent { @@ -639,48 +618,6 @@ namespace QFrameworkCP } } - public class EasyEvent : IEasyEvent - { - private Action mOnEvent = (t, k) => { }; - - public IUnRegister Register(Action onEvent) - { - mOnEvent += onEvent; - return new CustomUnRegister(() => { UnRegister(onEvent); }); - } - - public void UnRegister(Action onEvent) - { - mOnEvent -= onEvent; - } - - public void Trigger(T t, K k) - { - mOnEvent?.Invoke(t, k); - } - } - - public class EasyEvent : IEasyEvent - { - private Action mOnEvent = (t, k, s) => { }; - - public IUnRegister Register(Action onEvent) - { - mOnEvent += onEvent; - return new CustomUnRegister(() => { UnRegister(onEvent); }); - } - - public void UnRegister(Action onEvent) - { - mOnEvent -= onEvent; - } - - public void Trigger(T t, K k, S s) - { - mOnEvent?.Invoke(t, k, s); - } - } - public class EasyEvents { private static EasyEvents mGlobalEvents = new EasyEvents();