using System; namespace ET { public class C2M_ArriveCabinHandler: AMActorLocationRpcHandler { protected async override ETTask Run(Unit unit, C2M_ArriveCabin request, M2C_ArriveCabin response, Action reply) { try { var people = unit.GetComponent().GetChild(request.PeopleId); if (people == null) { response.Error = ErrorCode.ERR_PeopleNotFound; } else { var cabin = unit.GetGrandChild(request.CabinId); if (cabin == null) { response.Error = ErrorCode.ERR_CabinNotFound; } else { if (cabin.PeopleArrive(request.PeopleId)) { people.SetBehaveType(ConstBehaveType.BEHAVE_CABIN); response.Error = ErrorCode.ERR_Success; } else { response.Error = ErrorCode.ERR_ArriveCabinFail; } } } reply(); } catch (Exception e) { response.Message = e.ToString(); response.Error = ErrorCode.ERR_OperateFail; reply(); } await ETTask.CompletedTask; } } }