45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SupplyDropRewardPanel : MonoBehaviour
|
|
{
|
|
Action OnClickClaim;
|
|
Button btnClaim;
|
|
GameObject title;
|
|
GameObject receive;
|
|
TMP_Text text_info;
|
|
private void Awake()
|
|
{
|
|
title = transform.Find("root").gameObject;
|
|
receive = transform.Find("receive").gameObject;
|
|
btnClaim = transform.Find("receive/btn_play/btn_green").GetComponent<Button>();
|
|
text_info = transform.Find("root/title/text_info").GetComponent<TMP_Text>();
|
|
}
|
|
private void Start()
|
|
{
|
|
btnClaim.onClick.AddListener(OnClickClaimButton);
|
|
}
|
|
public void Init(string name, float supplyDropTitleDelay, Action onCloseClaim)
|
|
{
|
|
StartCoroutine(ShowTitle(supplyDropTitleDelay));
|
|
OnClickClaim = onCloseClaim;
|
|
text_info.text = name;
|
|
}
|
|
void OnClickClaimButton()
|
|
{
|
|
OnClickClaim?.Invoke();
|
|
}
|
|
public void ShowClaim()
|
|
{
|
|
receive.SetActive(true);
|
|
}
|
|
IEnumerator ShowTitle(float supplyDropTitleDelay)
|
|
{
|
|
yield return new WaitForSeconds(supplyDropTitleDelay);
|
|
title.SetActive(true);
|
|
}
|
|
}
|