protobuf文件接口的更新
This commit is contained in:
parent
7efde543f1
commit
771b15d4ff
@ -108,8 +108,8 @@ public class test : MonoBehaviour
|
|||||||
Debug.Log("每秒执行一次");
|
Debug.Log("每秒执行一次");
|
||||||
wEBScriptListener.SendMessageByte(sendData);
|
wEBScriptListener.SendMessageByte(sendData);
|
||||||
|
|
||||||
// µÈ´ýÒ»Ãë
|
// 等待2秒
|
||||||
await Task.Delay(1000);
|
await Task.Delay(2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//帧存储操作输入
|
//帧存储操作输入
|
||||||
@ -251,7 +251,7 @@ public class test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//推送npc和玩家的信息
|
//推送npc和玩家的信息
|
||||||
void Location(string userId = "2",string roomId = "3")
|
void Location(string userId = "2", string roomId = "3")
|
||||||
{
|
{
|
||||||
MoveResponse data = new MoveResponse();
|
MoveResponse data = new MoveResponse();
|
||||||
data.RoomId = roomId;
|
data.RoomId = roomId;
|
||||||
@ -314,7 +314,7 @@ public class test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//NPC路线选择
|
//NPC路线选择
|
||||||
public void NpcMove(string roomId = "1",int moveType = 2, int selectId = 3)
|
public void NpcMove(string roomId = "1", int moveType = 2, int selectId = 3)
|
||||||
{
|
{
|
||||||
MoveRequest data = new MoveRequest();
|
MoveRequest data = new MoveRequest();
|
||||||
data.RoomId = roomId;
|
data.RoomId = roomId;
|
||||||
@ -467,7 +467,7 @@ public class test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
public void GetTaskList(string userID,string roomID)
|
public void GetTaskList(string userID, string roomID)
|
||||||
{
|
{
|
||||||
TaskTrigger data = new TaskTrigger();
|
TaskTrigger data = new TaskTrigger();
|
||||||
data.UserId = "2";
|
data.UserId = "2";
|
||||||
@ -534,6 +534,10 @@ public class test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
async void Start()
|
async void Start()
|
||||||
{
|
{
|
||||||
@ -647,11 +651,26 @@ public class test : MonoBehaviour
|
|||||||
//广播
|
//广播
|
||||||
case "hall.BroadcastMessage":
|
case "hall.BroadcastMessage":
|
||||||
UserJoinResponse userJoinResponse = ProtoBufffer.DeSerialize<UserJoinResponse>(bytes);
|
UserJoinResponse userJoinResponse = ProtoBufffer.DeSerialize<UserJoinResponse>(bytes);
|
||||||
|
/*
|
||||||
|
这里是userJoinResponse带的数据信息
|
||||||
|
int64 userId =1;//用户id
|
||||||
//Debug.Log(userJoinResponse.IncidentPosition);
|
string nickName=2;//用户名
|
||||||
Debug.Log(userJoinResponse);
|
string roleName=3;//用户角色
|
||||||
|
string roomId=4;//房间号
|
||||||
|
bool online =5;//状态 接收这个用户是不是掉线了
|
||||||
|
事件状态 1 用户上线 2用户下线 3 用户加入房间 4 事故发生 5 火势6 任务7 对象操作 8 NPc 属性更新 9 语音信息、 10 用户信息更新 11 房间开始
|
||||||
|
int32 messageType = 6;
|
||||||
|
string cmd =7;//操作指令
|
||||||
|
string incidentPosition=8://事件发生位置
|
||||||
|
float fireRadius =9;//火势半径
|
||||||
|
int32 firevalue = 10;//火势值
|
||||||
|
TaskInfoResponse taskResponse=11;//任务信息
|
||||||
|
0bjectInfoResponse objectResponse=12;//对象信息
|
||||||
|
NpcInfoResponse npcResponse=13;//npc信息
|
||||||
|
VoiceTransportResponse voiceResponse =14;//语音信息
|
||||||
|
PlayerJoinResponse playerResponse=15;//玩家信息
|
||||||
|
*/
|
||||||
|
//Debug.Log(userJoinResponse);
|
||||||
if (userJoinResponse.MessageType == 1)//用户上线
|
if (userJoinResponse.MessageType == 1)//用户上线
|
||||||
{
|
{
|
||||||
Debug.Log("玩家:" + userJoinResponse.NickName + "上线");
|
Debug.Log("玩家:" + userJoinResponse.NickName + "上线");
|
||||||
@ -670,16 +689,74 @@ public class test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (userJoinResponse.MessageType == 5)//火势
|
if (userJoinResponse.MessageType == 5)//火势
|
||||||
{
|
{
|
||||||
|
//这里写更新火势的信息 半径userJoinResponse.FireRadius 位置userJoinResponse.IncidentPosition 火势值userJoinResponse.FireValue
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (userJoinResponse.MessageType == 6)//任务
|
if (userJoinResponse.MessageType == 6)//任务
|
||||||
{
|
{
|
||||||
|
//解析出任务信息到taskInfoResponse 里面有TaskId 状态Status 房间id 坐标x,y,z 类型Type 时间限制Timelimit 描述Des 触发条件Trigger 下一步任务NextTask 目标类型TargetType 奖励Reward 备注Note 创建时间CreatTime 更新时间UpdateTime 目标用户id ToUserId 基础任务的id BaseTaskid
|
||||||
TaskInfoResponse taskInfoResponse = userJoinResponse.TaskResponse;
|
TaskInfoResponse taskInfoResponse = userJoinResponse.TaskResponse;
|
||||||
if (long.Parse(taskInfoResponse.ToUserId) == userJoinResponse.UserId)//当这个任务是当前玩家的任务时显示任务
|
if (long.Parse(taskInfoResponse.ToUserId) == userJoinResponse.UserId)//当这个任务是当前玩家的任务时显示任务
|
||||||
{
|
{
|
||||||
TaskPanel.instance.Taskad(int.Parse(taskInfoResponse.TaskId));
|
TaskPanel.instance.Taskad(int.Parse(taskInfoResponse.TaskId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (userJoinResponse.MessageType == 7)//对象操作
|
||||||
|
{
|
||||||
|
//解析出的对象信息objectInfoResponse里面有
|
||||||
|
/*
|
||||||
|
string RoomId=1;//对象id
|
||||||
|
string Id=2://ID
|
||||||
|
string objectId=3;//对象ID
|
||||||
|
string Note =4;//状态
|
||||||
|
string Type =5;// 对象类型lilubing,2024/11/2716:37·对象物体及任务:Changes
|
||||||
|
|
||||||
|
|
||||||
|
string Name=6;//对象文本Id
|
||||||
|
int64 Nameshowoffset=7;//对象文本显示偏移量
|
||||||
|
int64 showRadius=8;//对象显示半径
|
||||||
|
string Icon =9;//对象图标
|
||||||
|
string Role =10;//对象角色
|
||||||
|
string ItemDepend =11;//依赖物品
|
||||||
|
int64 Takerime = 12;// 交互、读条时间 -1 立即执行
|
||||||
|
string Needplayers = 13;// 判定范围,玩家数量,是否可操作(当人数不满足时)
|
||||||
|
string Taskstatus=14;//对应事件ID
|
||||||
|
string selectList=15;//选择列表
|
||||||
|
int64 onoff =16;// 操作状态 0不可操作1 可操作
|
||||||
|
|
||||||
|
string status=17;//状态
|
||||||
|
string ResChange =18;//资源变化
|
||||||
|
|
||||||
|
int64 ParallelControl=19;//是否支持多人操作
|
||||||
|
string ExtraValue=20;//额外参数
|
||||||
|
string UserIds = 21;// 玩家id列表 逗号分隔
|
||||||
|
|
||||||
|
string Createrime =22;//创建时间
|
||||||
|
|
||||||
|
string Updaterime =23;//更新时间
|
||||||
|
|
||||||
|
*/
|
||||||
|
ObjectInfoResponse objectInfoResponse = userJoinResponse.ObjectResponse;
|
||||||
|
}
|
||||||
|
if (userJoinResponse.MessageType == 8)//NPC属性更新
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (userJoinResponse.MessageType == 9)//语音信息
|
||||||
|
{
|
||||||
|
//解析出的语音信息voiceTransportResponse里面有 应用id AppId 用户id channelName
|
||||||
|
VoiceTransportResponse voiceTransportResponse = userJoinResponse.VoiceResponse;
|
||||||
|
}
|
||||||
|
if (userJoinResponse.MessageType == 10)//用户信息更新
|
||||||
|
{
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
if (userJoinResponse.MessageType == 11)//房间开始
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -815,7 +892,7 @@ public class test : MonoBehaviour
|
|||||||
case "hall.GetTaskList":
|
case "hall.GetTaskList":
|
||||||
Debug.Log("-----------move.MoveNpc");
|
Debug.Log("-----------move.MoveNpc");
|
||||||
TaskListResponse TaskListResponse = ProtoBufffer.DeSerialize<TaskListResponse>(bytes);
|
TaskListResponse TaskListResponse = ProtoBufffer.DeSerialize<TaskListResponse>(bytes);
|
||||||
foreach(var task in TaskListResponse.Tasks)
|
foreach (var task in TaskListResponse.Tasks)
|
||||||
{
|
{
|
||||||
Debug.Log(task.TaskId);
|
Debug.Log(task.TaskId);
|
||||||
}
|
}
|
||||||
@ -833,7 +910,7 @@ public class test : MonoBehaviour
|
|||||||
case "select.GetSelectHistoryList":
|
case "select.GetSelectHistoryList":
|
||||||
Debug.Log("select.GetSelectHistoryList");
|
Debug.Log("select.GetSelectHistoryList");
|
||||||
SelectHistoryResponse selectHistoryResponse = ProtoBufffer.DeSerialize<SelectHistoryResponse>(bytes);
|
SelectHistoryResponse selectHistoryResponse = ProtoBufffer.DeSerialize<SelectHistoryResponse>(bytes);
|
||||||
foreach(var selectRes in selectHistoryResponse.Selects)
|
foreach (var selectRes in selectHistoryResponse.Selects)
|
||||||
{
|
{
|
||||||
Debug.Log(selectRes.Id);
|
Debug.Log(selectRes.Id);
|
||||||
}
|
}
|
||||||
|
@ -29321,7 +29321,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!81 &1707678917
|
--- !u!81 &1707678917
|
||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -31410,7 +31410,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 43
|
m_RootOrder: 44
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &1845569623
|
--- !u!1001 &1845569623
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
|
Loading…
Reference in New Issue
Block a user