using System; using System.Collections.Generic; namespace ET { [FriendClass(typeof(Farmland))] public class C2M_FarmlandRipeHandler: AMActorLocationRpcHandler { protected override async ETTask Run(Unit unit, C2M_FarmlandRipe request, M2C_FarmlandRipe response, Action reply) { try { Farmland farmland = unit.GetGrandChild(request.FarmlandId); if (farmland != null) { farmland.SetFarmlandState(FarmlandState.FARMLAND_STATE_RIPE); response.Error = ErrorCode.ERR_Success; FarmlandHelper.NotifyFarmlandRipe(unit,new List{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; } } }