27 lines
826 B
C#
27 lines
826 B
C#
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;
|
|
}
|
|
}
|
|
|
|
}
|