From 50ab18271f989bb8f9fea2892728e3e9b2dbddf0 Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Fri, 27 Dec 2024 21:02:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/ProtoBuf/test.cs | 80 +++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 6bf5e708..4fa2e9a5 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -251,12 +251,14 @@ public class test : MonoBehaviour } //推送npc和玩家的信息 - void Location(string userId = "2",string roomId = "3",NpcData npcData = null) + void Location(string userId = "2",string roomId = "3") { MoveResponse data = new MoveResponse(); data.RoomId = roomId; data.UserId = userId; + + WSMessage msg = new WSMessage(); msg.Module = "move"; msg.ServiceName = "Location"; @@ -463,6 +465,55 @@ public class test : MonoBehaviour wEBScriptListener.SendMessageByte(sendData); } + + // + public void GetTaskList(string userID,string roomID) + { + TaskTrigger data = new TaskTrigger(); + 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); + TaskTrigger login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + + + public void TriggerNpcArrive() + { + MoveRoomAoiRequest data = new MoveRoomAoiRequest(); + data.RoomId = "1"; + data.UserId = 2; + data.X = 3f; + data.Y = 4f; + data.Z = 5f; + data.SceneId = "6"; + data.NpcId = "7"; + data.Action = 8; + + + 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); + MoveRoomAoiRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } // Start is called before the first frame update @@ -694,7 +745,7 @@ public class test : MonoBehaviour break; - //任务触发 + //13(1)任务触发 case "task.TaskTrigger": Debug.Log("-----------task.TaskTrigger"); TaskTrigger taskTrigger = ProtoBufffer.DeSerialize(bytes); @@ -702,7 +753,7 @@ public class test : MonoBehaviour break; - //更新任务 + //13(2)更新任务 case "task.UpdateTask": Debug.Log("-----------task.TaskTrigger"); MoveRequest taskUpdateRequest = ProtoBufffer.DeSerialize(bytes); @@ -725,7 +776,7 @@ public class test : MonoBehaviour break; - //语音频道 + //17.语音频道 case "voice.RtcTokenHandler": Debug.Log("-----------move.MoveNpc"); VoiceResponse voiceResponse = ProtoBufffer.DeSerialize(bytes); @@ -733,7 +784,7 @@ public class test : MonoBehaviour break; - //对象触发操作 + //15.对象触发操作 case "hall.ThatUser": Debug.Log("-----------move.MoveNpc"); PlayerJoinResponse PlayerJoinResponse = ProtoBufffer.DeSerialize(bytes); @@ -741,7 +792,7 @@ public class test : MonoBehaviour break; - //获取任务列表 + //16.获取任务列表 case "hall.GetTaskList": Debug.Log("-----------move.MoveNpc"); TaskListResponse TaskListResponse = ProtoBufffer.DeSerialize(bytes); @@ -751,16 +802,17 @@ public class test : MonoBehaviour } break; - //获取任务列表 + //19. 界面选项操作 case "select.SelectTrigger": - Debug.Log("-----------move.MoveNpc"); + Debug.Log("select.SelectTrigger"); SelectResponse selectRequest = ProtoBufffer.DeSerialize(bytes); Debug.Log(selectRequest); break; - //获取任务列表 + + //20. 选项操作记录 case "select.GetSelectHistoryList": - Debug.Log("-----------move.MoveNpc"); + Debug.Log("select.GetSelectHistoryList"); SelectHistoryResponse selectHistoryResponse = ProtoBufffer.DeSerialize(bytes); foreach(var selectRes in selectHistoryResponse.Selects) { @@ -768,7 +820,13 @@ public class test : MonoBehaviour } break; - + //21.NPC是否被扛起 + case "move.TriggerNpcArrive": + SelectResponse selectResponse = ProtoBufffer.DeSerialize(bytes); + + + break; +