Browse Source

修改名称

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
2f1ef03810
  1. 2
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs
  2. 0
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs.meta
  3. 20
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs
  4. 8
      Assets/MsgTransmitTools/TCPServer.meta
  5. 8
      Assets/MsgTransmitTools/TCPServer/Script.meta
  6. 24
      Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs
  7. 11
      Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs.meta
  8. 4
      Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs

2
Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs → Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs

@ -11,7 +11,7 @@ using System.Text.RegularExpressions; @@ -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 = "";

0
Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs.meta → Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs.meta

20
Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs

@ -14,7 +14,7 @@ namespace JXSoft { @@ -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 { @@ -50,13 +50,13 @@ namespace JXSoft {
if (e.linkState == (int)TCPLinkState.Linking)
{
Debug.Log("TCP¿ªÊ¼Á´½Ó");
this.GetModel<TCPEventModel>().linkServer();
this.GetModel<TCPClientModel>().linkServer();
}
if (e.linkState == (int)TCPLinkState.LinkSucess)
{
Debug.Log("TCPÁ´½Ó³É¹¦");
this.GetModel<TCPEventModel>().onReceive<LinkSuccessResponse>();
this.GetModel<TCPEventModel>().sendRequestCommand(new LinkTCPRequest(deviceId));
this.GetModel<TCPClientModel>().onReceive<LinkSuccessResponse>();
this.GetModel<TCPClientModel>().sendRequestCommand(new LinkTCPRequest(deviceId));
onTCPLinkSuccess.Invoke();
}
if (e.linkState == (int)TCPLinkState.LinkFaild)
@ -71,23 +71,23 @@ namespace JXSoft { @@ -71,23 +71,23 @@ namespace JXSoft {
if (e.res.GetType() == typeof(LinkSuccessResponse))
{
Debug.Log("Link Server success");
this.GetModel<TCPEventModel>().offReceive<LinkSuccessResponse>();
this.GetModel<TCPClientModel>().offReceive<LinkSuccessResponse>();
onServerConnected.Invoke();
}
});
this.GetModel<TCPEventModel>().setLinkState((int)TCPLinkState.NoIp);
this.GetModel<TCPEventModel>().setIP(tcpAddress, tcpPort);
this.GetModel<TCPClientModel>().setLinkState((int)TCPLinkState.NoIp);
this.GetModel<TCPClientModel>().setIP(tcpAddress, tcpPort);
}
public void restartTCPService() {
onTCPReLink.Invoke();
this.GetModel<TCPEventModel>().closeServer();
this.GetModel<TCPClientModel>().closeServer();
StartCoroutine(waitTwoSecond());
}
public IEnumerator waitTwoSecond() {
yield return new WaitForSeconds(2.0f);
this.GetModel<TCPEventModel>().setLinkState((int)TCPLinkState.Linking);
this.GetModel<TCPClientModel>().setLinkState((int)TCPLinkState.Linking);
}
// Update is called once per frame
@ -98,7 +98,7 @@ namespace JXSoft { @@ -98,7 +98,7 @@ namespace JXSoft {
{
GameObject item = Instantiate(tcpMsgItem, tcpMsgContent);
item.GetComponentInChildren<Text>().text = tcpUtil.receivedData;
this.GetModel<TCPEventModel>().onDataRecived.Invoke(tcpUtil.receivedData);
this.GetModel<TCPClientModel>().onDataRecived.Invoke(tcpUtil.receivedData);
}
if (tcpUtil.getTimeOutState() && tcpUtil.isOpenTCP)
{

8
Assets/MsgTransmitTools/TCPServer.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d67a6e840a4e7314e9dafd4ecebda50a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/MsgTransmitTools/TCPServer/Script.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5850a90bcb2c95c40997128e9d213f25
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

24
Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs

@ -0,0 +1,24 @@ @@ -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()
{
}
}
}

11
Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs.meta

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 217eee35e0dc26241b41ab4eaa1b7f2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

4
Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs

@ -17,11 +17,11 @@ namespace JXSoft { @@ -17,11 +17,11 @@ namespace JXSoft {
switch (protocolType)
{
case (ProtocolType.TCP):
return this.GetModel<TCPEventModel>();
return this.GetModel<TCPClientModel>();
case (ProtocolType.UDP):
return this.GetModel<UDPEventModel>();
default:
return this.GetModel<TCPEventModel>();
return this.GetModel<TCPClientModel>();
}
}
public void setProtocol(ProtocolType type)

Loading…
Cancel
Save