250501 커밋
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCore;
|
||||
|
||||
namespace GameServer.Contents.Battle.Tickers;
|
||||
|
||||
public class BattleEventNotifyTicker : EntityTicker
|
||||
{
|
||||
public BattleEventNotifyTicker(double onTickIntervalMilliseconds, CancellationTokenSource? cts)
|
||||
: base(EntityType.BattleInstanceStateCheckTicker, onTickIntervalMilliseconds, cts)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override async Task onTaskTick()
|
||||
{
|
||||
await notifyBattleEvent();
|
||||
}
|
||||
|
||||
private async Task notifyBattleEvent()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
var battle_events = BattleInstanceManager.It.getSystemBattleEvents().Values;
|
||||
|
||||
var now = DateTimeHelper.Current;
|
||||
List<Int32> event_ids = new();
|
||||
foreach (var ev in battle_events)
|
||||
{
|
||||
if (ev.m_ready_time < now && now <= ev.m_start_time && ev.m_is_send_noti == false)
|
||||
{
|
||||
event_ids.Add(ev.m_event_id);
|
||||
ev.m_is_send_noti = true;
|
||||
}
|
||||
}
|
||||
|
||||
List<BattleEventInfo> infos = new();
|
||||
foreach (var event_id in event_ids)
|
||||
{
|
||||
if (false == BattleInstanceManager.It.getSystemBattleEvent(event_id, out var battleEvent))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
infos.Add(BattleInstanceManager.It.makeProtoBattleEvent(battleEvent));
|
||||
}
|
||||
|
||||
if (infos.Count > 0)
|
||||
{
|
||||
BattleRoomNotifyHelper.broadcast_GS2C_NTF_BATTLE_EVENT(infos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user