using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
public class DungeonSuperGiftBehaviour : MonoBehaviour
|
{
|
[SerializeField] int m_PayType;
|
[SerializeField] Transform m_ContainerRemind;
|
[SerializeField] Button m_Goto;
|
[SerializeField] int m_JumpType;
|
[SerializeField] float m_AutoCloseSeconds = 5f;
|
|
Clock clock;
|
|
OSGiftModel model { get { return ModelCenter.Instance.GetModel<OSGiftModel>(); } }
|
VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
|
private void Awake()
|
{
|
m_Goto.AddListener(() =>
|
{
|
WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)m_JumpType);
|
});
|
}
|
|
public void Display()
|
{
|
bool requireDisplay = false;
|
|
m_ContainerRemind.SetActive(true);
|
|
var mapId = PlayerDatas.Instance.baseData.MapID;
|
if (mapId == 31080)
|
{
|
if (model.IsGiftExist(m_PayType))
|
{
|
requireDisplay = true;
|
}
|
}
|
|
this.SetActive(requireDisplay);
|
|
if (requireDisplay)
|
{
|
clock = Clock.AlarmAfter(m_AutoCloseSeconds, () =>
|
{
|
m_ContainerRemind.SetActive(false);
|
});
|
}
|
|
vipModel.rechargeCountEvent -= RechargeCountEvent;
|
vipModel.rechargeCountEvent += RechargeCountEvent;
|
}
|
|
private void RechargeCountEvent(int id)
|
{
|
this.SetActive(model.IsGiftExist(m_PayType));
|
}
|
|
public void Dispose()
|
{
|
vipModel.rechargeCountEvent -= RechargeCountEvent;
|
|
if (clock != null)
|
{
|
Clock.Stop(clock);
|
clock = null;
|
}
|
}
|
}
|
}
|
|