diff --git a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs index 6590d4a..daf0db6 100644 --- a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs +++ b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs @@ -5,7 +5,7 @@ using LitJson; using System; namespace JXSoft { - public class BluetoothGateway:IResponse + public struct BluetoothGateway:IResponse { /// /// @@ -34,10 +34,6 @@ namespace JXSoft { private string exceptionMsg; - public BluetoothGateway() { - - } - public string findDataByMac(string mac) { foreach (List deviceMsg in devices) { diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs index 6674ada..828f88a 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs @@ -24,10 +24,8 @@ namespace JXSoft { void Start() { this.httpServer = this.GetUtility(); - this.RegisterEvent(e => { - if (e.res.GetType() == typeof(BluetoothGateway)) { - // - } + this.RegisterMessageEvent(e => { + Debug.Log("收到消息:"+e.ip); }).UnRegisterWhenGameObjectDestroyed(gameObject); this.GetModel().onReceive(); } diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index 2b40965..903709d 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -228,9 +228,16 @@ namespace JXSoft { } #endregion - #region - public static class CanRegistMessageExtention { - + #region Extention + public static class CanRegistMessageExtention { + public static IUnRegister RegisterMessageEvent(this ICanRegisterEvent self, Action onEvent) + { + return self.GetArchitecture().RegisterEvent(e=> { + if (e.res.GetType() == typeof(TResponse)) { + onEvent.Invoke((TResponse)e.res); + } + }); + } } #endregion