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.
 
 
 
 
 
 

38 lines
1.2 KiB

using System;
using System.Collections.Generic;
namespace ET
{
[FriendClass(typeof(Farmland))]
public class C2M_FarmlandRipeHandler: AMActorLocationRpcHandler<Unit, C2M_FarmlandRipe, M2C_FarmlandRipe>
{
protected override async ETTask Run(Unit unit, C2M_FarmlandRipe request, M2C_FarmlandRipe response, Action reply)
{
try
{
Farmland farmland = unit.GetGrandChild<Farmland>(request.FarmlandId);
if (farmland != null)
{
farmland.SetFarmlandState(FarmlandState.FARMLAND_STATE_RIPE);
response.Error = ErrorCode.ERR_Success;
FarmlandHelper.NotifyFarmlandRipe(unit,new List<long>{farmland.Id});
}
else
{
response.Error = ErrorCode.ERR_FarmlandNotFound;
}
reply();
}
catch (Exception e)
{
response.Message = e.ToString();
response.Error = ErrorCode.ERR_OperateFail;
reply();
throw;
}
await ETTask.CompletedTask;
}
}
}