41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UniRx;
|
|
using System;
|
|
using asap.core;
|
|
using GameCore;
|
|
using cfg;
|
|
|
|
public class HomeBtnRodSelection : MonoBehaviour
|
|
{
|
|
//private Image _icon;
|
|
private TMP_Text _textTimer;
|
|
private Button _btn;
|
|
private readonly RodSelectionPackData _rspd = GContext.container.Resolve<RodSelectionPackData>();
|
|
private TbItem _item;
|
|
private void Awake()
|
|
{
|
|
//_icon = transform.Find("icon").GetComponent<Image>();
|
|
_textTimer = transform.Find("text_time").GetComponent<TMP_Text>();
|
|
_btn = GetComponent<Button>();
|
|
_item = GContext.container.Resolve<Tables>().TbItem;
|
|
gameObject.SetActive( _rspd.IsPackActivated );
|
|
}
|
|
public void Start()
|
|
{
|
|
_textTimer.text = ConvertTools.ConvertTime2(_rspd.RemainingTime);
|
|
Observable.Interval(TimeSpan.FromSeconds(1.0f))
|
|
.Subscribe(_ => { _textTimer.text = ConvertTools.ConvertTime2(_rspd.RemainingTime);
|
|
gameObject.SetActive( _rspd.IsPackActivated );
|
|
})
|
|
.AddTo(this);
|
|
_btn.onClick.AddListener(() => UIManager.Instance.ShowUI(UITypes.GiftRodSelectionPopupPanel));
|
|
//GContext.OnEvent<GiftRodSelectEvent>()
|
|
// .Subscribe(e => { UIManager.Instance.SetImageSprite(_icon, _item[e.RodID].Icon); })
|
|
// .AddTo(this);
|
|
//GContext.Publish(new GiftRodSelectEvent(_rspd.RodID));
|
|
//UIManager.Instance.SetImageSprite(_icon, _item[_rspd.RodID].Icon);
|
|
}
|
|
}
|