diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 5e29497f..5d410f27 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -250,10 +250,13 @@ public class test : MonoBehaviour wEBScriptListener.SendMessageByte(sendData); } - void Location() + //推送npc和玩家的信息 + void Location(string userId = "2",string roomId = "3",NpcData npcData = null) { MoveResponse data = new MoveResponse(); - data.RoomId = "168888"; + data.RoomId = roomId; + data.UserId = userId; + WSMessage msg = new WSMessage(); msg.Module = "move"; msg.ServiceName = "Location"; @@ -308,11 +311,14 @@ public class test : MonoBehaviour wEBScriptListener.SendMessageByte(sendData); } - public void NpcMove() + //NPC路线选择 + public void NpcMove(string roomId = "1",int moveType = 2, int selectId = 3) { MoveRequest data = new MoveRequest(); - data.RoomId = "168888"; - data.SelectId = 10821; + data.RoomId = roomId; + data.MoveType = moveType; + data.SelectId = selectId; + WSMessage msg = new WSMessage(); msg.Module = "move"; msg.ServiceName = "MoveNpc"; @@ -366,6 +372,50 @@ public class test : MonoBehaviour wEBScriptListener.SendMessageByte(sendData); } + //创建语音频道 + public void RtcTokenHandler() + { + VoiceRequest data = new VoiceRequest(); + data.Uid = 1; + data.RoomId = "8"; + data.ChannelName = "2"; + data.ChannelType = "5"; + data.Role = "6"; + + 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); + VoiceRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + + //NPC是否进入烟雾区域 + public void EnterFogArea() + { + npcRequest data = new npcRequest(); + data.RoomId = "8"; + data.Action = 3; + + 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); + VoiceRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + + // Start is called before the first frame update async void Start() @@ -627,7 +677,15 @@ public class test : MonoBehaviour break; + //语音监听 + case "voice.RtcTokenHandler": + Debug.Log("-----------move.MoveNpc"); + VoiceResponse voiceResponse = ProtoBufffer.DeSerialize(bytes); + Debug.Log(voiceResponse); + break; + + //case "prop.CreateNpc":