协议修改
This commit is contained in:
30
Hotfix/Map/Helper/MapHelper.cs
Normal file
30
Hotfix/Map/Helper/MapHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
|
||||
namespace NB.Map;
|
||||
|
||||
public static class MapHelper
|
||||
{
|
||||
public static async FTask Offline(Scene scene, long accountId, long gateRouteId)
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var chatUnitManageComponent = scene.GetComponent<MapUnitManageComponent>();
|
||||
if (chatUnitManageComponent == null) return;
|
||||
var mapUnit = chatUnitManageComponent.Get(accountId);
|
||||
if (mapUnit == null) return;
|
||||
|
||||
var roomManageComponent = scene.GetComponent<RoomManageComponent>();
|
||||
|
||||
if (mapUnit.RoomId > 0)
|
||||
{
|
||||
var room = roomManageComponent.Get(mapUnit.RoomId);
|
||||
if (room != null)
|
||||
{
|
||||
await room.Exit(accountId);
|
||||
roomManageComponent.Check(mapUnit.RoomId);
|
||||
}
|
||||
}
|
||||
|
||||
await chatUnitManageComponent.Offline(scene, accountId, gateRouteId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user