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.
 
 
 
 
 
 

42 lines
1.3 KiB

using System;
namespace ET
{
[FriendClass(typeof (Unit))]
public class C2M_FarmlandHarvestHandler: AMActorLocationRpcHandler<Unit, C2M_FarmlandHarvest, M2C_FarmlandHarvest>
{
protected override async ETTask Run(Unit unit, C2M_FarmlandHarvest request, M2C_FarmlandHarvest response, Action reply)
{
try
{
Farmland farmland = unit.GetGrandChild<Farmland>(request.FarmlandId);
if (farmland!=null)
{
People people = unit.GetComponent<PeopleComponent>().GetChild<People>(request.PeopleId);
if (people != null)
{
response.Error = FarmlandOperate.FinishHarvest(unit, farmland, people);
}
else
{
response.Error = ErrorCode.ERR_PeopleNotFound;
}
}
else
{
response.Error = ErrorCode.ERR_FarmlandNotFound;
}
}
catch (Exception e)
{
response.Message = e.ToString();
response.Error = ErrorCode.ERR_OperateFail;
reply();
}
await ETTask.CompletedTask;
}
}
}