Browse Source

delete

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
cf325681bd
  1. 7
      Assets/MsgTransmitTools/src/DataEventModel.cs
  2. 63
      Assets/MsgTransmitTools/src/QFrameCopy.cs

7
Assets/MsgTransmitTools/src/DataEventModel.cs

@ -14,10 +14,12 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis
public Color printColor = Color.white; public Color printColor = Color.white;
public void sendResponseCommand<T>(string json) where T : IResponse, new() public void sendResponseCommand<T>(string json) where T : IResponse, new()
{ {
//如果找不到对应命令,则添加命令
if (mCommandContainer.Get<ExcuteResponseCommand<T>>() == null) if (mCommandContainer.Get<ExcuteResponseCommand<T>>() == null)
{ {
mCommandContainer.Register(new ExcuteResponseCommand<T>(new T())); mCommandContainer.Register(new ExcuteResponseCommand<T>(new T()));
} }
//找到命令后添加命令
mCommandContainer.Get<ExcuteResponseCommand<T>>().setJson(json); mCommandContainer.Get<ExcuteResponseCommand<T>>().setJson(json);
this.SendCommand(mCommandContainer.Get<ExcuteResponseCommand<T>>()); this.SendCommand(mCommandContainer.Get<ExcuteResponseCommand<T>>());
} }
@ -87,6 +89,10 @@ public class ExcuteResponseCommand<TResponse> : AbstractCommand where TResponse
} }
} }
/// <summary>
/// 发送数据
/// </summary>
/// <typeparam name="TRequest">发送数据格式</typeparam>
public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRequest public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRequest
{ {
public TRequest request; public TRequest request;
@ -96,7 +102,6 @@ public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRe
} }
protected override void OnExecute() protected override void OnExecute()
{ {
//此处需要修改
this.SendEvent(new RequestMsgEvent(request)); this.SendEvent(new RequestMsgEvent(request));
} }
public void setRequest(TRequest request) public void setRequest(TRequest request)

63
Assets/MsgTransmitTools/src/QFrameCopy.cs

@ -557,7 +557,6 @@ namespace QFrameworkCP
#endregion #endregion
#region IOC #region IOC
public class IOCContainer public class IOCContainer
{ {
private Dictionary<Type, object> mInstances = new Dictionary<Type, object>(); private Dictionary<Type, object> mInstances = new Dictionary<Type, object>();
@ -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<T> : IEasyEvent public class EasyEvent<T> : IEasyEvent
{ {
@ -639,48 +618,6 @@ namespace QFrameworkCP
} }
} }
public class EasyEvent<T, K> : IEasyEvent
{
private Action<T, K> mOnEvent = (t, k) => { };
public IUnRegister Register(Action<T, K> onEvent)
{
mOnEvent += onEvent;
return new CustomUnRegister(() => { UnRegister(onEvent); });
}
public void UnRegister(Action<T, K> onEvent)
{
mOnEvent -= onEvent;
}
public void Trigger(T t, K k)
{
mOnEvent?.Invoke(t, k);
}
}
public class EasyEvent<T, K, S> : IEasyEvent
{
private Action<T, K, S> mOnEvent = (t, k, s) => { };
public IUnRegister Register(Action<T, K, S> onEvent)
{
mOnEvent += onEvent;
return new CustomUnRegister(() => { UnRegister(onEvent); });
}
public void UnRegister(Action<T, K, S> onEvent)
{
mOnEvent -= onEvent;
}
public void Trigger(T t, K k, S s)
{
mOnEvent?.Invoke(t, k, s);
}
}
public class EasyEvents public class EasyEvents
{ {
private static EasyEvents mGlobalEvents = new EasyEvents(); private static EasyEvents mGlobalEvents = new EasyEvents();

Loading…
Cancel
Save