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.
 
 
 
 
 
 

43 lines
1.4 KiB

using System;
namespace ET
{
public class C2M_GoCabinHandler: AMActorLocationRpcHandler<Unit, C2M_GoCabin, M2C_GoCabin>
{
protected async override ETTask Run(Unit unit, C2M_GoCabin request, M2C_GoCabin response, Action reply)
{
try
{
var people = unit.GetComponent<PeopleComponent>().GetChild<People>(request.PeopleId);
if (people == null)
{
response.Error = ErrorCode.ERR_PeopleNotFound;
}
else
{
var cabin = unit.GetGrandChild<Cabin>(request.CabinId);
if (cabin == null)
{
response.Error = ErrorCode.ERR_CabinNotFound;
}
else
{
PeopleOperate.ChangeBehave(unit, people, ConstBehaveType.BEHAVE_PREPARE_CABIN, request.CabinId);
cabin.PeoplePrepare(request.PeopleId);
response.Error = ErrorCode.ERR_Success;
}
}
reply();
}
catch (Exception e)
{
response.Message = e.ToString();
response.Error = ErrorCode.ERR_OperateFail;
reply();
}
await ETTask.CompletedTask;
}
}
}