| 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); | 
|             } | 
|         } | 
|     } | 
| } |