using System; using System.Collections.Generic; using System.Text; namespace ET { public class PKTeamComponent:Entity { public static PKTeamComponent Instance{ get; set; } private Dictionary PKTeamDic = new Dictionary(); public void Add(PKTeam team) { PKTeamDic.Add(team.teamA.LeaderId, team); PKTeamDic.Add(team.teamB.LeaderId, team); } public PKTeam Get(long leaderId) { PKTeamDic.TryGetValue(leaderId, out PKTeam team); return team; } public void Remove(long leaderId) { PKTeam pKTeam = Get(leaderId); if(pKTeam==null) Log.Error($"pkTeam == null where leaderId = {leaderId}"); PKTeamDic.Remove(pKTeam.teamA.LeaderId); PKTeamDic.Remove(pKTeam.teamB.LeaderId); pKTeam.Dispose(); } public void Clear() { PKTeamDic.Clear(); } } }