备份CatanBuilding瘦身独立工程
This commit is contained in:
37
Assets/Scripts/UI/Shop/ThanksGivingEntranceButton.cs
Normal file
37
Assets/Scripts/UI/Shop/ThanksGivingEntranceButton.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UniRx;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ThanksGivingEntranceButton : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text textTimer;
|
||||
[SerializeField] private Button btn;
|
||||
[SerializeField] private Image icon;
|
||||
private ThanksGivingPackData _data;
|
||||
private const string RedPointKey = "home.thanks_giving";
|
||||
private void Awake()
|
||||
{
|
||||
_data = GContext.container.Resolve<FishingEventData>().ThanksGivingPackData;
|
||||
if (!_data.IsActive)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
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.IsActive)
|
||||
gameObject.SetActive(false);
|
||||
}).AddTo(this);
|
||||
btn.onClick.AddListener( _data.ShowChainPack);
|
||||
RedPointManager.Instance.SetRedPointState(RedPointKey, _data.DoNeedPackRedPoint);
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, _data.IconUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user