A game about forced loneliness, made by TACStudios
1////REVIEW: could have a monitor path where if there's multiple state monitors on the same control with
2//// the same listener, the monitor is notified only once but made aware of the multiple triggers
3
4namespace UnityEngine.InputSystem.LowLevel
5{
6 /// <summary>
7 /// Interface used to monitor input state changes.
8 /// </summary>
9 /// <remarks>
10 /// Use <see cref="InputState.AddChangeMonitor(InputControl,IInputStateChangeMonitor,long,uint)"/> to install a state change monitor receiving state change
11 /// callbacks for a specific control.
12 /// </remarks>
13 /// <seealso cref="InputState.AddChangeMonitor(InputControl,IInputStateChangeMonitor,long,uint)"/>
14 public interface IInputStateChangeMonitor
15 {
16 ////REVIEW: For v2, consider changing the signature of this to put the "was consumed" signal *outside* the eventPtr
17 /// <summary>
18 /// Called when the state monitored by a state change monitor has been modified.
19 /// </summary>
20 /// <param name="control">Control that is being monitored by the state change monitor and that had its state
21 /// memory changed.</param>
22 /// <param name="time">Time on the <see cref="InputEvent.time"/> timeline at which the control state change was received.</param>
23 /// <param name="eventPtr">If the state change was initiated by a state event (either a <see cref="StateEvent"/>
24 /// or <see cref="DeltaStateEvent"/>), this is the pointer to that event. Otherwise it is pointer that is still
25 /// <see cref="InputEventPtr.valid"/>, but refers a "dummy" event that is not a <see cref="StateEvent"/> or <see cref="DeltaStateEvent"/>.</param>
26 /// <param name="monitorIndex">Index of the monitor as passed to <see cref="InputState.AddChangeMonitor(InputControl,IInputStateChangeMonitor,long,uint)"/>.
27 /// </param>
28 /// <remarks>
29 /// To signal that the state change has been processed by the monitor and that no other pending notifications on the
30 /// same monitor instance should be sent, set the <see cref="InputEventPtr.handled"/> flag to <c>true</c> on <paramref name="eventPtr"/>.
31 /// Note, however, that aside from only silencing change monitors on the same <see cref="IInputStateChangeMonitor"/> instance,
32 /// it also only silences change monitors with the same <c>groupIndex</c> value as supplied to
33 /// <see cref="InputState.AddChangeMonitor(InputControl,IInputStateChangeMonitor,long,uint)"/>.
34 /// </remarks>
35 void NotifyControlStateChanged(InputControl control, double time, InputEventPtr eventPtr, long monitorIndex);
36
37 /// <summary>
38 /// Called when a timeout set on a state change monitor has expired.
39 /// </summary>
40 /// <param name="control">Control on which the timeout expired.</param>
41 /// <param name="time">Input time at which the timer expired. This is the time at which an <see cref="InputSystem.Update"/> is being
42 /// run whose <see cref="InputState.currentTime"/> is past the time of expiration.</param>
43 /// <param name="monitorIndex">Index of the monitor as given to <see cref="InputState.AddChangeMonitor(InputControl,IInputStateChangeMonitor,long,uint)"/>.</param>
44 /// <param name="timerIndex">Index of the timer as given to <see cref="InputState.AddChangeMonitorTimeout"/>.</param>
45 /// <seealso cref="InputState.AddChangeMonitorTimeout"/>
46 void NotifyTimerExpired(InputControl control, double time, long monitorIndex, int timerIndex);
47 }
48}