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

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

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

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

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

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

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

22
Assets/MsgTransmitTools/UDPClient/UDPClientView.cs

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

5
Assets/MsgTransmitTools/UDPClient/UDPEventModel.cs

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

17
Assets/MsgTransmitTools/UDPClient/UDPPrinter.cs

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

2
Assets/MsgTransmitTools/UDPClient/UDPUtility.cs

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

100
Assets/MsgTransmitTools/src/DataEventModel.cs

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

6
Assets/MsgTransmitTools/src/QFrameCopy.cs

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

Loading…
Cancel
Save