CTT/Server/Hotfix/Game/Handler/Other/C2M_GetAddEnergyPriceHandle...

27 lines
826 B
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using System;
using System.Collections.Generic;
namespace ET
{
[ActorMessageHandler]
public class C2M_GetAddEnergyPriceHandler : AMActorLocationRpcHandler<Unit, C2M_GetAddEnergyPrice, M2C_GetAddEnergyPrice>
{
protected override async ETTask Run(Unit unit, C2M_GetAddEnergyPrice request, M2C_GetAddEnergyPrice response, Action reply)
{
PlayerData data = unit.GetComponent<PlayerData>();
int count = data.buyEnergyCount;
if (count >= ConstDefine.AddEnergyPriceArr.Length)
{
response.Message = "购买次数达到上限";
reply();
return;
}
response.Price = ConstDefine.AddEnergyPriceArr[count];
reply();
await ETTask.CompletedTask;
}
}
}