角色控制和房间进入推送
This commit is contained in:
38
Hotfix/Map/Handler/C2Map_MoveHandler.cs
Normal file
38
Hotfix/Map/Handler/C2Map_MoveHandler.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Helper;
|
||||
using Fantasy.Network.Interface;
|
||||
|
||||
namespace NB.Map;
|
||||
|
||||
public class C2Map_MoveHandler : Route<MapUnit, C2Map_Move>
|
||||
{
|
||||
protected override async FTask Run(MapUnit entity, C2Map_Move message)
|
||||
{
|
||||
var mapUnitManageComponent = entity.Scene.GetComponent<MapUnitManageComponent>();
|
||||
var notifyMessage = new Map2C_MoveNotify()
|
||||
{
|
||||
Id = entity.Id,
|
||||
Position = message.Position,
|
||||
Rotation = message.Rotation,
|
||||
IsStop = message.IsStop,
|
||||
Direction = message.Direction,
|
||||
Timestamp = TimeHelper.Now
|
||||
};
|
||||
|
||||
entity.Position.x = message.Position.x;
|
||||
entity.Position.y = message.Position.y;
|
||||
entity.Position.z = message.Position.z;
|
||||
|
||||
entity.Rotation.x = message.Rotation.x;
|
||||
entity.Rotation.y = message.Rotation.y;
|
||||
entity.Rotation.z = message.Rotation.z;
|
||||
|
||||
foreach (var (_, unit) in mapUnitManageComponent.Units)
|
||||
{
|
||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user