Maze / Library /PackageCache /com.unity.inputsystem@1.6.1 /InputSystem /Plugins /OnScreen /OnScreenButton.cs
| using System; | |
| using UnityEngine.EventSystems; | |
| using UnityEngine.InputSystem.Layouts; | |
| ////TODO: custom icon for OnScreenButton component | |
| namespace UnityEngine.InputSystem.OnScreen | |
| { | |
| /// <summary> | |
| /// A button that is visually represented on-screen and triggered by touch or other pointer | |
| /// input. | |
| /// </summary> | |
| [] | |
| [] | |
| public class OnScreenButton : OnScreenControl, IPointerDownHandler, IPointerUpHandler | |
| { | |
| public void OnPointerUp(PointerEventData eventData) | |
| { | |
| SendValueToControl(0.0f); | |
| } | |
| public void OnPointerDown(PointerEventData eventData) | |
| { | |
| SendValueToControl(1.0f); | |
| } | |
| ////TODO: pressure support | |
| /* | |
| /// <summary> | |
| /// If true, the button's value is driven from the pressure value of touch or pen input. | |
| /// </summary> | |
| /// <remarks> | |
| /// This essentially allows having trigger-like buttons as on-screen controls. | |
| /// </remarks> | |
| [SerializeField] private bool m_UsePressure; | |
| */ | |
| [] | |
| [] | |
| private string m_ControlPath; | |
| protected override string controlPathInternal | |
| { | |
| get => m_ControlPath; | |
| set => m_ControlPath = value; | |
| } | |
| } | |
| } | |