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]