using System; using System.Collections; using System.Collections.Generic; using asap.core; using GameCore; using UniRx; using UnityEngine; using UnityEngine.UI; namespace game { public class EventPotionRewardPopupPanel : MonoBehaviour { [SerializeField] private Button btnNormal; [SerializeField] private GameObject rewardRoot; [SerializeField] private ShootingRewardLayout normalRewardLayout; IDisposable disposable; public void Init(List rewardItems, bool isFinalStage = false) { btnNormal.onClick.AddListener(OnClickClaim); rewardRoot.SetActive(true); normalRewardLayout.SetRewards(rewardItems, true); } private void OnClickClaim() { CurRewardQCount curRewardQCount = new CurRewardQCount(); GContext.Publish(curRewardQCount); if (curRewardQCount.count <= 0) { Exit(); } else { disposable = GContext.OnEvent().Subscribe(OnRewardPanelClose); GContext.Publish(new ShowData()); } } void OnRewardPanelClose(RewardPanelClose rewardPanelClose) { Exit(); } void Exit() { disposable?.Dispose(); disposable = null; FishingPotionAct.Publish(new EventPotionCloseCameraData()); // 关闭当前Act GContext.Publish(new UnloadActToNextAct()); UIManager.Instance.DestroyUI(UITypes.EventPotionRewardPopupPanel); } } }