少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
49
50
51
52
53
54
55
56
57
58
59
60
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
 
 
namespace vnxbqy.UI
{
    public class RunePreviewCell : CellView
    {
        [SerializeField] List<RunePreviewData> m_RunePreviewList;
 
        public void Display(int _index, int _id)
        {
            m_RunePreviewList[_index].SetActive(_id != 0);
            if (_id != 0)
            {
                m_RunePreviewList[_index].Display(_id);
            }
        }
 
        [Serializable]
        public class RunePreviewData
        {
            [SerializeField] Image m_RuneIcon;
            [SerializeField] Text m_RuneName;
            [SerializeField] Button m_RuneBtn;
            [SerializeField] RectTransform m_Rune;
 
            RuneModel model { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
 
            public void Display(int _id)
            {
                ItemConfig _itemCfg = ItemConfig.Get(_id);
                m_RuneBtn.onClick.RemoveAllListeners();
                if (_itemCfg != null)
                {
                    m_RuneName.text = UIHelper.AppendColor(_itemCfg.ItemColor, _itemCfg.ItemName + "lv.1");
                    m_RuneIcon.SetSprite(_itemCfg.IconKey);
                    m_RuneBtn.onClick.AddListener(()=> 
                    {
                        ShowRunePath(_itemCfg);
                    });
                }
            }
 
            public void SetActive(bool _active)
            {
                m_Rune.SetActive(_active);
            }
 
            private void ShowRunePath(ItemConfig itemCfg)
            {
                ItemTipUtility.Show(itemCfg.ID);
            }
        }
    }
}