2021-04-08 20:09:59 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class PKTeamComponent:Entity
|
|
|
|
|
{
|
|
|
|
|
public static PKTeamComponent Instance{ get; set; }
|
|
|
|
|
|
|
|
|
|
private Dictionary<long, PKTeam> PKTeamDic = new Dictionary<long, PKTeam>();
|
|
|
|
|
|
|
|
|
|
public void Add(PKTeam team)
|
|
|
|
|
{
|
|
|
|
|
PKTeamDic.Add(team.teamA.LeaderId, team);
|
|
|
|
|
PKTeamDic.Add(team.teamB.LeaderId, team);
|
|
|
|
|
}
|
|
|
|
|
public PKTeam Get(long leaderId)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
PKTeamDic.TryGetValue(leaderId, out PKTeam team);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|