using System; namespace ET { public static class PlantHelper { public static async ETTask FarmlandPlant(Unit unit, long farmlandId, int cropId) { try { C2M_FarmlandPlant msg = new C2M_FarmlandPlant() { FarmlandId = farmlandId, CropCfgId = cropId }; M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent().Session.Call(msg) as M2C_FarmlandPlant; if (resp.Error == ErrorCode.ERR_Success) { FarmlandOperate.Plant(unit, farmlandId, cropId); } else { Log.Error(resp.Error.ToString()); } return resp.Error; } catch (Exception e) { Log.Error(e.ToString()); throw; } } public static async ETTask FarmlandHarvest(Unit unit, long farmlandId) { try { C2M_FarmlandHarvest msg = new C2M_FarmlandHarvest() { FarmlandId = farmlandId }; M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent().Session.Call(msg) as M2C_FarmlandPlant; if (resp.Error == ErrorCode.ERR_Success) { FarmlandOperate.Harvest(unit, farmlandId); } else { Log.Error(resp.Error.ToString()); } return resp.Error; } catch (Exception e) { Log.Error(e.ToString()); throw; } } } }