备份CatanBuilding瘦身独立工程
This commit is contained in:
39
Assets/Scripts/UI/Shop/BlackFridayEntranceButton.cs
Normal file
39
Assets/Scripts/UI/Shop/BlackFridayEntranceButton.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UniRx;
|
||||
using TMPro;
|
||||
using System;
|
||||
using GameCore;
|
||||
using asap.core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using cfg;
|
||||
|
||||
public class BlackFridayEntranceButton : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text textTimer;
|
||||
[SerializeField] private Button btn;
|
||||
[SerializeField] private Image icon;
|
||||
private BlackFridayCouponData _data;
|
||||
private void Awake()
|
||||
{
|
||||
_data = GContext.container.Resolve<PlayerShopData>().CouponData;
|
||||
if (_data is not {IsActive:true})
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon,
|
||||
GContext.container.Resolve<Tables>().TbEventCoupon[_data.RedirectId].Icon);
|
||||
textTimer.text = ConvertTools.ConvertTime2(_data.RemainingTime);
|
||||
if (_data.RemainingTime.TotalSeconds <= 0)
|
||||
gameObject.SetActive(false);
|
||||
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
|
||||
{
|
||||
textTimer.text = ConvertTools.ConvertTime2(_data.RemainingTime);
|
||||
if (_data.RemainingTime.TotalSeconds <= 0)
|
||||
gameObject.SetActive(false);
|
||||
}).AddTo(this);
|
||||
btn.onClick.AddListener(() => _ = UIManager.Instance.ShowUILoad(UITypes.BlackFridayPopupPanel));
|
||||
// RedPointManager.Instance.SetRedPointState(RedPointKey, _data.IsActive);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user