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.
34 lines
1.1 KiB
34 lines
1.1 KiB
using System; |
|
|
|
namespace ET |
|
{ |
|
[ActorMessageHandler] |
|
public class C2M_GatherResourceHandler: AMActorLocationRpcHandler<Unit, C2M_GatherResource, M2C_GatherResource> |
|
{ |
|
protected async override ETTask Run(Unit unit, C2M_GatherResource request, M2C_GatherResource response, Action reply) |
|
{ |
|
try |
|
{ |
|
ResourcePoint rs = unit.GetComponent<ResourcePointComponent>().GetChild<ResourcePoint>(request.ResPointId); |
|
if (rs == null) |
|
{ |
|
response.Error = ErrorCode.ERR_ResourceNotFound; |
|
reply(); |
|
} |
|
|
|
var (err, gatherId) = GatherOperate.GatherResource(unit, request.ResPointId,request.ResConfigId, request.PeopleIdList, 0); |
|
response.Error = err; |
|
response.GatherId = gatherId; |
|
reply(); |
|
|
|
} |
|
catch (Exception e) |
|
{ |
|
response.Error = ErrorCode.ERR_OperateFail; |
|
response.Message = e.Message; |
|
reply(); |
|
} |
|
await ETTask.CompletedTask; |
|
} |
|
} |
|
} |