少年修仙传客户端代码仓库
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
 
namespace vnxbqy.UI
{
    public class WayCell : MonoBehaviour
    {
        [SerializeField] Text m_WayName;
        [SerializeField] Text m_FunctionName;
        [SerializeField] Image m_Icon;
        [SerializeField] Button m_Goto;
 
        UnityAction onClick;
        int itemId = 0;
        int getWay = 0;
 
        public void Display(int itemId, int getWay)
        {
            this.itemId = itemId;
            this.getWay = getWay;
            var confg = GetItemWaysConfig.Get(getWay);
 
            m_Icon.SetSprite(confg.Icon);
            m_WayName.text = confg.Text;
            m_FunctionName.text = confg.name;
        }
 
        public void AddListener(UnityAction action)
        {
            onClick += action;
        }
 
        public void RemoveAllListeners()
        {
            onClick = null;
        }
 
        private void Start()
        {
            m_Goto.AddListener(OnClick);
        }
 
        private void OnClick()
        {
            if (onClick != null)
            {
                onClick.Invoke();
            }
 
            var config = GetItemWaysConfig.Get(getWay);
            if (config != null)
            {
                
                if (config.customize == 1)
                {
                    var ItemConfig = StoreConfig.GetStoreCfgByItemID(this.itemId);
                    if (ItemConfig != null)
                    {
                        var storeModel = ModelCenter.Instance.GetModel<StoreModel>();
                        storeModel.SetJumpToModel(this.itemId);
                        if (ItemConfig.SecondType.Length > 0)
                            storeModel.selectSecondType = ItemConfig.SecondType[0];
 
                    }
                }
                else if (config.customize/100 == 1)
                {
                    var storeModel = ModelCenter.Instance.GetModel<StoreModel>();
                    storeModel.SetJumpToModel(this.itemId);
                    storeModel.selectSecondType = config.customize%100;
                }
 
                WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)config.OpenpanelId);
            }
        }
 
    }
}