2025-06-04 22:49:37 +08:00
/ *
* @author Valentin Simonov / http : //va.lent.in/
* /
using TouchScript.Gestures ;
using UnityEditor ;
using UnityEngine ;
namespace TouchScript.Editor.Gestures
{
[CustomEditor(typeof(LongPressGesture), true)]
internal sealed class LongPressGestureEditor : GestureEditor
{
2025-08-24 18:59:40 +08:00
public static readonly GUIContent TEXT_TIME_TO_PRESS = new GUIContent ( "Time to Press (sec)" , "Limit maximum number of simultaneous pointers." ) ;
public static readonly GUIContent TEXT_DISTANCE_LIMIT = new GUIContent ( "Limit Movement (cm)" , "Gesture fails if fingers move more than <Value> cm." ) ;
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
public static readonly GUIContent TEXT_HELP = new GUIContent ( "This component recognizes a gesture when this GameObject is being pressed for <TimeToPress> seconds." ) ;
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
private SerializedProperty distanceLimit , timeToPress ;
private SerializedProperty OnLongPress ;
2025-06-04 22:49:37 +08:00
protected override void OnEnable ( )
{
timeToPress = serializedObject . FindProperty ( "timeToPress" ) ;
distanceLimit = serializedObject . FindProperty ( "distanceLimit" ) ;
2025-08-24 18:59:40 +08:00
OnLongPress = serializedObject . FindProperty ( "OnLongPress" ) ;
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
base . OnEnable ( ) ;
2025-06-04 22:49:37 +08:00
}
2025-08-24 18:59:40 +08:00
protected override void drawBasic ( )
{
2025-06-04 22:49:37 +08:00
EditorGUILayout . PropertyField ( timeToPress , TEXT_TIME_TO_PRESS ) ;
2025-08-24 18:59:40 +08:00
}
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
protected override GUIContent getHelpText ( )
{
return TEXT_HELP ;
}
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
protected override void drawGeneral ( )
{
EditorGUILayout . PropertyField ( timeToPress , TEXT_TIME_TO_PRESS ) ;
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
base . drawGeneral ( ) ;
}
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
protected override void drawLimits ( )
{
2025-06-04 22:49:37 +08:00
EditorGUILayout . PropertyField ( distanceLimit , TEXT_DISTANCE_LIMIT ) ;
2025-08-24 18:59:40 +08:00
base . drawLimits ( ) ;
2025-06-04 22:49:37 +08:00
}
2025-08-24 18:59:40 +08:00
protected override void drawUnityEvents ( )
{
EditorGUILayout . PropertyField ( OnLongPress ) ;
2025-06-04 22:49:37 +08:00
2025-08-24 18:59:40 +08:00
base . drawUnityEvents ( ) ;
}
2025-06-04 22:49:37 +08:00
}
2025-08-24 18:59:40 +08:00
}