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