using System; namespace ET { public class C2M_RepairBuildingHandler : AMActorLocationRpcHandler { protected async override ETTask Run(Unit unit, C2M_RepairBuilding request, M2C_RepairBuilding response, Action reply) { try { Building building = unit.GetComponent().GetChild(request.Id); StoreComponent storeComponent = unit.GetComponent(); //if(storeComponent.IsEnoughItem()) building.Repair(); response.Error = ErrorCode.ERR_Success; reply(); } catch (Exception e) { response.Message = e.ToString(); response.Error = ErrorCode.ERR_BuildError; reply(); throw; } await ETTask.CompletedTask; } } }