websocket接口更新

This commit is contained in:
huyulong 2024-12-26 21:59:25 +08:00
parent a722d89ccf
commit 0ece047d64

View File

@ -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<WSMessage>(sendData);
SelectRequest login = ProtoBufffer.DeSerialize<SelectRequest>(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<WSMessage>(sendData);
SelectHistoryRequest login = ProtoBufffer.DeSerialize<SelectHistoryRequest>(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<VoiceResponse>(bytes);
@ -685,9 +733,46 @@ public class test : MonoBehaviour
break;
//对象触发操作
case "hall.ThatUser":
Debug.Log("-----------move.MoveNpc");
PlayerJoinResponse PlayerJoinResponse = ProtoBufffer.DeSerialize<PlayerJoinResponse>(bytes);
Debug.Log(PlayerJoinResponse);
break;
//获取任务列表
case "hall.GetTaskList":
Debug.Log("-----------move.MoveNpc");
TaskListResponse TaskListResponse = ProtoBufffer.DeSerialize<TaskListResponse>(bytes);
foreach(var task in TaskListResponse.Tasks)
{
Debug.Log(task.TaskId);
}
break;
//获取任务列表
case "select.SelectTrigger":
Debug.Log("-----------move.MoveNpc");
SelectResponse selectRequest = ProtoBufffer.DeSerialize<SelectResponse>(bytes);
Debug.Log(selectRequest);
break;
//获取任务列表
case "select.GetSelectHistoryList":
Debug.Log("-----------move.MoveNpc");
SelectHistoryResponse selectHistoryResponse = ProtoBufffer.DeSerialize<SelectHistoryResponse>(bytes);
foreach(var selectRes in selectHistoryResponse.Selects)
{
Debug.Log(selectRes.Id);
}
break;
//case "prop.CreateNpc":
// MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes);
// Debug.Log("UserId:" + moveResponse.UserId + "£¬RoomId:" + moveResponse.RoomId + "£¬x:" + moveResponse.MoveData);