45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using asap.core;
|
|
using GameCore;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ChainPackBtn : MonoBehaviour, IUIRedPoint
|
|
{
|
|
Button _button;
|
|
GameObject redpoint;
|
|
private ThanksGivingPackData _data;
|
|
private void Awake()
|
|
{
|
|
_data = GContext.container.Resolve<FishingEventData>().ChainPackWithProgressMigrationData;
|
|
_button = GetComponent<Button>();
|
|
redpoint = transform.Find("redpoint").gameObject;
|
|
if (!_data.IsActive)
|
|
{
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
}
|
|
private void Start()
|
|
{
|
|
_button.onClick.AddListener(OnClickChainPack);
|
|
}
|
|
private void OnClickChainPack()
|
|
{
|
|
_data.ShowChainPack();
|
|
}
|
|
void OnEnable()
|
|
{
|
|
RedPointManager.Instance.AddRedPoint(_data.RedPointKey, this);
|
|
SetRedPointState(_data.DoNeedPackRedPoint);
|
|
}
|
|
public void SetRedPointState(bool state)
|
|
{
|
|
redpoint.SetActive(state);
|
|
gameObject.SetActive(_data.IsActive);
|
|
}
|
|
private void OnDisable()
|
|
{
|
|
RedPointManager.Instance.RemoveRedPoint(_data.RedPointKey);
|
|
}
|
|
}
|