From 54155001334fa624ae3f2986abc0341979571e23 Mon Sep 17 00:00:00 2001
From: chenxiangxue <910695411@qq.com>
Date: Tue, 27 Feb 2024 19:00:07 +0800
Subject: [PATCH] asdada
---
Assets/Zion/Scripts/cxx/LoadManage.cs | 11 --------
Assets/Zion/Scripts/cxx/MyNetMQClient.cs | 13 ---------
Assets/Zion/Scripts/cxx/NetMqListener.cs | 34 ++---------------------
Assets/Zion/Scripts/cxx/NetMqPublisher.cs | 18 +-----------
4 files changed, 3 insertions(+), 73 deletions(-)
diff --git a/Assets/Zion/Scripts/cxx/LoadManage.cs b/Assets/Zion/Scripts/cxx/LoadManage.cs
index 56a10fab..25028fe6 100644
--- a/Assets/Zion/Scripts/cxx/LoadManage.cs
+++ b/Assets/Zion/Scripts/cxx/LoadManage.cs
@@ -11,10 +11,6 @@ using Newtonsoft.Json.Linq;
public class LoadManage : MonoBehaviour
{
public static LoadManage Instance;
-
- ///
- /// 房间域 "Room"
- ///
[DisplayOnly]
public string currentRoomArea;
[DisplayOnly]
@@ -52,9 +48,6 @@ public class LoadManage : MonoBehaviour
SceneManager.LoadScene("SampleScene");
}
- ///
- /// 创建与roomServer通信的客户端
- ///
public void CreateRoomServerClient(string roomServerSubIP, string roomServerPubIP)
{
if (RSclient == null)
@@ -78,10 +71,6 @@ public class LoadManage : MonoBehaviour
}
}
- ///
- /// RoomServer,mono
- ///
- ///
private void ReciveFromRoomServerInThread(st_Motions stS)
{
RSclient._netMqListener.AddToMono(stS);
diff --git a/Assets/Zion/Scripts/cxx/MyNetMQClient.cs b/Assets/Zion/Scripts/cxx/MyNetMQClient.cs
index fd05c82b..dbc67bc0 100644
--- a/Assets/Zion/Scripts/cxx/MyNetMQClient.cs
+++ b/Assets/Zion/Scripts/cxx/MyNetMQClient.cs
@@ -38,10 +38,6 @@ public class MyNetMQClient : MonoBehaviour
instance = this;
}
- ///
- /// 初始化Netmq
- ///
- /// 接收函数
public void Init(string ServerSubIP,string ServerPubIP, NetMqListener.ReciveMessageInThread reciveInthread, NetMqListener.ReceiceMessageInMono reciveInMono,string typename)
{
SubIP = ServerSubIP;
@@ -104,15 +100,6 @@ public class st_Motions
public byte[] m_sOperaData;
}
-///
-/// 演习状态
-///
-public enum ProgramState
-{
- 结束,
- 进行中
-}
-
public class DisplayOnly : PropertyAttribute
{
diff --git a/Assets/Zion/Scripts/cxx/NetMqListener.cs b/Assets/Zion/Scripts/cxx/NetMqListener.cs
index 0c0008eb..6852d547 100644
--- a/Assets/Zion/Scripts/cxx/NetMqListener.cs
+++ b/Assets/Zion/Scripts/cxx/NetMqListener.cs
@@ -8,40 +8,18 @@ using System.Text;
using System.Threading;
using UnityEngine;
-
-///
-/// 订阅模块
-///
public class NetMqListener
{
private string serverSubIP;
private Thread _listenerWorker;
public bool _listenerCancelled;
- ///
- /// 自定义名称
- ///
public string typeName;
- ///
- /// 处理函数委托
- ///
- ///
public delegate void ReceiceMessageInMono(st_Motions st);
public delegate void ReciveMessageInThread(st_Motions st);
- ///
- /// mono里处理消息
- ///
private readonly ReceiceMessageInMono _reciveMessageInMono;
- ///
- /// 线程里处理模型
- ///
private readonly ReciveMessageInThread _reciveMessageInThread;
-
private readonly List _messageReciveStmotion = new List();
-
- ///
- /// 注册委托函数
- ///
public NetMqListener(string subIP , ReciveMessageInThread _reciveInThread, ReceiceMessageInMono reciveInMono)
{
serverSubIP = subIP;
@@ -49,9 +27,7 @@ public class NetMqListener
_reciveMessageInMono += reciveInMono;
StartListen();
}
- ///
- /// 开始监听
- ///
+
public void StartListen()
{
_listenerCancelled = false;
@@ -59,9 +35,7 @@ public class NetMqListener
_listenerWorker.IsBackground = true;
_listenerWorker.Start();
}
- ///
- /// 停止监听
- ///
+
public void StopListen()
{
_listenerCancelled = true;
@@ -69,9 +43,6 @@ public class NetMqListener
}
public SubscriberSocket subSocket;
- ///
- /// 接收线程
- ///
private void ByteListenerWork()
{
AsyncIO.ForceDotNet.Force();
@@ -87,7 +58,6 @@ public class NetMqListener
//{
List frameByte = new List();
if (!subSocket.TryReceiveMultipartBytes(ref frameByte)) continue;
- //UnityEngine.Debug.Log("线程收到一条");
st_Motions stS = new st_Motions();
string tmp = Encoding.UTF8.GetString(frameByte[0]);
stS.m_iOperaType = BitConverter.ToInt32(frameByte[1], 0);
diff --git a/Assets/Zion/Scripts/cxx/NetMqPublisher.cs b/Assets/Zion/Scripts/cxx/NetMqPublisher.cs
index 29be6f48..7ab9576a 100644
--- a/Assets/Zion/Scripts/cxx/NetMqPublisher.cs
+++ b/Assets/Zion/Scripts/cxx/NetMqPublisher.cs
@@ -16,15 +16,9 @@ public class NetMqPublisher
private Thread _listenerWorker;
public bool _listenerCancelled;
- ///
- /// 自定义名称
- ///
public string typeName;
public delegate void MessageDelegateByte(st_Motions st);
private readonly MessageDelegateByte _messageDelegateByte;
- ///
- /// 发送队列
- ///
private readonly ConcurrentQueue _messageQueueData = new ConcurrentQueue();
@@ -33,10 +27,6 @@ public class NetMqPublisher
serverPubIP = pubIP;
StartListen();
}
-
- ///
- /// 开始监听
- ///
public void StartListen()
{
_listenerCancelled = false;
@@ -44,17 +34,12 @@ public class NetMqPublisher
_listenerWorker.IsBackground = true;
_listenerWorker.Start();
}
- ///
- /// 停止监听
- ///
public void StopListen()
{
_listenerCancelled = true;
//_listenerWorker.Join();
}
- ///
- /// 发送线程
- ///
+
private void ByteListenerWork()
{
AsyncIO.ForceDotNet.Force();
@@ -78,7 +63,6 @@ public class NetMqPublisher
Array.Copy(BitConverter.GetBytes(sendData.m_iOperaType), 0, tmpbytes, 0, 4);
Array.Copy(sendData.m_sOperaData, 0, tmpbytes, 4, sendData.m_sOperaData.Length);
if (!_listenerCancelled && !publishSocket.SendMoreFrame(sendData.area).TrySendFrame(tmpbytes)) continue;
- UnityEngine.Debug.Log("发送一个消息:" + sendData.area + "," + sendData.m_iOperaType);
}
}
}