diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs similarity index 98% rename from Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs rename to Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs index b257e49..f3e357b 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs @@ -4,7 +4,7 @@ using UnityEngine; using QFrameworkCP; namespace JXSoft { - public class UDPEventModel : DataEventModel + public class UDPClientModel : DataEventModel { private UDPLinkState udpState = UDPLinkState.NoIp; private string udpAddress = ""; diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs.meta b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs.meta similarity index 100% rename from Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs.meta rename to Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs.meta diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs index 128ac97..57af284 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs @@ -11,7 +11,7 @@ namespace JXSoft { protected override void Init() { this.RegisterUtility(new UDPUtility()); - this.RegisterModel(new UDPEventModel()); + this.RegisterModel(new UDPClientModel()); } } public class UDPClientView : MonoBehaviour, IController @@ -42,13 +42,13 @@ namespace JXSoft { if (e.state == UDPLinkState.Linking) { Debug.Log("UDP开始链接"); - this.GetModel().linkServer(); + this.GetModel().linkServer(); } if (e.state == UDPLinkState.LinkSucess) { Debug.Log("UDP链接成功"); - this.GetModel().onReceive(); - this.GetModel().sendRequest(new LinkUDPRequest(deviceId)); + this.GetModel().onReceive(); + this.GetModel().sendRequest(new LinkUDPRequest(deviceId)); onUDPLinkSuccess.Invoke(); } if (e.state == UDPLinkState.LinkFaild) @@ -63,25 +63,25 @@ 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)UDPLinkState.NoIp); - this.GetModel().setIP(UDPAddress, UDPPort); + this.GetModel().setLinkState((int)UDPLinkState.NoIp); + this.GetModel().setIP(UDPAddress, UDPPort); } public void restartUDPService() { onUDPReLink.Invoke(); - this.GetModel().closeServer(); + this.GetModel().closeServer(); StartCoroutine(waitTwoSecond()); } public IEnumerator waitTwoSecond() { yield return new WaitForSeconds(2.0f); - this.GetModel().setLinkState((int)UDPLinkState.Linking); + this.GetModel().setLinkState((int)UDPLinkState.Linking); } public IArchitecture GetArchitecture() { diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs index 9aec51d..d30ad7c 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs @@ -26,7 +26,7 @@ namespace JXSoft { { GameObject item = Instantiate(udpMsgItem, udpMsgContent); item.GetComponentInChildren().text = udpUtil.receivedData; - this.GetModel().onDataRecived.Invoke(udpUtil.receivedData); + this.GetModel().onDataRecived.Invoke(udpUtil.receivedData); } if (udpUtil.getTimeOutState() && udpUtil.isOpenUDP) diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index 305a1b9..1f754e2 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -70,13 +70,15 @@ namespace JXSoft { public abstract int getLinkState(); /// - /// Start a link & server, you can overwrite by you own fucntions + /// Start a link & server, you can override by you own fucntions /// /// is link success & server start success public virtual bool Start() { + setLinkState((int)LinkStateDefault.Open); return true; } public virtual bool Close() { + setLinkState((int)LinkStateDefault.Close); return true; } #endregion diff --git a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs index a28dcb1..41ac532 100644 --- a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs +++ b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs @@ -19,7 +19,7 @@ namespace JXSoft { case (ProtocolType_.TCP): return this.GetModel(); case (ProtocolType_.UDP): - return this.GetModel(); + return this.GetModel(); default: return this.GetModel(); }