少年修仙传客户端代码仓库
hch
2025-07-02 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
using vnxbqy.UI;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
public class ShentongLabCell : ILBehaviour
{
    Image chooseImg;
    Image lockImg;
    RedpointBehaviour redpoint;
    Text stName;
    Button outBtn;
    Text stateText;
    Transform skillOutStateObj;
    Text skillnum;
    Button selectBtn;
 
    protected override void Awake() 
    {
        chooseImg = proxy.GetWidgtEx<Image>("ChooseImage");
        lockImg = proxy.GetWidgtEx<Image>("lockImage");
        redpoint = proxy.GetWidgtEx<RedpointBehaviour>("RedPoint");
        stName = proxy.GetWidgtEx<Text>("name");
        outBtn = proxy.GetWidgtEx<Button>("outButton");
        stateText = proxy.GetWidgtEx<Text>("stateText");
        skillOutStateObj = proxy.GetWidgtEx<Transform>("skillOut");
        skillnum = proxy.GetWidgtEx<Text>("skillnum");
        selectBtn = proxy.GetWidgtEx<Button>("ShentongLabCell");
    }
 
    public void Display(int id)
    {
        if (id == ShentongModel.Instance.selectShentong)
        {
            chooseImg.SetActiveIL(true);
        }
        else
        {
            chooseImg.SetActiveIL(false);
        }
 
        lockImg.SetActiveIL(!ShentongModel.Instance.IsGubaoActive(id));
        redpoint.redpointId = ShentongModel.Instance.shentongPoint * 1000 + id;
 
        var config = ILShentongConfig.Get(id);
        var classLV = ShentongModel.Instance.shentongDict.ContainsKey(id) ? ShentongModel.Instance.shentongDict[id].ClassLV : 0;
        stName.text = config.Name + (classLV == 0 ? string.Empty : " " + Language.Get("L1091", classLV));
        stateText.text = Language.Get(ShentongModel.Instance.shentongIDSortBySkillID.Contains(id) ? "KnapS106" : "Shentong5");
        outBtn.SetActiveIL(ShentongModel.Instance.shentongIDToSkillID.ContainsKey(id));
        outBtn.SetListener(()=> {
            var index = ShentongModel.Instance.shentongIDSortBySkillID.IndexOf(id);
            if (index == -1)
            {
                //选择放置
                ShentongModel.Instance.selectShentong = id;
                ShentongModel.Instance.selectShentongSkillID = ShentongModel.Instance.shentongIDToSkillID[id];
            }
            else 
            {
                //卸下
                ShentongModel.Instance.shentongIDSortBySkillID[index] = 0;
                ShentongModel.Instance.shentongSetSkillIDs[index] = 0;
 
                ShentongModel.Instance.SetShentongSkill();
            }
        });
        skillOutStateObj.SetActiveIL(ShentongModel.Instance.shentongIDSortBySkillID.Contains(id));
        skillnum.text = (ShentongModel.Instance.shentongIDSortBySkillID.IndexOf(id) + 1).ToString();
 
        selectBtn.SetListener(()=> {
            ShentongModel.Instance.selectShentong = id;
        });
    }
 
}