You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

using System;
namespace ET
{
public class G2M_RequestExitGameHandler: AMActorLocationRpcHandler<Unit, G2M_RequestExitGame, M2G_RequestExitGame>
{
protected override async ETTask Run(Unit unit, G2M_RequestExitGame request, M2G_RequestExitGame response, Action reply)
{
// TODO: 保存玩家数据到数据库,执行相关下线操作
var cuisine = unit.GetComponent<CuisineComponent>();
if (cuisine != null)
{
CuisineOperate.EndCuisine(unit, 0);
}
Log.Debug("开始下线保存玩家数据");
// unit.GetComponent<UnitDBSaveComponent>()?.SaveChange();
unit.GetComponent<UnitDBSaveComponent>()?.Save();
reply();
// 释放Unit
await unit.RemoveLocation();
UnitComponent unitComponent = unit.DomainScene().GetComponent<UnitComponent>();
unitComponent.Remove(unit.Id);
await ETTask.CompletedTask;
}
}
}