少年修仙传客户端代码仓库
hch
2025-07-24 50e53441950268933694eeb5aad36147bbe1014d
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 vnxbqy.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
 
class EquGridBehaviour
{
    public Transform transform;
 
    public Button equGridBtn;
    ItemCell itemCell;
    Text equNameText;
    Text tipText;
    Transform bgImg;
    RedpointBehaviour redpointBehaviour;
 
    ItemModel itemModel;
 
    public void BindController(Transform transform, Action clickEvent, int redPointID)
    {
        this.transform = transform;
        this.equGridBtn = this.transform.GetComponentEx<Button>();
        this.itemCell = this.transform.FindComponentEx<ItemCell>("ItemCell");
        this.equNameText = this.transform.FindComponentEx<Text>("Text_EquName");
        this.tipText = this.transform.FindComponentEx<Text>("Text_Tip");
        this.bgImg = this.transform.Find("Img_Bg");
        this.redpointBehaviour = this.transform.FindComponentEx<RedpointBehaviour>("RedPoint");
        this.redpointBehaviour.redpointId = redPointID;
        this.itemCell.button.SetListener(() =>
        {
            ItemTipUtility.Show(this.itemModel.itemId);
        });
        this.equGridBtn.SetListener(() => { clickEvent(); });
    }
 
    public void Init(ItemModel itemModel, string equName)
    {
        this.itemModel = itemModel;
        if (this.itemModel == null)
        {
            this.bgImg.SetActiveIL(true);
            this.itemCell.SetActiveIL(false);
            this.equNameText.text = equName;
            this.tipText.SetActiveIL(true);
        }
        else
        {
            this.bgImg.SetActiveIL(false);
            this.itemCell.SetActiveIL(true);
            this.itemCell.Init(this.itemModel);
            this.equNameText.text = this.itemModel.config.ItemName;
            this.tipText.SetActiveIL(false);
        }
    }
 
}