|
// 阵型基础
|
|
public partial class TeamBase
|
{
|
public TeamCard[] teamCards = new TeamCard[TeamConst.MaxTeamCardCount];
|
|
public int GetTeamCardCount()
|
{
|
int count = 0;
|
for (int i = 0; i < teamCards.Length; i++)
|
{
|
if (teamCards[i] != null)
|
{
|
count++;
|
}
|
}
|
|
return count;
|
}
|
|
public bool SwapTeamCard(int index1, int index2)
|
{
|
if (index1 < 0 || index1 >= teamCards.Length || index2 < 0 || index2 >= teamCards.Length)
|
{
|
return false;
|
}
|
|
TeamCard temp = teamCards[index1];
|
teamCards[index1] = teamCards[index2];
|
teamCards[index2] = temp;
|
temp.cardIndex = index2;
|
teamCards[index1].cardIndex = index1;
|
|
return true;
|
}
|
|
public bool AddTeamCard(CardInfo cardInfo)
|
{
|
if (cardInfo == null)
|
{
|
return false;
|
}
|
|
for (int i = 0; i < teamCards.Length; i++)
|
{
|
if (teamCards[i] == null)
|
{
|
teamCards[i] = new TeamCard();
|
teamCards[i].cardInfo = cardInfo;
|
teamCards[i].cardIndex = i;
|
return true;
|
}
|
}
|
return false;
|
}
|
|
public bool RemoveTeamCard(int index)
|
{
|
if (index < 0 || index >= teamCards.Length)
|
{
|
return false;
|
}
|
|
teamCards[index] = null;
|
return true;
|
}
|
|
public bool IsFull()
|
{
|
return GetTeamCardCount() >= teamCards.Length;
|
}
|
|
public bool IsEmpty()
|
{
|
return GetTeamCardCount() == 0;
|
}
|
|
public void InitByLevelId(int levelId)
|
{
|
|
}
|
}
|