| //--------------------------------------------------------  | 
| //    [Author]:           玩个游戏  | 
| //    [  Date ]:           Wednesday, September 26, 2018  | 
| //--------------------------------------------------------  | 
| using UnityEngine;  | 
| using System.Collections.Generic;  | 
|   | 
|   | 
|   | 
| public class CustomizedGiftChooseCell : CellView  | 
| {  | 
|     [SerializeField] List<ItemCell> itemCells;  | 
|     [SerializeField] List<ImageEx> images;  | 
|   | 
|   | 
|     public void Display(int index)  | 
|     {  | 
|         var selectItemInfo = CTGConfig.Get(CustomizedRechargeModel.Instance.chooseCTGID).SelectItemInfo;  | 
|         int chooseCount = selectItemInfo.Length;  | 
|   | 
|         for (int i = 0; i < itemCells.Count; i++)  | 
|         {  | 
|             int itemIndex = index * 7 + i;  | 
|             if (itemIndex < selectItemInfo[CustomizedRechargeModel.Instance.chooseWinIndex].Length)  | 
|             {  | 
|                 int selectID = selectItemInfo[CustomizedRechargeModel.Instance.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(CustomizedRechargeModel.Instance.GetChooseSubIndex(CustomizedRechargeModel.Instance.chooseWinIndex) - 1 == i);  | 
|                 itemCells[i].SetActive(true);  | 
|                 itemCells[i].Init(itemData);  | 
|                 itemCells[i].button.SetListener(() =>  | 
|                 {  | 
|                     CustomizedRechargeModel.Instance.chooseIndexDict[CustomizedRechargeModel.Instance.chooseWinIndex] = itemIndex + 1;  | 
|                     //选中后跳下一个  | 
|                     if (CustomizedRechargeModel.Instance.chooseWinIndex + 1 < chooseCount)  | 
|                     {  | 
|                         CustomizedRechargeModel.Instance.chooseWinIndex += 1;  | 
|                     }  | 
|                     else  | 
|                     {  | 
|                         CustomizedRechargeModel.Instance.chooseWinIndex = 0;  | 
|                     }  | 
|   | 
|                     CustomizedRechargeModel.Instance.UpdateWin?.Invoke();  | 
|                 });  | 
|             }  | 
|             else  | 
|             {  | 
|                 images[i].SetActive(false);  | 
|                 itemCells[i].SetActive(false);  | 
|             }  | 
|         }  | 
|     }  | 
| }  | 
|   | 
|   | 
|   |