39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
|
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)
|
|||
|
{
|
|||
|
PKTeamDic.TryGetValue(leaderId, out var 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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|