备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System.Threading.Tasks;
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventLuckMagicTaskRewardPopupPanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button btnClaim;
|
||||
[SerializeField] private RewardItemNew reward;
|
||||
[SerializeField] private GameObject goUpperTask, goLowerTask;
|
||||
private ItemData _rawRewardData;
|
||||
private TaskCompletionSource<bool> _taskCompletionSource;
|
||||
|
||||
public void Init(EventLuckMagicRewardPanelInfo info)
|
||||
{
|
||||
btnClaim.onClick.AddListener(OnClickClaim);
|
||||
bool isUpperTaskType = EventLuckMagicAct.TableContext.JudgeItemId(info.TaskItemId) == EEventLuckMagicItemType.UpperTaskItem;
|
||||
goUpperTask.SetActive(isUpperTaskType);
|
||||
goLowerTask.SetActive(!isUpperTaskType);
|
||||
reward.SetData(info.Reward);
|
||||
_rawRewardData = info.Reward;
|
||||
_taskCompletionSource = info.TaskCompletionSource;
|
||||
}
|
||||
|
||||
private async void OnClickClaim()
|
||||
{
|
||||
try
|
||||
{
|
||||
GContext.Publish(new EventRewardFlyStashRequest(_rawRewardData, reward.icon.GetComponent<RectTransform>()));
|
||||
btnClaim.gameObject.SetActive(false);
|
||||
await Task.Delay(System.TimeSpan.FromSeconds(
|
||||
GContext.container.Resolve<EventLuckMagicModel>().ParamsCtrl.RewardPopupPanelCloseDelay));
|
||||
_taskCompletionSource.SetResult(true);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventLuckMagicTaskRewardPopupPanel);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.Log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EventLuckMagicRewardPanelInfo
|
||||
{
|
||||
public ItemData Reward;
|
||||
public int TaskItemId;
|
||||
public TaskCompletionSource<bool> TaskCompletionSource;
|
||||
}
|
||||
Reference in New Issue
Block a user