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
945 B
34 lines
945 B
using System; |
|
|
|
namespace ET |
|
{ |
|
public class C2M_UseItemHandler: AMActorLocationRpcHandler<Unit, C2M_UseItem, M2C_UseItem> |
|
{ |
|
protected override async ETTask Run(Unit unit, C2M_UseItem request, M2C_UseItem response, Action reply) |
|
{ |
|
|
|
try |
|
{ |
|
var res = StoreOperate.UseItem(unit, request.ConfigId, request.Amount, request.Id); |
|
if (!res) |
|
{ |
|
response.Error = ErrorCode.ERR_UseError; |
|
} |
|
else |
|
{ |
|
response.Error = ErrorCode.ERR_Success; |
|
} |
|
|
|
reply(); |
|
} |
|
catch (Exception e) |
|
{ |
|
response.Message = e.ToString(); |
|
response.Error = ErrorCode.ERR_UseError; |
|
reply(); |
|
} |
|
|
|
await ETTask.CompletedTask; |
|
} |
|
} |
|
} |