备份CatanBuilding瘦身独立工程
This commit is contained in:
40
Assets/Scripts/EventBreak/EventBreakTaskRewardPopupPanel.cs
Normal file
40
Assets/Scripts/EventBreak/EventBreakTaskRewardPopupPanel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventBreakTaskRewardPopupPanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private RewardItemNew reward;
|
||||
[SerializeField] private GameObject[] gemBanners;
|
||||
[SerializeField] private Button btnClaim;
|
||||
private Action _action;
|
||||
|
||||
public void Init(ItemData rewardItem, int tunnelIdx, Action claimMark = null)
|
||||
{
|
||||
// Debug.Log($"[EventBreak] Init!!!!!!!!!!", this);
|
||||
reward.SetData(rewardItem, abbr: true);
|
||||
for (int i = 0; i < gemBanners.Length; i++)
|
||||
gemBanners[i].SetActive(i == tunnelIdx);
|
||||
btnClaim.onClick.AddListener(OnClaim);
|
||||
_action = claimMark;
|
||||
}
|
||||
|
||||
private async void OnClaim()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Debug.Log($"[EventBreak] Claim!!!!!!!!!!", this);
|
||||
btnClaim.onClick.RemoveAllListeners();
|
||||
_ = reward.ParticleAttractor();
|
||||
await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(1.2f));
|
||||
UIManager.Instance.DestroyUI(UITypes.EventBreakRewardPopupPanel);
|
||||
_action?.Invoke();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
btnClaim.onClick.AddListener(OnClaim);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user