角色控制和房间进入推送
This commit is contained in:
@@ -18,9 +18,34 @@ public class MapRoomDestroySystem : DestroySystem<MapRoom>
|
||||
|
||||
public static class MapRoomSystem
|
||||
{
|
||||
public static async FTask<uint> Enter(this MapRoom self, long unitId)
|
||||
public static async FTask<uint> Enter(this MapRoom self, MapUnit unit)
|
||||
{
|
||||
self.Units.TryAdd(unit.Id, unit);
|
||||
|
||||
var notifyMessage = new Map2C_RoleEnterRoomNotify()
|
||||
{
|
||||
Info = unit.ToMapUnitInfo(),
|
||||
};
|
||||
|
||||
foreach (var (_, roomUnit) in self.Units)
|
||||
{
|
||||
// if (roomUnit.Id == unit.Id) continue;
|
||||
// 同步其他客户端
|
||||
self.Scene.NetworkMessagingComponent.SendInnerRoute(roomUnit.GateRouteId, notifyMessage);
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
return ErrorCode.Successful;
|
||||
}
|
||||
|
||||
public static List<MapUnitInfo> ToMapUnitInfo(this MapRoom self)
|
||||
{
|
||||
List<MapUnitInfo> ret = new List<MapUnitInfo>();
|
||||
foreach (var (_, unit) in self.Units)
|
||||
{
|
||||
ret.Add(unit.ToMapUnitInfo());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user