using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ServerCore; using ServerBase; using ServerCommon; using System.Diagnostics; namespace GameServer { public class EventUpdateTicker : EntityTicker { public EventUpdateTicker(double onTickIntervalMilliseconds, CancellationTokenSource? cts) : base(EntityType.EventUpdateTicker, onTickIntervalMilliseconds, cts) { } public override async Task onTaskTick() { // TODO HERE : 처리해야 하는 Update 함수를 추가 한다. var result = new Result(); var err_msg = string.Empty; Stopwatch? stopwatch = null; var event_tid = string.Empty; var server_logic = GameServerApp.getServerLogic(); var server_config = server_logic.getServerConfig(); if (true == server_config.PerformanceCheckEnable) { event_tid = System.Guid.NewGuid().ToString("N"); stopwatch = Stopwatch.StartNew(); } // TODO HERE : 처리해야 하는 Update 함수를 추가 한다. (var deletables, var currents) = EventManager.It.claimEventActiveCheckAndGet(); foreach (var each in server_logic.getPlayerManager().getUsers()) { // TODO : 여기서 유저 주요 테스크를 처리 한다. var user = each.Value; var user_create_or_load_action = user.getEntityAction(); NullReferenceCheckHelper.throwIfNull(user_create_or_load_action, () => $"user_create_or_load_action is null !!! - {user.toBasicString()}"); if (false == user_create_or_load_action.isCompletedLoadUser()) { continue; } // ClaimEvent 신규, 삭졔 체크 if (deletables.Count > 0 || currents.Count > 0) { await EventManager.It.playerClaimUpdateAndNoti(user, deletables, currents); } } if (null != stopwatch) { var elapsed_msec = stopwatch.ElapsedMilliseconds; stopwatch.Stop(); Log.getLogger().debug($"{GetType()} Ticker Stopwatch Stop : ETID:{event_tid}, ElapsedMSec:{elapsed_msec}, TickIntervalMSec:{getOnTickIntervalMilliseconds()}"); } } public override string toBasicString() { return $"{this.getTypeName()}"; } public override string toSummaryString() { return $"{this.getTypeName()}"; } } }