备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using asap.core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventLuckMagicSkipAnimationBtn : MonoBehaviour
|
||||
{
|
||||
private bool _doesSkip;
|
||||
[SerializeField] private Button btn;
|
||||
[SerializeField] private GameObject mark;
|
||||
private float _clickInterval = 0.3f;
|
||||
private void Start()
|
||||
{
|
||||
btn.onClick.AddListener(OnClick);
|
||||
}
|
||||
public void Init()
|
||||
{
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
private void UpdateState()
|
||||
{
|
||||
var model = GContext.container.Resolve<EventLuckMagicModel>();
|
||||
_doesSkip = model.DoesSkipAnimation;
|
||||
mark.SetActive(_doesSkip);
|
||||
}
|
||||
|
||||
private void OnClick()
|
||||
{
|
||||
var model = GContext.container.Resolve<EventLuckMagicModel>();
|
||||
model.DoesSkipAnimation = !model.DoesSkipAnimation;
|
||||
UpdateState();
|
||||
btn.interactable = false;
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(ResetCountDown());
|
||||
}
|
||||
|
||||
private IEnumerator ResetCountDown()
|
||||
{
|
||||
yield return new WaitForSeconds(_clickInterval);
|
||||
btn.interactable = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user