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.

32 lines
996 B

using System;
namespace ET
{
public class C2M_RepairBuildingHandler : AMActorLocationRpcHandler<Unit, C2M_RepairBuilding, M2C_RepairBuilding>
{
protected async override ETTask Run(Unit unit, C2M_RepairBuilding request, M2C_RepairBuilding response, Action reply)
{
try
{
Building building = unit.GetComponent<BuildingComponent>().GetChild<Building>(request.Id);
StoreComponent storeComponent = unit.GetComponent<StoreComponent>();
//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;
}
}
}