Browse Source

更改QFrame的nameSpace

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
ef93cedfad
  1. 6
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPEventModel.cs
  2. 4
      Assets/MsgTransmitTools/TCPClient/Script/Source/TCPUtility.cs
  3. 27
      Assets/MsgTransmitTools/TCPClient/Script/View/TCPClientView.cs
  4. 6
      Assets/MsgTransmitTools/TCPClient/Script/View/TCPPrinter.cs
  5. 22
      Assets/MsgTransmitTools/UDPClient/UDPClientView.cs
  6. 5
      Assets/MsgTransmitTools/UDPClient/UDPEventModel.cs
  7. 17
      Assets/MsgTransmitTools/UDPClient/UDPPrinter.cs
  8. 2
      Assets/MsgTransmitTools/UDPClient/UDPUtility.cs
  9. 100
      Assets/MsgTransmitTools/src/DataEventModel.cs
  10. 6
      Assets/MsgTransmitTools/src/QFrameCopy.cs

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

@ -1,12 +1,12 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using QFramework; using QFrameworkCP;
namespace TCPClientTools namespace JXSoft
{ {
//统筹管理TCP的命令池以及相关链接信息 //统筹管理TCP的命令池以及相关链接信息
public class TCPEventModel : DataEventModel, ICanSendCommand,ICanRegisterEvent public class TCPEventModel : DataEventModel
{ {
private TCPLinkState tcpState = TCPLinkState.NoIp; private TCPLinkState tcpState = TCPLinkState.NoIp;
private string tcpAddress = ""; private string tcpAddress = "";

4
Assets/MsgTransmitTools/TCPClient/Script/Source/TCPUtility.cs

@ -1,4 +1,4 @@
using QFramework; using QFrameworkCP;
using UnityEngine; using UnityEngine;
using System; using System;
using System.Text; using System.Text;
@ -8,7 +8,7 @@ using System.Threading.Tasks;
using System.Threading; using System.Threading;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
namespace TCPClientTools namespace JXSoft
{ {
public class TCPUtility : IUtility public class TCPUtility : IUtility
{ {

27
Assets/MsgTransmitTools/TCPClient/Script/View/TCPClientView.cs

@ -2,20 +2,22 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using QFramework; using QFrameworkCP;
using TCPClientTools; using JXSoft;
using System; using System;
public class TCPMangerArchitecture : Architecture<TCPMangerArchitecture>
{ namespace JXSoft {
public class TCPMangerArchitecture : Architecture<TCPMangerArchitecture>
{
protected override void Init() protected override void Init()
{ {
this.RegisterUtility(new TCPUtility()); this.RegisterUtility(new TCPUtility());
this.RegisterModel(new TCPEventModel()); this.RegisterModel(new TCPEventModel());
} }
} }
public class TCPClientView : MonoBehaviour,IController,ICanSendEvent public class TCPClientView : MonoBehaviour,IController
{ {
public UnityEvent onRecievedOpenDevice; public UnityEvent onRecievedOpenDevice;
public UnityEvent onTCPLinkSuccess; public UnityEvent onTCPLinkSuccess;
public UnityEvent onTCPLinkFaild; public UnityEvent onTCPLinkFaild;
@ -84,9 +86,9 @@ public class TCPClientView : MonoBehaviour,IController,ICanSendEvent
{ {
return TCPMangerArchitecture.Interface; return TCPMangerArchitecture.Interface;
} }
} }
public class LinkSuccessResponse : AbstractResponse public class LinkSuccessResponse : AbstractResponse
{ {
public string code; public string code;
public string data; public string data;
public string msg; public string msg;
@ -95,9 +97,9 @@ public class LinkSuccessResponse : AbstractResponse
this.data = ""; this.data = "";
this.msg = ""; this.msg = "";
} }
} }
public class LinkTCPRequest :IRequest{ public class LinkTCPRequest :IRequest{
public string id; public string id;
public int type; public int type;
public LinkTCPRequest(int id) { public LinkTCPRequest(int id) {
@ -108,5 +110,6 @@ public class LinkTCPRequest :IRequest{
{ {
return JsonUtility.ToJson(this); return JsonUtility.ToJson(this);
} }
}
} }

6
Assets/MsgTransmitTools/TCPClient/Script/View/TCPPrinter.cs

@ -3,12 +3,12 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.UI; using UnityEngine.UI;
using QFramework; using QFrameworkCP;
using System.Threading; using System.Threading;
namespace TCPClientTools namespace JXSoft
{ {
public class TCPPrinter : MonoBehaviour,IController,ICanSendEvent public class TCPPrinter : MonoBehaviour,IController
{ {
private TCPUtility tcpUtil; private TCPUtility tcpUtil;
public Transform tcpMsgContent; public Transform tcpMsgContent;

22
Assets/MsgTransmitTools/UDPClient/UDPClientView.cs

@ -2,19 +2,20 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using QFramework; using QFrameworkCP;
using System; using System;
public class UDPMangerArchitecture : Architecture<UDPMangerArchitecture> namespace JXSoft {
{ public class UDPMangerArchitecture : Architecture<UDPMangerArchitecture>
{
protected override void Init() protected override void Init()
{ {
this.RegisterUtility(new UDPUtility()); this.RegisterUtility(new UDPUtility());
this.RegisterModel(new UDPEventModel()); this.RegisterModel(new UDPEventModel());
} }
} }
public class UDPClientView : MonoBehaviour, IController, ICanSendEvent public class UDPClientView : MonoBehaviour, IController
{ {
public UnityEvent onRecievedOpenDevice; public UnityEvent onRecievedOpenDevice;
public UnityEvent onUDPLinkSuccess; public UnityEvent onUDPLinkSuccess;
public UnityEvent onUDPLinkFaild; public UnityEvent onUDPLinkFaild;
@ -86,11 +87,11 @@ public class UDPClientView : MonoBehaviour, IController, ICanSendEvent
{ {
return UDPMangerArchitecture.Interface; return UDPMangerArchitecture.Interface;
} }
} }
public class LinkUDPRequest : IRequest public class LinkUDPRequest : IRequest
{ {
public string id; public string id;
public int type; public int type;
public LinkUDPRequest(int id) public LinkUDPRequest(int id)
@ -102,5 +103,6 @@ public class LinkUDPRequest : IRequest
{ {
return JsonUtility.ToJson(this); return JsonUtility.ToJson(this);
} }
} }
}

5
Assets/MsgTransmitTools/UDPClient/UDPEventModel.cs

@ -1,8 +1,9 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using QFramework; using QFrameworkCP;
namespace JXSoft {
public class UDPEventModel : DataEventModel public class UDPEventModel : DataEventModel
{ {
private UDPLinkState udpState = UDPLinkState.NoIp; private UDPLinkState udpState = UDPLinkState.NoIp;
@ -115,3 +116,5 @@ using QFramework;
} }
} }
#endregion #endregion
}

17
Assets/MsgTransmitTools/UDPClient/UDPPrinter.cs

@ -1,16 +1,12 @@
using System; using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using QFramework; using QFrameworkCP;
public class UDPPrinter : MonoBehaviour, IController, ICanSendEvent, ICanGetUtility
{ namespace JXSoft {
public class UDPPrinter : MonoBehaviour, IController
{
private UDPUtility udpUtil; private UDPUtility udpUtil;
public Transform udpMsgContent; public Transform udpMsgContent;
public GameObject udpMsgItem; public GameObject udpMsgItem;
@ -54,4 +50,5 @@ public class UDPPrinter : MonoBehaviour, IController, ICanSendEvent, ICanGetUtil
{ {
return UDPMangerArchitecture.Interface; return UDPMangerArchitecture.Interface;
} }
}
} }

2
Assets/MsgTransmitTools/UDPClient/UDPUtility.cs

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
using QFramework; using QFrameworkCP;
using System; using System;
using System.Text; using System.Text;
using System.Net.Sockets; using System.Net.Sockets;

100
Assets/MsgTransmitTools/src/DataEventModel.cs

@ -1,14 +1,15 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using QFramework; using QFrameworkCP;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
//任何通讯类围绕DataEventModel进行 namespace JXSoft {
public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegisterEvent //任何通讯类围绕DataEventModel进行
{ public abstract class DataEventModel : AbstractModel
{
public IOCContainer mCommandContainer = new IOCContainer(); public IOCContainer mCommandContainer = new IOCContainer();
public UnityStringEvent onDataRecived = new UnityStringEvent(); public UnityStringEvent onDataRecived = new UnityStringEvent();
public Color printColor = Color.white; public Color printColor = Color.white;
@ -55,15 +56,15 @@ public abstract class DataEventModel : AbstractModel, ICanSendCommand, ICanRegis
mCommandContainer.Get<SendRequestCommand<T>>().setRequest(request); mCommandContainer.Get<SendRequestCommand<T>>().setRequest(request);
this.SendCommand(mCommandContainer.Get<SendRequestCommand<T>>()); this.SendCommand(mCommandContainer.Get<SendRequestCommand<T>>());
} }
} }
#region Command #region Command
/// <summary> /// <summary>
/// 处理响应数据,添加对应的Command进行处理,需要提前生成命令池 /// 处理响应数据,添加对应的Command进行处理,需要提前生成命令池
/// </summary> /// </summary>
/// <typeparam name="TResponse">响应数据格式</typeparam> /// <typeparam name="TResponse">响应数据格式</typeparam>
public class ExcuteResponseCommand<TResponse> : AbstractCommand where TResponse : IResponse public class ExcuteResponseCommand<TResponse> : AbstractCommand where TResponse : IResponse
{ {
public string json; public string json;
private TResponse response; private TResponse response;
private Color printColor = Color.white; private Color printColor = Color.white;
@ -87,14 +88,14 @@ public class ExcuteResponseCommand<TResponse> : AbstractCommand where TResponse
{ {
this.json = json; this.json = json;
} }
} }
/// <summary> /// <summary>
/// 发送数据 /// 发送数据
/// </summary> /// </summary>
/// <typeparam name="TRequest">发送数据格式</typeparam> /// <typeparam name="TRequest">发送数据格式</typeparam>
public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRequest public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRequest
{ {
public TRequest request; public TRequest request;
public SendRequestCommand(TRequest request) public SendRequestCommand(TRequest request)
{ {
@ -108,12 +109,12 @@ public class SendRequestCommand<TRequest> : AbstractCommand where TRequest : IRe
{ {
this.request = request; this.request = request;
} }
} }
#endregion #endregion
#region interface #region interface
public interface IResponse public interface IResponse
{ {
string toJson(); string toJson();
/// <summary> /// <summary>
/// 尝试填充数据,如果json不合法,则返回false,忽略该条数据响应 /// 尝试填充数据,如果json不合法,则返回false,忽略该条数据响应
@ -122,21 +123,21 @@ public interface IResponse
/// <returns></returns> /// <returns></returns>
bool trySetData(string json); bool trySetData(string json);
string getException(); string getException();
} }
public interface IRequest public interface IRequest
{ {
string toJson(); string toJson();
} }
#endregion #endregion
#region AbstractClass #region AbstractClass
/// <summary> /// <summary>
/// 使用抽象类时,必须满足可序列化 /// 使用抽象类时,必须满足可序列化
/// </summary> /// </summary>
[Serializable] [Serializable]
public abstract class AbstractResponse : IResponse public abstract class AbstractResponse : IResponse
{ {
private string exceptionMsg; private string exceptionMsg;
public virtual string toJson() public virtual string toJson()
{ {
@ -159,30 +160,31 @@ public abstract class AbstractResponse : IResponse
{ {
return exceptionMsg; return exceptionMsg;
} }
} }
#endregion #endregion
#region event #region event
public struct ResponseMsgEvent public struct ResponseMsgEvent
{ {
public IResponse res; public IResponse res;
public ResponseMsgEvent(IResponse res_) public ResponseMsgEvent(IResponse res_)
{ {
res = res_; res = res_;
} }
}; };
public struct RequestMsgEvent public struct RequestMsgEvent
{ {
public IRequest req; public IRequest req;
public RequestMsgEvent(IRequest req_) public RequestMsgEvent(IRequest req_)
{ {
req = req_; req = req_;
} }
} }
#endregion #endregion
[Serializable] [Serializable]
public class UnityStringEvent : UnityEvent<string> public class UnityStringEvent : UnityEvent<string>
{ {
}
} }

6
Assets/MsgTransmitTools/src/QFrameCopy.cs

@ -25,7 +25,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace QFramework namespace QFrameworkCP
{ {
#region Architecture #region Architecture
@ -205,7 +205,7 @@ namespace QFramework
#region Controller #region Controller
public interface IController : IBelongToArchitecture, ICanSendCommand, ICanGetModel, public interface IController : IBelongToArchitecture, ICanSendCommand, ICanGetModel,
ICanRegisterEvent, ICanSendQuery, ICanSendEvent ICanRegisterEvent, ICanSendQuery, ICanSendEvent, ICanGetUtility
{ {
} }
@ -213,7 +213,7 @@ namespace QFramework
#region Model #region Model
public interface IModel : IBelongToArchitecture, ICanSetArchitecture, ICanGetUtility, ICanSendEvent public interface IModel : IBelongToArchitecture, ICanSetArchitecture, ICanGetUtility, ICanSendEvent, ICanSendCommand, ICanRegisterEvent
{ {
void Init(); void Init();
} }

Loading…
Cancel
Save