Compare commits

...

3 Commits

Author SHA1 Message Date
huyulong
54a8aa476e 测试调用npc移动 2024-12-12 17:07:43 +08:00
huyulong
b4f601691d Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang 2024-12-12 17:00:29 +08:00
huyulong
df42382aa8 新增NpcMove接口 2024-12-12 17:00:17 +08:00
3 changed files with 92 additions and 9 deletions

View File

@ -233,7 +233,6 @@ public class test : MonoBehaviour
//} //}
//开始计时 //开始计时
void RoomStartTime() void RoomStartTime()
{ {
@ -310,6 +309,23 @@ public class test : MonoBehaviour
wEBScriptListener.SendMessageByte(sendData); wEBScriptListener.SendMessageByte(sendData);
} }
public void NpcMove()
{
MoveRequest data = new MoveRequest();
data.RoomId = "168888";
data.SelectId = 10821;
WSMessage msg = new WSMessage();
msg.Module = "move";
msg.ServiceName = "MoveNpc";
msg.Data = ByteString.CopyFrom(ProtoBufffer.Serialize(data));
byte[] sendData = ProtoBufffer.Serialize(msg);
WSMessage deinfo = ProtoBufffer.DeSerialize<WSMessage>(sendData);
MoveRequest login = ProtoBufffer.DeSerialize<MoveRequest>(deinfo.Data.ToByteArray());
Debug.Log("==========选择路线");
//BroadcastFrameMsg.FramesFieldNumber
wEBScriptListener.SendMessageByte(sendData);
}
@ -336,6 +352,7 @@ public class test : MonoBehaviour
//Location(); //Location();
//TaskTrigger(); //TaskTrigger();
//TaskUpdateRequest(); //TaskUpdateRequest();
} }
//int index = 0; //int index = 0;
//while (true) //while (true)
@ -411,6 +428,8 @@ public class test : MonoBehaviour
Debug.Log("-=====--"); Debug.Log("-=====--");
LoginResponse user = ProtoBufffer.DeSerialize<LoginResponse>(bytes); LoginResponse user = ProtoBufffer.DeSerialize<LoginResponse>(bytes);
Debug.Log(user); Debug.Log(user);
//这里是测试阶段用的,在登录之后调用加入房间,后续会删掉
JoinRoom();
break; break;
//进入房间 //进入房间
@ -419,6 +438,8 @@ public class test : MonoBehaviour
byte[] joinByte = joinRoomResponse.Data.ToByteArray(); byte[] joinByte = joinRoomResponse.Data.ToByteArray();
PlayerJoinResponse playerJoinResponse = ProtoBufffer.DeSerialize<PlayerJoinResponse>(joinByte); PlayerJoinResponse playerJoinResponse = ProtoBufffer.DeSerialize<PlayerJoinResponse>(joinByte);
Debug.Log("玩家:"+playerJoinResponse.UserName+"加入房间:"+playerJoinResponse.RoomId.ToString()); Debug.Log("玩家:"+playerJoinResponse.UserName+"加入房间:"+playerJoinResponse.RoomId.ToString());
break; break;
//广播 //广播
@ -496,6 +517,8 @@ public class test : MonoBehaviour
// 使用指定的世界坐标位置来实例化 NPC而不是依赖 trans 位置 // 使用指定的世界坐标位置来实例化 NPC而不是依赖 trans 位置
GameObject.Instantiate(npc, position, Quaternion.identity); // 直接指定位置和旋转 GameObject.Instantiate(npc, position, Quaternion.identity); // 直接指定位置和旋转
// Npc生成后调用选择路线,=================这里也会删掉在等UI逻辑那边处理完
NpcMove();
} }
if(npcData.Type == 2)//npc移动 if(npcData.Type == 2)//npc移动
{ {
@ -522,7 +545,7 @@ public class test : MonoBehaviour
//更新任务 //更新任务
case "task.UpdateTask": case "task.UpdateTask":
Debug.Log("-----------task.TaskTrigger"); Debug.Log("-----------task.TaskTrigger");
TaskUpdateRequest taskUpdateRequest = ProtoBufffer.DeSerialize<TaskUpdateRequest>(bytes); MoveRequest taskUpdateRequest = ProtoBufffer.DeSerialize<MoveRequest>(bytes);
Debug.Log(taskUpdateRequest); Debug.Log(taskUpdateRequest);
break; break;
@ -534,13 +557,21 @@ public class test : MonoBehaviour
Debug.Log(requestObject); Debug.Log(requestObject);
break; break;
//对象触发操作
case "move.MoveNpc":
Debug.Log("-----------move.MoveNpc");
MoveRequest moveRequest = ProtoBufffer.DeSerialize<MoveRequest>(bytes);
Debug.Log(moveRequest);
break;
//case "prop.CreateNpc":
// MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes); //case "prop.CreateNpc":
// Debug.Log("UserId:" + moveResponse.UserId + "£¬RoomId:" + moveResponse.RoomId + "£¬x:" + moveResponse.MoveData); // MoveResponse moveResponse = ProtoBufffer.DeSerialize<MoveResponse>(bytes);
// break; // Debug.Log("UserId:" + moveResponse.UserId + "RoomId:" + moveResponse.RoomId + "x:" + moveResponse.MoveData);
// break;

View File

@ -7853,7 +7853,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 810501276} m_GameObject: {fileID: 810501276}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -18.09, y: 0.5, z: 35.56} m_LocalPosition: {x: 30, y: 0.5, z: 22.74}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -10869,6 +10869,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: obj202 value: obj202
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8282288472169970500, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj224
objectReference: {fileID: 0}
- target: {fileID: -6327141709703751677, guid: eec919b17e074b747899fe01d7888a2c, type: 3} - target: {fileID: -6327141709703751677, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: obj153 value: obj153
@ -10881,10 +10885,26 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: obj024 value: obj024
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -3237221884521187588, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj222
objectReference: {fileID: 0}
- target: {fileID: -2654505143154747466, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj220
objectReference: {fileID: 0}
- target: {fileID: -1788689016301746583, guid: eec919b17e074b747899fe01d7888a2c, type: 3} - target: {fileID: -1788689016301746583, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: obj205 value: obj205
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -241233108021658044, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj210
objectReference: {fileID: 0}
- target: {fileID: -106440716057841632, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj221
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: eec919b17e074b747899fe01d7888a2c, type: 3} - target: {fileID: 919132149155446097, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: school03 value: school03
@ -10897,14 +10917,46 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: obj204 value: obj204
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3184295249035706133, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj208
objectReference: {fileID: 0}
- target: {fileID: 4315024395822287230, guid: eec919b17e074b747899fe01d7888a2c, type: 3} - target: {fileID: 4315024395822287230, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: obj198 value: obj198
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5427673003371859311, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj223
objectReference: {fileID: 0}
- target: {fileID: 7077992237008472060, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj206
objectReference: {fileID: 0}
- target: {fileID: 7322491252510880854, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj226
objectReference: {fileID: 0}
- target: {fileID: 7455878101187352886, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj225
objectReference: {fileID: 0}
- target: {fileID: 8052244126148009048, guid: eec919b17e074b747899fe01d7888a2c, type: 3} - target: {fileID: 8052244126148009048, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: obj122 value: obj122
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8443362320608252490, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj207
objectReference: {fileID: 0}
- target: {fileID: 8661539485286681749, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj209
objectReference: {fileID: 0}
- target: {fileID: 8816389197232921522, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
propertyPath: m_Name
value: obj219
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: eec919b17e074b747899fe01d7888a2c, type: 3} m_SourcePrefab: {fileID: 100100000, guid: eec919b17e074b747899fe01d7888a2c, type: 3}
--- !u!1 &1124162635 stripped --- !u!1 &1124162635 stripped

@ -1 +1 @@
Subproject commit 0385375c1818fc57f42407a6c5301a26ded3a19a Subproject commit 2e42b278d4c6ac9e045925dcc6e04896a19cbfd8