Browse Source

部分名称修改

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
58d94742b7
  1. 2
      Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs
  2. 0
      Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs.meta
  3. 18
      Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs
  4. 2
      Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs
  5. 4
      Assets/MsgTransmitTools/src/DataEventModel.cs
  6. 2
      Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs

2
Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs → Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs

@ -4,7 +4,7 @@ using UnityEngine; @@ -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 = "";

0
Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPEventModel.cs.meta → Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientModel.cs.meta

18
Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPClientView.cs

@ -11,7 +11,7 @@ namespace JXSoft { @@ -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 { @@ -42,13 +42,13 @@ namespace JXSoft {
if (e.state == UDPLinkState.Linking)
{
Debug.Log("UDP开始链接");
this.GetModel<UDPEventModel>().linkServer();
this.GetModel<UDPClientModel>().linkServer();
}
if (e.state == UDPLinkState.LinkSucess)
{
Debug.Log("UDP链接成功");
this.GetModel<UDPEventModel>().onReceive<LinkSuccessResponse>();
this.GetModel<UDPEventModel>().sendRequest(new LinkUDPRequest(deviceId));
this.GetModel<UDPClientModel>().onReceive<LinkSuccessResponse>();
this.GetModel<UDPClientModel>().sendRequest(new LinkUDPRequest(deviceId));
onUDPLinkSuccess.Invoke();
}
if (e.state == UDPLinkState.LinkFaild)
@ -63,25 +63,25 @@ namespace JXSoft { @@ -63,25 +63,25 @@ namespace JXSoft {
if (e.res.GetType() == typeof(LinkSuccessResponse))
{
Debug.Log("Link Server success");
this.GetModel<UDPEventModel>().offReceive<LinkSuccessResponse>();
this.GetModel<UDPClientModel>().offReceive<LinkSuccessResponse>();
onServerConnected.Invoke();
}
});
this.GetModel<UDPEventModel>().setLinkState((int)UDPLinkState.NoIp);
this.GetModel<UDPEventModel>().setIP(UDPAddress, UDPPort);
this.GetModel<UDPClientModel>().setLinkState((int)UDPLinkState.NoIp);
this.GetModel<UDPClientModel>().setIP(UDPAddress, UDPPort);
}
public void restartUDPService()
{
onUDPReLink.Invoke();
this.GetModel<UDPEventModel>().closeServer();
this.GetModel<UDPClientModel>().closeServer();
StartCoroutine(waitTwoSecond());
}
public IEnumerator waitTwoSecond()
{
yield return new WaitForSeconds(2.0f);
this.GetModel<UDPEventModel>().setLinkState((int)UDPLinkState.Linking);
this.GetModel<UDPClientModel>().setLinkState((int)UDPLinkState.Linking);
}
public IArchitecture GetArchitecture()
{

2
Assets/MsgTransmitTools/ExtendLinkModel/UDPClient/UDPPrinter.cs

@ -26,7 +26,7 @@ namespace JXSoft { @@ -26,7 +26,7 @@ namespace JXSoft {
{
GameObject item = Instantiate(udpMsgItem, udpMsgContent);
item.GetComponentInChildren<Text>().text = udpUtil.receivedData;
this.GetModel<UDPEventModel>().onDataRecived.Invoke(udpUtil.receivedData);
this.GetModel<UDPClientModel>().onDataRecived.Invoke(udpUtil.receivedData);
}
if (udpUtil.getTimeOutState() && udpUtil.isOpenUDP)

4
Assets/MsgTransmitTools/src/DataEventModel.cs

@ -70,13 +70,15 @@ namespace JXSoft { @@ -70,13 +70,15 @@ namespace JXSoft {
public abstract int getLinkState();
/// <summary>
/// Start a link & server, you can overwrite by you own fucntions
/// Start a link & server, you can override by you own fucntions
/// </summary>
/// <returns>is link success & server start success</returns>
public virtual bool Start() {
setLinkState((int)LinkStateDefault.Open);
return true;
}
public virtual bool Close() {
setLinkState((int)LinkStateDefault.Close);
return true;
}
#endregion

2
Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs

@ -19,7 +19,7 @@ namespace JXSoft { @@ -19,7 +19,7 @@ namespace JXSoft {
case (ProtocolType_.TCP):
return this.GetModel<TCPClientModel>();
case (ProtocolType_.UDP):
return this.GetModel<UDPEventModel>();
return this.GetModel<UDPClientModel>();
default:
return this.GetModel<TCPClientModel>();
}

Loading…
Cancel
Save