Files
Fishing2Server/Hotfix/Game/Map/Handler/C2Map_LookHandler.cs
2025-12-15 12:30:45 +08:00

45 lines
1.3 KiB
C#

using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
namespace NB.Game;
public class C2Map_LookHandler : Route<Player, C2Map_Look>
{
protected override async FTask Run(Player entity, C2Map_Look message)
{
var mapUnit = entity.GetComponent<MapUnitComponent>();
if (mapUnit == null)
{
// response.ErrorCode = ErrorCode.ErrServer;
return;
}
var roomId = mapUnit.RoomId;
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
var room = roomManageComponent.Get(roomId);
if (room == null)
{
return;
}
var notifyMessage = new Map2C_LookeNotify()
{
Id = entity.Id,
Rotation = message.Rotation,
Timestamp = message.Timestamp
};
// entity.Rotation.x = message.Rotation.x;
// entity.Rotation.y = message.Rotation.y;
// entity.Rotation.z = message.Rotation.z;
foreach (var (_, unit) in room.Units)
{
// if (unit.Id == entity.Id) continue;
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.SessionRunTimeId, notifyMessage);
}
await FTask.CompletedTask;
}
}