using System; using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; namespace vnxbqy.UI { public class AutoTreasureAwardsRow : MonoBehaviour { [SerializeField] List awardItems = new List(); LuckyTreasureModel luckyTreasureModel { get { return ModelCenter.Instance.GetModel(); } } public void SetDisplay(int row) { int length = awardItems.Count; var autoLuckyItems = luckyTreasureModel.autoLuckyItems; for(int i = 0; i < length; i++) { var awardItem = awardItems[i]; int index = awardItems.Count * row + i; if(index < autoLuckyItems.Count) { awardItem.itemObj.SetActive(true); var luckyItem = autoLuckyItems[index]; ItemCellModel itemCellModel = new ItemCellModel(luckyItem.itemId,false,(ulong)luckyItem.itemCount); awardItem.itemBaisc.Init(itemCellModel); awardItem.itemBaisc.button.RemoveAllListeners(); awardItem.itemBaisc.button.AddListener(() => { ItemTipUtility.Show(luckyItem.itemId); }); } else { awardItem.itemObj.SetActive(false); } } } [Serializable] public class AwardItem { public GameObject itemObj; public CommonItemBaisc itemBaisc; } } }