长按Press 判断
private float _longClickDuration = 2f;
float _lastPress = -1f;
void OnPress(bool pressed)
{
if (pressed)
_lastPress = Time.realtimeSinceStartup;
else
{
if (Time.realtimeSinceStartup - _lastPress > _longClickDuration)
DoLongPress();
}
}
时间: 2024-10-13 12:34:24