47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using AibisDream.Framework;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AibisDream.UI
|
|
{
|
|
public class SignBoard : MonoBehaviour
|
|
{
|
|
[SerializeField] private SignArea signArea;
|
|
[SerializeField] private Image icon;
|
|
|
|
public void ShowSignBoard()
|
|
{
|
|
gameObject.SetActive(true);
|
|
|
|
signArea.Init();
|
|
signArea.onLengthTargetExceeded += OnSignEnd;
|
|
|
|
icon.gameObject.SetActive(false);
|
|
icon.ResetReveal();
|
|
}
|
|
|
|
public void EnableSignBoard()
|
|
{
|
|
signArea.SetLocked(false);
|
|
}
|
|
|
|
public void CloseSignBoard()
|
|
{
|
|
gameObject.SetActive(false);
|
|
|
|
signArea.onLengthTargetExceeded -= OnSignEnd;
|
|
signArea.Dispose(); // Dispose 也会锁定,但这里显式调用确保状态正确
|
|
|
|
icon.gameObject.SetActive(false);
|
|
icon.ResetReveal();
|
|
}
|
|
|
|
private void OnSignEnd(float distance)
|
|
{
|
|
// 签名完成,打开成功标志
|
|
StartCoroutine(icon.RevealFromLeftAsync(1f, Ease.OutQuad));
|
|
}
|
|
}
|
|
}
|