using System;
|
using UnityEngine;
|
|
public class GuildAtkDefBatChallengeDifficulty : MonoBehaviour
|
{
|
[SerializeField] TextEx defBaseAttrPerNumText;
|
[SerializeField] TextEx defStarNumText;
|
[SerializeField] ButtonEx challengeBtn;
|
|
private int difficultyIndex;
|
private int defBaseAttrPer;
|
private Action<int, int> onChallenge;
|
|
private void Awake()
|
{
|
challengeBtn.onClick.RemoveAllListeners();
|
challengeBtn.onClick.AddListener(OnClickChallenge);
|
}
|
|
public void Display(int index, int attrPer, int starNum, bool isKilled, Action<int, int> challengeCallback)
|
{
|
difficultyIndex = index;
|
defBaseAttrPer = attrPer;
|
onChallenge = challengeCallback;
|
|
defBaseAttrPerNumText.text = Language.Get("GuildAtkDefBat03",attrPer);
|
defStarNumText.text = starNum.ToString();
|
|
challengeBtn.interactable = !isKilled;
|
if (challengeBtn.image is ImageEx buttonImage)
|
{
|
buttonImage.gray = isKilled;
|
}
|
}
|
|
private void OnClickChallenge()
|
{
|
onChallenge?.Invoke(difficultyIndex, defBaseAttrPer);
|
}
|
}
|