From 2141b9fee5dd43b25027ede456adf39375cef083 Mon Sep 17 00:00:00 2001 From: "DESKTOP-B25GA9E\\W35" <1733709035@qq.com> Date: Fri, 3 Mar 2023 14:22:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=A4=96=E9=83=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MsgTransmitTools/DataClass/BluetoothGateway.cs | 7 ++++--- .../ExtendLinkModel/HttpServer/HttpServerModel.cs | 6 +++--- .../ExtendLinkModel/HttpServer/HttpServerView.cs | 4 ++-- Assets/MsgTransmitTools/src/DataEventModel.cs | 12 +++++++++++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs index daf0db6..3852c65 100644 --- a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs +++ b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using UnityEngine; using LitJson; using System; +using JXSoft; -namespace JXSoft { - public struct BluetoothGateway:IResponse +namespace DYData { + public struct BluetoothGatewayData:IResponse { /// /// @@ -57,7 +58,7 @@ namespace JXSoft { { try { - BluetoothGateway blg = JsonMapper.ToObject(protocolData); + BluetoothGatewayData blg = JsonMapper.ToObject(protocolData); this.v = blg.v; this.time = blg.time; this.mid = blg.mid; diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs index b0ab03b..4c46663 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs @@ -11,7 +11,7 @@ using System.IO; namespace JXSoft { public class HttpServerModel : DataEventModel { - + public ServerState httpServerState = ServerState.Close; protected override void OnInit() { @@ -19,12 +19,12 @@ namespace JXSoft { public override void setLinkState(int linkState) { - + this.httpServerState = (ServerState)linkState; } public override int getLinkState() { - return 0; + return (int)httpServerState; } } public enum ServerState diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs index 828f88a..2c622b8 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs @@ -24,10 +24,10 @@ namespace JXSoft { void Start() { this.httpServer = this.GetUtility(); - this.RegisterMessageEvent(e => { + this.RegisterMessageEvent(e => { Debug.Log("收到消息:"+e.ip); }).UnRegisterWhenGameObjectDestroyed(gameObject); - this.GetModel().onReceive(); + this.GetModel().onReceive(); } // Update is called once per frame diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index 903709d..f11712c 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -182,7 +182,6 @@ namespace JXSoft { string toProtocolData(); } - public interface ILinkState { //当前链接状态 int getLinkState(); @@ -192,6 +191,8 @@ namespace JXSoft { /// 目标链接状态 /// 是否成功 bool transform(ILinkState invokeState); + + //DataEventModel getEventModel(); } #endregion @@ -352,4 +353,13 @@ namespace BaseLinkState #endregion +} + + +/// +/// this Package improved a base example of server open & close +/// you can also create class implements ILinkState. +/// +namespace BaseServerState { + } \ No newline at end of file