| | |
| | | { |
| | | [SerializeField] ImageEx imgRank; |
| | | [SerializeField] TextEx txtRank; |
| | | [SerializeField] ScrollerController itemScroller; |
| | | |
| | | private void OnDisable() |
| | | { |
| | | UnbindItemScroller(); |
| | | } |
| | | [SerializeField] ItemCell[] itemCells; |
| | | |
| | | public void Display(int rankA, int templateID) |
| | | { |
| | | UnbindItemScroller(); |
| | | var config = ActBillboardAwardConfig.GetConfig(templateID, rankA); |
| | | if (config == null) |
| | | { |
| | | itemScroller.Refresh(); |
| | | itemScroller.Restart(); |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | itemCells[i].SetActive(false); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | txtRank.text = Language.Get("Arena15", rankA, config.RankB); |
| | | } |
| | | |
| | | CreateItemScroller(config.AwardItemList); |
| | | } |
| | | |
| | | private void CreateItemScroller(int[][] rewardArr) |
| | | { |
| | | itemScroller.OnRefreshCell += OnRefreshItemCell; |
| | | itemScroller.OnRefreshCompleteEvent += OnRefreshItemComplete; |
| | | itemScroller.Refresh(); |
| | | for (int i = 0; i < rewardArr.Length; i++) |
| | | int[][] rewardArr = config.AwardItemList; |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | CellInfo info = new CellInfo(rewardArr[i][0], rewardArr[i][1], null); |
| | | itemScroller.AddCell(ScrollerDataType.Header, i, info); |
| | | var itemCell = itemCells[i]; |
| | | if (!rewardArr.IsNullOrEmpty() && i < rewardArr.Length) |
| | | { |
| | | int itemID = rewardArr[i][0]; |
| | | itemCell.SetActive(true); |
| | | itemCell.Init(new ItemCellModel(itemID, true, rewardArr[i][1])); |
| | | itemCell.SetClickListener(() => ItemTipUtility.Show(itemID, true)); |
| | | } |
| | | else |
| | | { |
| | | itemCell.SetActive(false); |
| | | } |
| | | } |
| | | itemScroller.Restart(); |
| | | } |
| | | |
| | | private void OnRefreshItemComplete() |
| | | { |
| | | UnbindItemScroller(); |
| | | } |
| | | |
| | | private void OnRefreshItemCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell.GetComponent<LianQiRankAwardItemCell>(); |
| | | _cell?.Display(cell); |
| | | } |
| | | |
| | | private void UnbindItemScroller() |
| | | { |
| | | itemScroller.OnRefreshCell -= OnRefreshItemCell; |
| | | itemScroller.OnRefreshCompleteEvent -= OnRefreshItemComplete; |
| | | } |
| | | } |