Browse Source

修改名称

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
d927a6e952
  1. 20
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientModel.cs
  2. 6
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPClientView.cs
  3. 7
      Assets/MsgTransmitTools/TCPServer/Script/TCPServerModel.cs

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

@ -21,13 +21,13 @@ namespace JXSoft @@ -21,13 +21,13 @@ namespace JXSoft
{
this.RegisterEvent<onLinkException>(e=> {
setLinkState((int)TCPLinkState.LinkTimeOut);
this.GetUtility<TCPUtility>().CloseTCPClient();
this.GetUtility<TCPClientUtility>().CloseTCPClient();
});
//注册重写发送事件
this.RegisterEvent<RequestMsgEvent>(e => {
if (this.GetUtility<TCPUtility>().isOpenTCP)
if (this.GetUtility<TCPClientUtility>().isOpenTCP)
{
this.GetUtility<TCPUtility>().sendData(e.req.toProtocolData());
this.GetUtility<TCPClientUtility>().sendData(e.req.toProtocolData());
}
else
{
@ -70,9 +70,9 @@ namespace JXSoft @@ -70,9 +70,9 @@ namespace JXSoft
public void linkServer() {
if (tcpState == TCPLinkState.Linking)
{
if (!this.GetUtility<TCPUtility>().isOpenTCP) {
if (!this.GetUtility<TCPClientUtility>().isOpenTCP) {
bool isSuccess = this.GetUtility<TCPUtility>().StartTCPClient(tcpAddress, tcpPort);
bool isSuccess = this.GetUtility<TCPClientUtility>().StartTCPClient(tcpAddress, tcpPort);
if (isSuccess) {
setLinkState((int)TCPLinkState.LinkSucess);
}
@ -90,10 +90,10 @@ namespace JXSoft @@ -90,10 +90,10 @@ namespace JXSoft
{
if (tcpState == TCPLinkState.LinkSucess)
{
if (this.GetUtility<TCPUtility>().isOpenTCP)
if (this.GetUtility<TCPClientUtility>().isOpenTCP)
{
this.GetUtility<TCPUtility>().CloseTCPClient();
this.GetUtility<TCPClientUtility>().CloseTCPClient();
setLinkState((int)TCPLinkState.NoIp);
}
}
@ -126,7 +126,7 @@ namespace JXSoft @@ -126,7 +126,7 @@ namespace JXSoft
#endregion
#region util
public class TCPUtility : IUtility
public class TCPClientUtility : IUtility
{
public string tcpAddress;
public int tcpPort;
@ -140,12 +140,12 @@ namespace JXSoft @@ -140,12 +140,12 @@ namespace JXSoft
public Thread reciveT;
public bool isTimeOut = false;
public TCPUtility()
public TCPClientUtility()
{
Debug.LogWarning("使用无参数构造tcp时,需要手动开启tcp服务");
}
public TCPUtility(string tcpAddress, int tcpPort)
public TCPClientUtility(string tcpAddress, int tcpPort)
{
this.tcpAddress = tcpAddress;
this.tcpPort = tcpPort;

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

@ -13,14 +13,14 @@ namespace JXSoft { @@ -13,14 +13,14 @@ namespace JXSoft {
{
protected override void Init()
{
this.RegisterUtility(new TCPUtility());
this.RegisterUtility(new TCPClientUtility());
this.RegisterModel(new TCPClientModel());
}
}
public class TCPClientView : MonoBehaviour,IController,ICanRegisterEvent
{
//Printer&MsgGetter
private TCPUtility tcpUtil;
private TCPClientUtility tcpUtil;
public Transform tcpMsgContent;
public GameObject tcpMsgItem;
@ -38,7 +38,7 @@ namespace JXSoft { @@ -38,7 +38,7 @@ namespace JXSoft {
{
initTCPService();
DontDestroyOnLoad(this);
tcpUtil = GetArchitecture().GetUtility<TCPUtility>();
tcpUtil = GetArchitecture().GetUtility<TCPClientUtility>();
}
public void initTCPService() {

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

@ -3,7 +3,7 @@ using System.Collections.Generic; @@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
namespace JXSoft {
public class TCPServerEventModel:DataEventModel
public class TCPServerModel:DataEventModel
{
public override void setLinkState(int linkState)
@ -20,5 +20,10 @@ namespace JXSoft { @@ -20,5 +20,10 @@ namespace JXSoft {
}
}
public class TCPServer {
}
}

Loading…
Cancel
Save