// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using UnityEngine.EventSystems; namespace Microsoft.MixedReality.Toolkit.Input { /// /// Base class of all input events. /// public abstract class BaseInputEventData : BaseEventData { /// /// The UTC time at which the event occurred. /// public DateTime EventTime { get; private set; } /// /// The source the input event originates from. /// public IMixedRealityInputSource InputSource { get; private set; } /// /// The id of the source the event is from, for instance the hand id. /// public uint SourceId => InputSource.SourceId; /// /// The input action for this event. /// public MixedRealityInputAction MixedRealityInputAction { get; private set; } /// /// Constructor. /// /// Typically will be EventSystems.EventSystem.current protected BaseInputEventData(EventSystem eventSystem) : base(eventSystem) { } /// /// Used to initialize/reset the event and populate the data. /// protected void BaseInitialize(IMixedRealityInputSource inputSource, MixedRealityInputAction inputAction) { Reset(); EventTime = DateTime.UtcNow; InputSource = inputSource; MixedRealityInputAction = inputAction; } } }