yyl
2025-05-15 d341a47ed9bbb740f2ccb9d6d42fd74d5a1c6b5d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
//  阵型基础
 
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)
    {
        
    }
}