备份CatanBuilding瘦身独立工程
This commit is contained in:
44
Assets/Scripts/UI/ChainPackBtn.cs
Normal file
44
Assets/Scripts/UI/ChainPackBtn.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user