少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
 
 
namespace vnxbqy.UI
{
    public class PoolItemCell : MonoBehaviour,IDragHandler
    {
        [SerializeField] CommonItemBaisc itemBaisc;
        [SerializeField] Image bestIcon;
        [SerializeField] Text nameText;
        
        WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
        int index = -1;
 
        public void OnDrag(PointerEventData eventData)
        {
            wishingModel.isDraging = true;
            wishingModel.dragIndex = index;
        }
      
        public void Display(int index)
        {
            this.index = index;
            WishingPoolModel.WishingWellItem wellItem = null;
            bool isPoolData = wishingModel.TryGetPoolDataByIndex(index,out wellItem);
            ItemConfig itemConfig = ItemConfig.Get(wellItem.itemId);
            nameText.text = itemConfig.ItemName;
            nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor);
            string rareIconKey = string.Empty;
            bool isRare = wishingModel.TryGetItemRareIcon(wellItem.rare,out rareIconKey);
            bestIcon.SetActive(isRare);
            if(isRare)
            {
                bestIcon.SetSprite(rareIconKey);
            }
            ItemCellModel cellModel = new ItemCellModel(wellItem.itemId,false,(ulong)wellItem.itemCount);
            itemBaisc.Init(cellModel);
            itemBaisc.button.RemoveAllListeners();
            itemBaisc.button.AddListener(()=>
            {
                ItemTipUtility.Show(wellItem.itemId);
            });
        }
 
    }
}