46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Cal.DataTable;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
public class ActiveArgs
|
|||
|
{
|
|||
|
public Unit unit;
|
|||
|
public string[] param;
|
|||
|
}
|
|||
|
|
|||
|
[ActorMessageHandler]
|
|||
|
public class C2M_StartActiveHandler : AMActorLocationRpcHandler<Unit, C2M_StartActive, M2C_StartActive>
|
|||
|
{
|
|||
|
protected override async ETTask Run(Unit unit, C2M_StartActive request, M2C_StartActive response, Action reply)
|
|||
|
{
|
|||
|
ActivePerDayConfig activePerDayConfig = ActivePerDayConfigCategory.Instance.Get(request.itemId);
|
|||
|
if (activePerDayConfig == null)
|
|||
|
{
|
|||
|
Log.Error($"{unit.Id.GetPlayerFormatName()} 活动Id错误:{request.itemId}");
|
|||
|
response.Message = "系统错误";
|
|||
|
reply();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
int weekDay = (int) DateTime.Today.DayOfWeek;
|
|||
|
if (!activePerDayConfig.Day.As<IList<int>>().Contains(weekDay))
|
|||
|
{
|
|||
|
Log.Error($"{unit.Id.GetPlayerFormatName()} 活动日期错误:{activePerDayConfig.Day.ToCustomString()} today = {weekDay}");
|
|||
|
response.Message = "系统错误";
|
|||
|
reply();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
await GlobalMethodHelper.Call(activePerDayConfig.BattleMethod,new ActiveArgs
|
|||
|
{
|
|||
|
unit = unit,param = activePerDayConfig.Params
|
|||
|
});
|
|||
|
reply();
|
|||
|
await ETTask.CompletedTask;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|