| using System.Collections.Generic;  | 
| using System.Linq;  | 
| using UnityEngine;  | 
|   | 
| public class ChooseItemsCell : CellView  | 
| {  | 
|     [SerializeField] ItemCell itemCell;  | 
|     [SerializeField] TextEx txtItemName;  | 
|     [SerializeField] TextEx txtNumber;  | 
|     [SerializeField] LongPressButton btnReduce;  | 
|     [SerializeField] LongPressButton btnPlus;  | 
|     [SerializeField] Transform numForm;  | 
|   | 
|     int itemId;  | 
|     string guid;  | 
|   | 
|     public void Display(int[] itemArr, string _guid )  | 
|     {  | 
|         this.itemId = itemArr[0];  | 
|         this.guid = _guid;  | 
|         ItemConfig itemConfig = ItemConfig.Get(itemId);  | 
|         int count = itemArr[1];  | 
|         itemCell.Init(new ItemCellModel(itemId, false, (ulong)count));  | 
|         itemCell.button.SetListener(() =>  | 
|         {  | 
|             ItemTipUtility.Show(itemId);  | 
|         });  | 
|         txtItemName.text = itemConfig.ItemName;  | 
|         txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";  | 
|   | 
|         if (string.IsNullOrEmpty(guid))  | 
|         {  | 
|             numForm.SetActive(false);  | 
|         }  | 
|         else  | 
|         {  | 
|             numForm.SetActive(true);  | 
|             btnPlus.onPress.RemoveAllListeners();  | 
|             btnPlus.SetListener(OnClickPlus);  | 
|             btnPlus.onPress.AddListener(OnClickPlus);  | 
|             btnReduce.onPress.RemoveAllListeners();  | 
|             btnReduce.SetListener(OnClickReduce);  | 
|             btnReduce.onPress.AddListener(OnClickReduce);  | 
|         }  | 
|     }  | 
|   | 
|     void OnClickPlus()  | 
|     {  | 
|         ItemModel itemModel = PackManager.Instance.GetItemByGuid(guid);  | 
|         if (itemModel == null)  | 
|             return;  | 
|   | 
|         if (BoxGetItemModel.Instance.GetNowChooseItemCount() >= itemModel.count)  | 
|             return;  | 
|         BoxGetItemModel.Instance.IncreaseUserChooseItemCount(itemId, itemModel.guid, itemId, 1);  | 
|         txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";  | 
|           | 
|     }  | 
|   | 
|     void OnClickReduce()  | 
|     {  | 
|         ItemModel itemModel = PackManager.Instance.GetItemByGuid(guid);  | 
|         if (itemModel == null)  | 
|             return;  | 
|         if (!BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId))  | 
|             return;  | 
|         if (BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt <= 0)  | 
|             return;  | 
|         BoxGetItemModel.Instance.IncreaseUserChooseItemCount(itemId, itemModel.guid, itemId, -1);  | 
|         txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";  | 
|           | 
|     }  | 
|   | 
| }  | 
|   | 
|   | 
|   | 
|   | 
|   |