备份CatanBuilding瘦身独立工程
This commit is contained in:
68
Assets/Scripts/UI/RewardPopup/EventConvertedPopupPanel.cs
Normal file
68
Assets/Scripts/UI/RewardPopup/EventConvertedPopupPanel.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventConvertedPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_confrim;
|
||||
Button mask;
|
||||
TMP_Text text_activity;
|
||||
FishingEventData curFishingEventData;
|
||||
TransitionData curTransitionData;
|
||||
RewardItemNew reward1;
|
||||
RewardItemNew reward2;
|
||||
ItemData itemData1;
|
||||
ItemData itemData2;
|
||||
private void Awake()
|
||||
{
|
||||
curFishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
if (curFishingEventData.curTransitionData.Count == 0)
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventConvertedPopupPanel);
|
||||
return;
|
||||
}
|
||||
foreach (var item in curFishingEventData.curTransitionData)
|
||||
{
|
||||
curTransitionData = item.Value;
|
||||
break;
|
||||
}
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_confrim = transform.Find("root/btn_confrim/btn_green").GetComponent<Button>();
|
||||
mask = transform.Find("mask").GetComponent<Button>();
|
||||
text_activity = transform.Find("root/text_activity").GetComponent<TMP_Text>();
|
||||
reward1 = transform.Find("root/reward1").GetComponent<RewardItemNew>();
|
||||
reward2 = transform.Find("root/reward2").GetComponent<RewardItemNew>();
|
||||
text_activity.text = LocalizationMgr.GetText(curTransitionData.eventName);
|
||||
if (curTransitionData.eventID == 0)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
btn_confrim.onClick.AddListener(OnClickClose);
|
||||
mask.onClick.AddListener(OnClickClose);
|
||||
itemData1 = new ItemData(curTransitionData.sourceItemID, curTransitionData.sourceCount);
|
||||
itemData2 = new ItemData(curTransitionData.targetItemID, curTransitionData.targetCount);
|
||||
reward1.SetData(itemData1);
|
||||
reward2.SetData(itemData2);
|
||||
}
|
||||
async void OnClickClose()
|
||||
{
|
||||
btn_close.enabled = false;
|
||||
btn_confrim.enabled = false;
|
||||
mask.enabled = false;
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(itemData2);
|
||||
await reward2.ParticleAttractor();
|
||||
Close();
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventConvertedPopupPanel);
|
||||
curFishingEventData.ClearTransitionData(curTransitionData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user