yyl
3 天以前 68ceec72d78d328f9eaa05fce40caf99fe333ba1
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
using System;
using UnityEngine;
using UnityEngine.UI;
 
public class ChallengeTabButton : MonoBehaviour
{
    [SerializeField] Button btnTab;
    [SerializeField] ImageEx imgIcon;
    [SerializeField] TextEx txtName;
    [SerializeField] TextEx txtCount;
    [SerializeField] TextEx txtLockInfo;
    [SerializeField] Transform transUnlock;
    [SerializeField] RedpointBehaviour redpointBehaviour;
    Action action;
    void Awake()
    {
        btnTab.SetListener(() =>
        {
            action?.Invoke();
        });
    }
 
    public void Display(int index, int redpointId, bool isLock, string countInfo, string lockInfo, Action action)
    {
        redpointBehaviour.redpointId = redpointId;
        transUnlock.SetActive(!isLock);
        txtCount.SetActive(isLock);
        txtLockInfo.SetActive(!isLock);
        imgIcon.SetSprite(StringUtility.Contact("ChallengeTab", index));
        txtName.text = Language.Get(StringUtility.Contact("ChallengeTab", index));
        txtCount.text = countInfo;
        txtLockInfo.text = lockInfo;
        this.action = action;
    }
}