diff --git a/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs b/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs index 5b942e4..695956f 100644 --- a/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs +++ b/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs @@ -38,8 +38,9 @@ namespace JXSoft { keyValuePairs.Clear(); } if (JsonFile != null) { - reader = new JsonReader(JsonFile.text); /* + reader = new JsonReader(JsonFile.text); + while (reader.Read()) { string type = reader.Value != null ? reader.Value.GetType().ToString() : ""; @@ -49,9 +50,13 @@ namespace JXSoft { EditorGUILayout.TextField("Token", reader.Token.ToString()); EditorGUILayout.TextField("Value", value); EditorGUILayout.EndHorizontal(); - }*/ + } + */ } } + public void loadDataFromJson() { + + } } } diff --git a/Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity b/Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity index 5adf653..ca390f5 100644 --- a/Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity +++ b/Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity @@ -128,6 +128,16 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1205360335} m_Modifications: + - target: {fileID: 1515527917566557997, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1515527917566557997, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1515527918816451327, guid: 27bf485803eb75f4598b17afdfac3cfa, type: 3} propertyPath: m_AnchorMax.x @@ -138,6 +148,16 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 1515527918842651468, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1515527918842651468, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1515527919082889016, guid: 27bf485803eb75f4598b17afdfac3cfa, type: 3} propertyPath: m_Name @@ -248,6 +268,26 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1515527919511105903, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1515527919511105903, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1515527919511105903, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1515527919511105903, guid: 27bf485803eb75f4598b17afdfac3cfa, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1515527919516098611, guid: 27bf485803eb75f4598b17afdfac3cfa, type: 3} propertyPath: m_AnchorMax.x diff --git a/Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs b/Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs index 0038a78..15fbc5c 100644 --- a/Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs +++ b/Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs @@ -31,8 +31,7 @@ public class YourResponse : AbstractJsonResponse } public struct YourNumberFilterResponse : IResponse { - public string code; - private int codeNum; + public int codeNum; private string exceptionMsg; public string toProtocolData() { @@ -41,7 +40,7 @@ public struct YourNumberFilterResponse : IResponse public bool trySetData(string protocolData) { - bool isNumber = int.TryParse(code, out codeNum); + bool isNumber = int.TryParse(protocolData, out codeNum); if (!isNumber) { exceptionMsg = "这不是数字"; diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs index 2c862c5..9d5adb8 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs @@ -37,7 +37,7 @@ namespace JXSoft { { this.GetUtility().closeServer(); setLinkState((int)LinkStateDefault.Close); - return base.Close(); + return true; } public void setPrefixes(string[] prefixes) { diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs b/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs index 1d287c3..b7a4614 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs @@ -66,26 +66,32 @@ namespace JXSoft /// /// 与服务端建立链接 /// - public void linkServer() { + public override bool Start() + { if (tcpState == TCPLinkState.Linking) { - if (!this.GetUtility().isOpenTCP) { - + if (!this.GetUtility().isOpenTCP) + { + bool isSuccess = this.GetUtility().StartTCPClient(tcpAddress, tcpPort); - if (isSuccess) { + if (isSuccess) + { setLinkState((int)TCPLinkState.LinkSucess); + return true; } else { setLinkState((int)TCPLinkState.LinkFaild); + return false; } } } + return false; } /// /// 与服务端断开链接 /// - public void closeServer() + public override bool Close() { if (tcpState == TCPLinkState.LinkSucess) { @@ -94,11 +100,11 @@ namespace JXSoft this.GetUtility().CloseTCPClient(); setLinkState((int)TCPLinkState.NoIp); + return true; } } + return false; } - - } #region enum diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs b/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs index a0cfbd5..98dc24a 100644 --- a/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs +++ b/Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs @@ -29,8 +29,6 @@ namespace JXSoft { public UnityEvent onTCPLinkFaild; public UnityEvent onServerConnected; public UnityEvent onTCPReLink; - - private int deviceId; // Start is called before the first frame update void Awake() @@ -46,7 +44,7 @@ namespace JXSoft { this.RegisterLinkStateEvent((int)TCPLinkState.Linking, () => { Debug.Log("TCPʼ"); - this.GetModel().linkServer(); + this.GetModel().Start(); }); this.RegisterLinkStateEvent((int)TCPLinkState.LinkSucess, () => { @@ -65,7 +63,7 @@ namespace JXSoft { public void restartTCPService() { onTCPReLink.Invoke(); - this.GetModel().closeServer(); + this.GetModel().Close(); StartCoroutine(waitTwoSecond()); } public IEnumerator waitTwoSecond() {