using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; using System; using System.Collections.Generic; namespace vnxbqy.UI { public class LuckyAwardsGroup : ScrollerUI { [SerializeField] List awardCells = new List(); LuckyTreasureModel luckyTreasureModel { get { return ModelCenter.Instance.GetModel(); } } public override void Refresh(CellView cell) { int length = awardCells.Count; var treasureItems = luckyTreasureModel.GetOperation().luckTreasureItems; for (int i = 0; i < length; i++) { var awardCell = awardCells[i]; int index = cell.index * length + i; if(index < treasureItems.Count-1) { var treasureItem = treasureItems[index]; awardCell.itemBaisc.SetActive(true); ItemCellModel itemCellModel = new ItemCellModel(treasureItem.itemId,false,(ulong)treasureItem.itemCount); awardCell.itemBaisc.Init(itemCellModel); awardCell.itemBaisc.button.RemoveAllListeners(); awardCell.itemBaisc.button.AddListener(() => { ItemTipUtility.Show(treasureItem.itemId); }); } else { awardCell.itemBaisc.SetActive(false); } } } [Serializable] public class AwardCell { public CommonItemBaisc itemBaisc; } } }