using System; using UnityEngine; namespace Wizard; public class PuzzleWinConditionDisplay : MonoBehaviour { [SerializeField] private UILabel _winConditionLabel; [SerializeField] private UIButton _button; [SerializeField] private UIPanel _panel; private bool _isAppeared; private Action _onComplete; private const float APPEAR_DURATION = 0.5f; private const float DISAPPEAR_DURATION = 0.1f; public void Setup(string winConditionText, Action onComplete) { _winConditionLabel.text = winConditionText; _panel.alpha = 0f; _button.onClick.Add(new EventDelegate(OnClick)); _onComplete = onComplete; TweenAlpha.Begin(base.gameObject, 0.5f, 1f).onFinished.Add(new EventDelegate(delegate { _isAppeared = true; })); } private void OnClick() { if (_isAppeared) { GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); TweenAlpha.Begin(base.gameObject, 0.1f, 0f).onFinished.Add(new EventDelegate(delegate { _onComplete(); })); } } }