// Copyright (c) 2024 Augie R. Maddox, Guavaman Enterprises. All rights reserved. #pragma warning disable 0649 namespace Rewired.Glyphs { using Rewired; /// /// Options for Controller Element Glyph selection. /// [System.Serializable] public class ControllerElementGlyphSelectorOptions { [UnityEngine.Tooltip("Determines if the Player's last active controller is used for glyph selection.")] [UnityEngine.SerializeField] private bool _useLastActiveController = true; [UnityEngine.Tooltip( "List of controller type priority. " + "First in list corresponds to highest priority. " + "This determines which controller types take precedence when displaying glyphs. " + "If use last active controller is enabled, the active controller will always take priority, " + "however, if there is no last active controller, selection will fall back based on this priority. " + "In addition, keyboard and mouse are treated as a single controller for the purposes of glyph handling, " + "so to prioritze keyboard over mouse or vice versa, the one that is lower in the list will take precedence." )] [UnityEngine.SerializeField] private ControllerType[] _controllerTypeOrder = new ControllerType[] { ControllerType.Joystick, ControllerType.Custom, ControllerType.Mouse, ControllerType.Keyboard }; /// /// Determines if the Player's last active controller is used for glyph selection. /// public bool useLastActiveController { get { return _useLastActiveController; } set { _useLastActiveController = value; } } /// /// List of controller type priority. /// First in list corresponds to highest priority. /// This determines which controller types take precedence when displaying glyphs. /// If use last active controller is enabled, the active controller will always take priority, /// however, if there is no last active controller, selection will fall back based on this priority. /// In addition, keyboard and mouse are treated as a single controller for the purposes of glyph handling, /// so to prioritze keyboard over mouse or vice versa, the one that is lower in the list will take precedence. /// public ControllerType[] controllerTypeOrder { get { return _controllerTypeOrder; } set { _controllerTypeOrder = value; } } /// /// Gets the controller type priority for the specified index. /// /// The index. /// The result. /// True if the controller type was found, false if not. public virtual bool TryGetControllerTypeOrder(int index, out ControllerType controllerType) { if ((uint)index >= (uint)_controllerTypeOrder.Length) { controllerType = ControllerType.Keyboard; return false; } controllerType = _controllerTypeOrder[index]; return true; } private static ControllerElementGlyphSelectorOptions s_defaultOptions; /// /// The default options. /// Set this to override the default selector options. /// public static ControllerElementGlyphSelectorOptions defaultOptions { get { return s_defaultOptions != null ? s_defaultOptions : s_defaultOptions = new ControllerElementGlyphSelectorOptions(); } set { s_defaultOptions = value; } } } }