// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Utilities; using System; using System.Linq; #if WINDOWS_UWP && !ENABLE_IL2CPP using System.Reflection; using Microsoft.MixedReality.Toolkit; #endif // WINDOWS_UWP && !ENABLE_IL2CPP namespace Microsoft.MixedReality.Toolkit.Input { /// /// Attach to a controller device class to make it show up in the controller mapping profile. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class MixedRealityControllerAttribute : Attribute { /// /// The SupportedControllerType to which the controller device belongs to. /// public SupportedControllerType SupportedControllerType { get; } /// /// List of handedness values supported by the respective controller. /// public Handedness[] SupportedHandedness { get; } /// /// Path to image file used when displaying an icon in the UI. /// public string TexturePath { get; } /// /// Additional flags for configuring controller capabilities. /// public MixedRealityControllerConfigurationFlags Flags { get; } /// /// The supported Unity XR pipelines for this controller. /// public SupportedUnityXRPipelines SupportedUnityXRPipelines { get; } /// /// Constructor. /// public MixedRealityControllerAttribute( SupportedControllerType supportedControllerType, Handedness[] supportedHandedness, string texturePath = "", MixedRealityControllerConfigurationFlags flags = 0, SupportedUnityXRPipelines supportedUnityXRPipelines = (SupportedUnityXRPipelines)(-1)) { SupportedControllerType = supportedControllerType; SupportedHandedness = supportedHandedness; TexturePath = texturePath; Flags = flags; SupportedUnityXRPipelines = supportedUnityXRPipelines; } /// /// Convenience function for retrieving the attribute given a certain class type. /// public static MixedRealityControllerAttribute Find(Type type) { return type.GetCustomAttributes(typeof(MixedRealityControllerAttribute), true).FirstOrDefault() as MixedRealityControllerAttribute; } } }