备份CatanBuilding瘦身独立工程
This commit is contained in:
44
Assets/Scripts/SupplyDrop/SupplyDropRewardPanel.cs
Normal file
44
Assets/Scripts/SupplyDrop/SupplyDropRewardPanel.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user