Files
Fishing2/Assets/Scripts/Fishing2~/Map/Handler/Map2C_RoleExitMapNotifyHandler.cs

27 lines
754 B
C#

using Fantasy;
using Fantasy.Async;
using Fantasy.Network;
using Fantasy.Network.Interface;
using NBC;
using Log = NBC.Log;
namespace NBF.Fishing2
{
public class Map2C_RoleExitMapNotifyHandler : Message<Map2C_RoleExitRoomNotify>
{
protected override async FTask Run(Session session, Map2C_RoleExitRoomNotify message)
{
Log.Info($"收到离开房间推送 id={message.Id} ");
var map = App.Main.GetComponent<Map>();
if (map == null)
{
Log.Info("地图不存在,不处理退出请求");
return;
}
if (map.Units.Remove(message.Id, out var unit))
{
unit.Dispose();
}
}
}
}