using ET.EventType; using System; using System.Collections.Generic; using System.Text; namespace ET { public class CloseServerEvent : AEvent { public override async ETTask Run(CloseServer a) { try { await ETTask.CompletedTask; using var llist=ListComponent.Create(); IEnumerable arr = OnLineComponent.Instance.GetAll(); foreach (Session session in arr) { llist.List.Add(Offline(session)); } ETTaskHelper.WaitAll(llist.List); } catch (Exception e) { Log.Error(e); } } private static async ETTask Offline(Session session) { session.Send(new G2C_ForceOffLine()); await TimerComponent.Instance.WaitAsync(300); session.Dispose(); } } }