PlayerComponentSystem.cs 711 B

12345678910111213141516171819202122232425
  1. using System.Linq;
  2. namespace ET.Server
  3. {
  4. [FriendOf(typeof(PlayerComponent))]
  5. public static partial class PlayerComponentSystem
  6. {
  7. public static void Add(this PlayerComponent self, Player player)
  8. {
  9. self.dictionary.Add(player.Account, player);
  10. }
  11. public static void Remove(this PlayerComponent self, Player player)
  12. {
  13. self.dictionary.Remove(player.Account);
  14. player.Dispose();
  15. }
  16. public static Player GetByAccount(this PlayerComponent self, string account)
  17. {
  18. self.dictionary.TryGetValue(account, out EntityRef<Player> player);
  19. return player;
  20. }
  21. }
  22. }