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;
|
}
|
}
|