diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs b/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs similarity index 99% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs rename to Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs index bd93875..a549e27 100644 --- a/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs +++ b/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs @@ -11,7 +11,7 @@ using System.Text.RegularExpressions; namespace JXSoft { //统筹管理TCP的命令池以及相关链接信息 - public class TCPEventModel : DataEventModel + public class TCPClientModel : DataEventModel { private TCPLinkState tcpState = TCPLinkState.NoIp; private string tcpAddress = ""; diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs.meta b/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs.meta similarity index 100% rename from Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs.meta rename to Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs.meta diff --git a/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs b/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs index e14ba6e..9d61bc7 100644 --- a/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs +++ b/Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs @@ -14,7 +14,7 @@ namespace JXSoft { protected override void Init() { this.RegisterUtility(new TCPUtility()); - this.RegisterModel(new TCPEventModel()); + this.RegisterModel(new TCPClientModel()); } } public class TCPClientView : MonoBehaviour,IController,ICanRegisterEvent @@ -50,13 +50,13 @@ namespace JXSoft { if (e.linkState == (int)TCPLinkState.Linking) { Debug.Log("TCPʼ"); - this.GetModel().linkServer(); + this.GetModel().linkServer(); } if (e.linkState == (int)TCPLinkState.LinkSucess) { Debug.Log("TCPӳɹ"); - this.GetModel().onReceive(); - this.GetModel().sendRequestCommand(new LinkTCPRequest(deviceId)); + this.GetModel().onReceive(); + this.GetModel().sendRequestCommand(new LinkTCPRequest(deviceId)); onTCPLinkSuccess.Invoke(); } if (e.linkState == (int)TCPLinkState.LinkFaild) @@ -71,23 +71,23 @@ namespace JXSoft { if (e.res.GetType() == typeof(LinkSuccessResponse)) { Debug.Log("Link Server success"); - this.GetModel().offReceive(); + this.GetModel().offReceive(); onServerConnected.Invoke(); } }); - this.GetModel().setLinkState((int)TCPLinkState.NoIp); - this.GetModel().setIP(tcpAddress, tcpPort); + this.GetModel().setLinkState((int)TCPLinkState.NoIp); + this.GetModel().setIP(tcpAddress, tcpPort); } public void restartTCPService() { onTCPReLink.Invoke(); - this.GetModel().closeServer(); + this.GetModel().closeServer(); StartCoroutine(waitTwoSecond()); } public IEnumerator waitTwoSecond() { yield return new WaitForSeconds(2.0f); - this.GetModel().setLinkState((int)TCPLinkState.Linking); + this.GetModel().setLinkState((int)TCPLinkState.Linking); } // Update is called once per frame @@ -98,7 +98,7 @@ namespace JXSoft { { GameObject item = Instantiate(tcpMsgItem, tcpMsgContent); item.GetComponentInChildren().text = tcpUtil.receivedData; - this.GetModel().onDataRecived.Invoke(tcpUtil.receivedData); + this.GetModel().onDataRecived.Invoke(tcpUtil.receivedData); } if (tcpUtil.getTimeOutState() && tcpUtil.isOpenTCP) { diff --git a/Assets/MsgTransmitTools/TCPServer.meta b/Assets/MsgTransmitTools/TCPServer.meta new file mode 100644 index 0000000..4ade0fe --- /dev/null +++ b/Assets/MsgTransmitTools/TCPServer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d67a6e840a4e7314e9dafd4ecebda50a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MsgTransmitTools/TCPServer/Script.meta b/Assets/MsgTransmitTools/TCPServer/Script.meta new file mode 100644 index 0000000..ee93bdc --- /dev/null +++ b/Assets/MsgTransmitTools/TCPServer/Script.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5850a90bcb2c95c40997128e9d213f25 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs b/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs new file mode 100644 index 0000000..6d6af28 --- /dev/null +++ b/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace JXSoft { + public class TCPServerEventModel:DataEventModel + { + + public override void setLinkState(int linkState) + { + } + + public override int getLinkState() + { + return 0; + } + + protected override void OnInit() + { + + } + } +} + diff --git a/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs.meta b/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs.meta new file mode 100644 index 0000000..0f8140e --- /dev/null +++ b/Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 217eee35e0dc26241b41ab4eaa1b7f2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs index 3856756..97f4114 100644 --- a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs +++ b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs @@ -17,11 +17,11 @@ namespace JXSoft { switch (protocolType) { case (ProtocolType.TCP): - return this.GetModel(); + return this.GetModel(); case (ProtocolType.UDP): return this.GetModel(); default: - return this.GetModel(); + return this.GetModel(); } } public void setProtocol(ProtocolType type)