From d358935a5e7f6aa95d93aba54c74ce49a44b0dee Mon Sep 17 00:00:00 2001 From: "DESKTOP-B25GA9E\\W35" <1733709035@qq.com> Date: Thu, 16 Feb 2023 18:10:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=93=BE=E6=8E=A5=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/MsgTransmitTools/src/DataEventModel.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index f353f55..56f4c33 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -13,6 +13,9 @@ namespace JXSoft { public IOCContainer mCommandContainer = new IOCContainer(); public UnityStringEvent onDataRecived = new UnityStringEvent(); public Color printColor = Color.white; + private int linkStatus = 0; + + #region ReceiveFunctions public void sendResponseCommand(string json) where T : IResponse, new() { //如果找不到对应命令,则添加命令 @@ -24,7 +27,6 @@ namespace JXSoft { mCommandContainer.Get>().setJson(json); this.SendCommand(mCommandContainer.Get>()); } - /// /// 开启接收指定数据 /// @@ -41,7 +43,9 @@ namespace JXSoft { { onDataRecived.RemoveListener(sendResponseCommand); } + #endregion + #region RequestFunctions /// /// 发送数据 /// @@ -56,6 +60,18 @@ namespace JXSoft { mCommandContainer.Get>().setRequest(request); this.SendCommand(mCommandContainer.Get>()); } + #endregion + + #region LinkStatusManage + public virtual void setLinkStatus(int linkStatus) { + this.linkStatus = linkStatus; + this.SendEvent(new LinkStateChangedEvent(linkStatus)); + } + + public virtual int getLinkStatus() { + return linkStatus; + } + #endregion } #region Command @@ -180,6 +196,12 @@ namespace JXSoft { req = req_; } } + public struct LinkStateChangedEvent { + public int linkState; + public LinkStateChangedEvent(int linkState_) { + linkState = linkState_; + } + } #endregion [Serializable]