56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
using Microsoft.MixedReality.Toolkit.Utilities;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace Microsoft.MixedReality.Toolkit.Input
|
|
{
|
|
/// <summary>
|
|
/// Describes an Input Event that has a source id.
|
|
/// </summary>
|
|
public class InputEventData : BaseInputEventData
|
|
{
|
|
/// <summary>
|
|
/// Handedness of the <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource"/>.
|
|
/// </summary>
|
|
public Handedness Handedness { get; private set; } = Handedness.None;
|
|
|
|
/// <inheritdoc />
|
|
public InputEventData(EventSystem eventSystem) : base(eventSystem) { }
|
|
|
|
/// <summary>
|
|
/// Used to initialize/reset the event and populate the data.
|
|
/// </summary>
|
|
public void Initialize(IMixedRealityInputSource inputSource, Handedness handedness, MixedRealityInputAction inputAction)
|
|
{
|
|
BaseInitialize(inputSource, inputAction);
|
|
Handedness = handedness;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Describes and input event with a specific type.
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
public class InputEventData<T> : InputEventData
|
|
{
|
|
/// <summary>
|
|
/// The input data of the event.
|
|
/// </summary>
|
|
public T InputData { get; private set; }
|
|
|
|
/// <inheritdoc />
|
|
public InputEventData(EventSystem eventSystem) : base(eventSystem) { }
|
|
|
|
/// <summary>
|
|
/// Used to initialize/reset the event and populate the data.
|
|
/// </summary>
|
|
public void Initialize(IMixedRealityInputSource inputSource, Handedness handedness, MixedRealityInputAction inputAction, T data)
|
|
{
|
|
Initialize(inputSource, handedness, inputAction);
|
|
InputData = data;
|
|
}
|
|
}
|
|
}
|