hch
2025-07-30 bae41593e19d32046f77ed1f036089e015380b99
Main/Component/UI/Core/DelayButton.cs
@@ -1,5 +1,5 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [Author]:           玩个游戏
//    [  Date ]:           Monday, July 31, 2017
//--------------------------------------------------------
@@ -7,8 +7,7 @@
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace vnxbqy.UI {
using System;
    /// <summary>
    /// 延迟触发点击事件的按钮,用于长按事件
@@ -20,8 +19,8 @@
        public float delay { get { return m_Delay; } }
        [SerializeField]
        UIEvent m_OnClick;
        public UIEvent onClick { get { return m_OnClick; } }
        Action m_OnClick;
        public Action onClick { get { return m_OnClick; } }
        float timer = 0f;
        bool down = false;
@@ -45,15 +44,13 @@
                timer += Time.deltaTime;
                if(timer > delay) {
                    if(onClick != null) {
                        onClick.Invoke();
                        onClick?.Invoke();
                    }
                }
            }
        }
    }
}