56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
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<ItemData> 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<RewardPanelClose>().Subscribe(OnRewardPanelClose);
|
|
GContext.Publish(new ShowData());
|
|
}
|
|
}
|
|
|
|
void OnRewardPanelClose(RewardPanelClose rewardPanelClose)
|
|
{
|
|
Exit();
|
|
}
|
|
|
|
void Exit()
|
|
{
|
|
disposable?.Dispose();
|
|
disposable = null;
|
|
FishingPotionAct.Publish<EventPotionCloseCameraData>(new EventPotionCloseCameraData());
|
|
// 关闭当前Act
|
|
GContext.Publish(new UnloadActToNextAct());
|
|
UIManager.Instance.DestroyUI(UITypes.EventPotionRewardPopupPanel);
|
|
}
|
|
}
|
|
}
|