123456789101112131415161718192021222324252627282930 |
- namespace ET.Server
- {
- [FriendOf(typeof(GameSessionKeyComponent))]
- public static class GameSessionKeyComponentSystem
- {
- public static void Add(this GameSessionKeyComponent self, string key, string account)
- {
- self.sessionKey.Add(key, account);
- self.TimeoutRemoveKey(key).Coroutine();
- }
- public static string Get(this GameSessionKeyComponent self, string key)
- {
- string account = null;
- self.sessionKey.TryGetValue(key, out account);
- return account;
- }
- public static void Remove(this GameSessionKeyComponent self, string key)
- {
- self.sessionKey.Remove(key);
- }
- private static async ETTask TimeoutRemoveKey(this GameSessionKeyComponent self, string key)
- {
- await TimerComponent.Instance.WaitAsync(20000);
- self.sessionKey.Remove(key);
- }
- }
- }
|