//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, September 26, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections.Generic; namespace vnxbqy.UI { public class CustomizedGiftChooseCell : CellView { [SerializeField] List itemCells; [SerializeField] List images; CustomizedRechargeModel model { get { return ModelCenter.Instance.GetModel(); } } public void Display(int index) { var selectItemInfo = CTGConfig.Get(model.chooseCTGID).SelectItemInfo; int chooseCount = selectItemInfo.Length; for (int i = 0; i < itemCells.Count; i++) { int itemIndex = index * 7 + i; if (itemIndex < selectItemInfo[model.chooseWinIndex].Length) { int selectID = selectItemInfo[model.chooseWinIndex][itemIndex]; int itemId = CTGSelectItemConfig.Get(selectID).ItemID; int count = CTGSelectItemConfig.Get(selectID).ItemCount; var itemData = new ItemCellModel((int)itemId, false, (ulong)count); images[i].SetActive(model.GetChooseSubIndex(model.chooseWinIndex) - 1 == i); itemCells[i].SetActive(true); itemCells[i].Init(itemData); itemCells[i].button.SetListener(() => { model.chooseIndexDict[model.chooseWinIndex] = itemIndex + 1; //选中后跳下一个 if (model.chooseWinIndex + 1 < chooseCount) { model.chooseWinIndex += 1; } else { model.chooseWinIndex = 0; } model.UpdateWin?.Invoke(); }); } else { images[i].SetActive(false); itemCells[i].SetActive(false); } } } } }