From 0ece047d645fa612864a68930e261f7eb4a06cdb Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Thu, 26 Dec 2024 21:59:25 +0800 Subject: [PATCH] =?UTF-8?q?websocket=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/ProtoBuf/test.cs | 87 +++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 5d410f27..252168bb 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -416,6 +416,54 @@ public class test : MonoBehaviour } + //界面选项操作 + public void SelectTrigger() + { + SelectRequest data = new SelectRequest(); + data.SelectId = "1"; + data.UserId = "2"; + data.RoomId = "3"; + data.TaskId = "4"; + data.RoleId = "5"; + + + WSMessage msg = new WSMessage(); + msg.Module = "voice"; + msg.ServiceName = "RtcTokenHandler"; + msg.Data = ByteString.CopyFrom(ProtoBufffer.Serialize(data)); + byte[] sendData = ProtoBufffer.Serialize(msg); + WSMessage deinfo = ProtoBufffer.DeSerialize(sendData); + SelectRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + + + //界面选项操作 + public void GetSelectHistoryList() + { + SelectHistoryRequest data = new SelectHistoryRequest(); + data.SelectId = "1"; + data.UserId = "2"; + data.RoomId = "3"; + + + + WSMessage msg = new WSMessage(); + msg.Module = "select"; + msg.ServiceName = "GetSelectHistoryList"; + msg.Data = ByteString.CopyFrom(ProtoBufffer.Serialize(data)); + byte[] sendData = ProtoBufffer.Serialize(msg); + WSMessage deinfo = ProtoBufffer.DeSerialize(sendData); + SelectHistoryRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + // Start is called before the first frame update async void Start() @@ -677,7 +725,7 @@ public class test : MonoBehaviour break; - //语音监听 + //语音频道 case "voice.RtcTokenHandler": Debug.Log("-----------move.MoveNpc"); VoiceResponse voiceResponse = ProtoBufffer.DeSerialize(bytes); @@ -685,9 +733,46 @@ public class test : MonoBehaviour break; + //对象触发操作 + case "hall.ThatUser": + Debug.Log("-----------move.MoveNpc"); + PlayerJoinResponse PlayerJoinResponse = ProtoBufffer.DeSerialize(bytes); + Debug.Log(PlayerJoinResponse); + + break; + + //获取任务列表 + case "hall.GetTaskList": + Debug.Log("-----------move.MoveNpc"); + TaskListResponse TaskListResponse = ProtoBufffer.DeSerialize(bytes); + foreach(var task in TaskListResponse.Tasks) + { + Debug.Log(task.TaskId); + } + + break; + //获取任务列表 + case "select.SelectTrigger": + Debug.Log("-----------move.MoveNpc"); + SelectResponse selectRequest = ProtoBufffer.DeSerialize(bytes); + Debug.Log(selectRequest); + + break; + //获取任务列表 + case "select.GetSelectHistoryList": + Debug.Log("-----------move.MoveNpc"); + SelectHistoryResponse selectHistoryResponse = ProtoBufffer.DeSerialize(bytes); + foreach(var selectRes in selectHistoryResponse.Selects) + { + Debug.Log(selectRes.Id); + } + break; + + + //case "prop.CreateNpc": // MoveResponse moveResponse = ProtoBufffer.DeSerialize(bytes); // Debug.Log("UserId:" + moveResponse.UserId + ",RoomId:" + moveResponse.RoomId + ",x:" + moveResponse.MoveData);