You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
using System.Linq; |
|
|
|
namespace ET |
|
{ |
|
[FriendClass(typeof(PlayerComponent))] |
|
public static class PlayerComponentSystem |
|
{ |
|
public class AwakeSystem : AwakeSystem<PlayerComponent> |
|
{ |
|
public override void Awake(PlayerComponent self) |
|
{ |
|
} |
|
} |
|
|
|
[ObjectSystem] |
|
public class PlayerComponentDestroySystem: DestroySystem<PlayerComponent> |
|
{ |
|
public override void Destroy(PlayerComponent self) |
|
{ |
|
} |
|
} |
|
|
|
public static void Add(this PlayerComponent self, Player player) |
|
{ |
|
self.idPlayers.Add(player.AccountId, player); |
|
} |
|
|
|
public static Player Get(this PlayerComponent self,long id) |
|
{ |
|
self.idPlayers.TryGetValue(id, out Player gamer); |
|
return gamer; |
|
} |
|
|
|
public static void Remove(this PlayerComponent self,long id) |
|
{ |
|
self.idPlayers.Remove(id); |
|
} |
|
|
|
public static Player[] GetAll(this PlayerComponent self) |
|
{ |
|
return self.idPlayers.Values.ToArray(); |
|
} |
|
} |
|
} |