lcy
昨天 247c64258e0102a1028199f14866a1fd1c1a205f
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
using System.Collections.Generic;
using UnityEngine;
 
public class ArenaChallengeCell : MonoBehaviour
{
    [SerializeField] AvatarCell avatarCell;
    [SerializeField] TextEx txtName;
    [SerializeField] TextEx txtAddScore;
    [SerializeField] TextEx txtFightPoint;
    [SerializeField] OfficialTitleCell officialTitleCell;
    [SerializeField] List<ItemCell> itemCells;
    [SerializeField] ButtonEx btnChallenge;
    ArenaMatchInfo arenaMatchInfo;
    void Start()
    {
        btnChallenge.SetListener(() =>
        {
            if (arenaMatchInfo == null)
                return;
            // 货币不足
            if (!UIHelper.CheckMoneyCount(ArenaManager.Instance.ChallengeMoneyType, ArenaManager.Instance.NeedChallengeMoneyCnt, 1))
                return;
            ArenaManager.Instance.atkPlayerId = arenaMatchInfo.PlayerID;
            ArenaManager.Instance.SendTurnFight(arenaMatchInfo.PlayerID);
        });
    }
 
    public void Display(int index)
    {
        List<ArenaMatchInfo> list = ArenaManager.Instance.matchInfoList;
        if (list.IsNullOrEmpty() || index < 0 || index >= list.Count)
            return;
        arenaMatchInfo = list[index];
 
        avatarCell.InitUI(AvatarHelper.GetAvatarModel((int)arenaMatchInfo.PlayerID, (int)arenaMatchInfo.Face, (int)arenaMatchInfo.FacePic));
        txtName.text = UIHelper.ServerStringTrim(arenaMatchInfo.PlayerName);
        txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaMatchInfo.FightPower);
        txtAddScore.text = Language.Get("Arena16", ArenaManager.Instance.GetChallengePoints(index));
 
        officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID);
 
        int[][] rewards = ArenaManager.Instance.fixedChallengeRewards;
        for (int i = 0; i < itemCells.Count; i++)
        {
            var itemCell = itemCells[i];
            if (!rewards.IsNullOrEmpty() && i < rewards.Length)
            {
                int itemCellIndex = i;
                itemCell.SetActive(true);
                itemCell.Init(new ItemCellModel(rewards[i][0], true, rewards[i][1]));
                itemCell.button.SetListener(() => ItemTipUtility.Show(rewards[itemCellIndex][0], true));
            }
            else
            {
                itemCell.SetActive(false);
            }
        }
    }
}