协议修改

This commit is contained in:
2025-09-25 23:22:07 +08:00
parent ddffaac7b3
commit 5218bc7585
16 changed files with 159 additions and 125 deletions

View File

@@ -0,0 +1,34 @@
using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
namespace NB.Map;
public class C2Map_RolePropertyChangeHandler : Route<MapUnit, C2Map_RolePropertyChange>
{
protected override async FTask Run(MapUnit entity, C2Map_RolePropertyChange message)
{
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
var roomId = entity.RoomId;
var room = roomManageComponent.Get(roomId);
if (room == null)
{
return;
}
var notifyMessage = new Map2C_RolePropertyChangeNotify()
{
Id = entity.Id,
Propertys = message.Propertys,
};
foreach (var (_, unit) in room.Units)
{
if (unit.Id == entity.Id) continue;
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
}
await FTask.CompletedTask;
}
}