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
3 years ago
|
using System;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
public class C2M_CreateConstructHandler:AMActorLocationRpcHandler<Unit, C2M_CreateConstruct, M2C_CreateConstruct>
|
||
|
{
|
||
|
protected async override ETTask Run(Unit unit, C2M_CreateConstruct request, M2C_CreateConstruct response, Action reply)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var construct = ConstructOperate.CreateConstruct(unit, request.ConfigId, request.X, request.Y,0,request.BuildingId);
|
||
|
if (construct == null)
|
||
|
{
|
||
|
response.Error = ErrorCode.ERR_CreateConstructFail;
|
||
|
reply();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
response.Error = ErrorCode.ERR_Success;
|
||
|
response.Id = construct.Id;
|
||
|
reply();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
response.Message = e.ToString();
|
||
|
response.Error = ErrorCode.ERR_CreateConstructFail;
|
||
|
reply();
|
||
|
}
|
||
|
|
||
|
await ETTask.CompletedTask;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|