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.
 
 
 
 
 
 

34 lines
1.0 KiB

using System;
namespace ET
{
public class C2M_FarmlandSeedHandler: AMActorLocationRpcHandler<Unit, C2M_FarmlandSeed, M2C_FarmlandSeed>
{
protected override async ETTask Run(Unit unit, C2M_FarmlandSeed request, M2C_FarmlandSeed response, Action reply)
{
try
{
Farmland farmland = unit.GetGrandChild<Farmland>(request.FarmlandId);
if (farmland == null)
{
response.Error = ErrorCode.ERR_FarmlandNotFound;
}
else
{
response.Error = FarmlandOperate.FarmlandSeed(unit, farmland, request.CropCfgId);
response.Error = ErrorCode.ERR_Success;
}
reply();
}
catch (Exception e)
{
response.Message = e.ToString();
response.Error = ErrorCode.ERR_OperateFail;
reply();
}
await ETTask.CompletedTask;
}
}
}