lcy
2026-05-07 2dd1841d03a730d3d369092c2a3ad656cee4bf64
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
using System.Collections.Generic;
using UnityEngine;
 
public class ArenaChallengeCell : MonoBehaviour
{
    [SerializeField] AvatarCell avatarCell;
    [SerializeField] TextEx txtName;
    [SerializeField] TextEx txtAddScore;
    [SerializeField] TextEx txtServerName;
    [SerializeField] TextEx txtAddCrossScore;
    [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;
            BattleManager.Instance.SendTurnFight(3, 0, 1, (uint)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));
        avatarCell.SetListener(() =>
        {
            int serverID = (ArenaManager.Instance.IsOpenCrossServer() && arenaMatchInfo.PlayerID != PlayerDatas.Instance.baseData.PlayerID) ? (int)arenaMatchInfo.ServerID : 0;
            AvatarHelper.TryViewOtherPlayerInfo((int)arenaMatchInfo.PlayerID, serverID, viewPlayerLineupType: (int)BattlePreSetType.Arena);
        });
 
        txtName.text = UIHelper.ServerStringTrim(arenaMatchInfo.PlayerName);
        txtFightPoint.text = UIHelper.ReplaceLargeArtNum(arenaMatchInfo.FightPower);
        
        bool isCrossServer = ArenaManager.Instance.IsOpenCrossServer();
        if (isCrossServer)
        {
            txtAddScore.SetActive(false);
            txtServerName.SetActive(true);
            txtServerName.text = ServerListCenter.Instance.GetServerName((int)arenaMatchInfo.ServerID);
            txtAddCrossScore.SetActive(true);
            txtAddCrossScore.text = Language.Get("Arena16", ArenaManager.Instance.GetChallengePoints(index));
        }
        else
        {
            txtAddScore.SetActive(true);
            txtAddScore.text = Language.Get("Arena16", ArenaManager.Instance.GetChallengePoints(index));
            txtServerName.SetActive(false);
            txtAddCrossScore.SetActive(false);
        }
        
        officialTitleCell.InitUI(arenaMatchInfo.RealmLV, (int)arenaMatchInfo.TitleID, 0.55f);
 
        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]));
            }
            else
            {
                itemCell.SetActive(false);
            }
        }
    }
}