using System.Collections.Generic; namespace ET { public class GateSessionKeyComponent : Entity { private readonly Dictionary sessionKey = new Dictionary(); public void Add(long key, long userId) { this.sessionKey.Add(key, userId); this.TimeoutRemoveKey(key).Coroutine(); } public long Get(long key) { this.sessionKey.TryGetValue(key, out long account); return account; } public void Remove(long key) { this.sessionKey.Remove(key); } private async ETVoid TimeoutRemoveKey(long key) { await Game.Scene.GetComponent().WaitAsync(20000); this.sessionKey.Remove(key); } } }