Browse Source

修改相关实现约束

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
71e374cfc9
  1. 9
      Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs
  2. 40
      Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity
  3. 5
      Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs
  4. 2
      Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs
  5. 18
      Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs
  6. 6
      Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs

9
Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs

@ -38,8 +38,9 @@ namespace JXSoft { @@ -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 { @@ -49,9 +50,13 @@ namespace JXSoft {
EditorGUILayout.TextField("Token", reader.Token.ToString());
EditorGUILayout.TextField("Value", value);
EditorGUILayout.EndHorizontal();
}*/
}
*/
}
}
public void loadDataFromJson() {
}
}
}

40
Assets/MsgTransmitTools/Example/Scenes/TCPLinkExample.unity

@ -128,6 +128,16 @@ PrefabInstance: @@ -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: @@ -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: @@ -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

5
Assets/MsgTransmitTools/Example/Script/TCPClientExample.cs

@ -31,8 +31,7 @@ public class YourResponse : AbstractJsonResponse @@ -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 @@ -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 = "这不是数字";

2
Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs

@ -37,7 +37,7 @@ namespace JXSoft { @@ -37,7 +37,7 @@ namespace JXSoft {
{
this.GetUtility<HttpServerUtility>().closeServer();
setLinkState((int)LinkStateDefault.Close);
return base.Close();
return true;
}
public void setPrefixes(string[] prefixes) {

18
Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientModel.cs

@ -66,26 +66,32 @@ namespace JXSoft @@ -66,26 +66,32 @@ namespace JXSoft
/// <summary>
/// 与服务端建立链接
/// </summary>
public void linkServer() {
public override bool Start()
{
if (tcpState == TCPLinkState.Linking)
{
if (!this.GetUtility<TCPClientUtility>().isOpenTCP) {
if (!this.GetUtility<TCPClientUtility>().isOpenTCP)
{
bool isSuccess = this.GetUtility<TCPClientUtility>().StartTCPClient(tcpAddress, tcpPort);
if (isSuccess) {
if (isSuccess)
{
setLinkState((int)TCPLinkState.LinkSucess);
return true;
}
else
{
setLinkState((int)TCPLinkState.LinkFaild);
return false;
}
}
}
return false;
}
/// <summary>
/// 与服务端断开链接
/// </summary>
public void closeServer()
public override bool Close()
{
if (tcpState == TCPLinkState.LinkSucess)
{
@ -94,11 +100,11 @@ namespace JXSoft @@ -94,11 +100,11 @@ namespace JXSoft
this.GetUtility<TCPClientUtility>().CloseTCPClient();
setLinkState((int)TCPLinkState.NoIp);
return true;
}
}
return false;
}
}
#region enum

6
Assets/MsgTransmitTools/ExtendLinkModel/TCPClient/Script/TCPClientView.cs

@ -29,8 +29,6 @@ namespace JXSoft { @@ -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 { @@ -46,7 +44,7 @@ namespace JXSoft {
this.RegisterLinkStateEvent((int)TCPLinkState.Linking, () =>
{
Debug.Log("TCP¿ªÊ¼Á´½Ó");
this.GetModel<TCPClientModel>().linkServer();
this.GetModel<TCPClientModel>().Start();
});
this.RegisterLinkStateEvent((int)TCPLinkState.LinkSucess, () =>
{
@ -65,7 +63,7 @@ namespace JXSoft { @@ -65,7 +63,7 @@ namespace JXSoft {
public void restartTCPService() {
onTCPReLink.Invoke();
this.GetModel<TCPClientModel>().closeServer();
this.GetModel<TCPClientModel>().Close();
StartCoroutine(waitTwoSecond());
}
public IEnumerator waitTwoSecond() {

Loading…
Cancel
Save