using System;
using System.Collections.Generic;
using UnityEngine.InputSystem.Utilities;
////TODO: move indexer up here
namespace UnityEngine.InputSystem
{
///
/// A collection of input actions (see ).
///
///
///
public interface IInputActionCollection : IEnumerable
{
///
/// Optional mask applied to all bindings in the collection.
///
///
/// If this is not null, only bindings that match the mask will be used.
///
/// Modifying this property while any of the actions in the collection are enabled will
/// lead to the actions getting disabled temporarily and then re-enabled.
///
InputBinding? bindingMask { get; set; }
////REVIEW: should this allow restricting to a set of controls instead of confining it to just devices?
///
/// Devices to use with the actions in this collection.
///
///
/// If this is set, actions in the collection will exclusively bind to devices
/// in the given list. For example, if two gamepads are present in the system yet
/// only one gamepad is listed here, then a "<Gamepad>/leftStick" binding will
/// only bind to the gamepad in the list and not to the one that is only available
/// globally.
///
/// Modifying this property after bindings in the collection have already been resolved,
/// will lead to getting refreshed. If any of the actions
/// in the collection are currently in progress (see ),
/// the actions will remain unaffected and in progress except if the controls currently
/// driving them (see ) are no longer part of any
/// of the selected devices. In that case, the action is .
///
ReadOnlyArray? devices { get; set; }
///
/// List of control schemes defined for the set of actions.
///
///
/// Control schemes are optional and the list may be empty.
///
ReadOnlyArray controlSchemes { get; }
///
/// Check whether the given action is contained in this collection.
///
/// An arbitrary input action.
/// True if the given action is contained in the collection, false if not.
///
/// Calling this method will not allocate GC memory (unlike when iterating generically
/// over the collection). Also, a collection may have a faster containment check rather than
/// having to search through all its actions.
///
bool Contains(InputAction action);
///
/// Enable all actions in the collection.
///
///
///
void Enable();
///
/// Disable all actions in the collection.
///
///
///
void Disable();
}
///
/// An extended version of .
///
///
/// This interface will be merged into in a future (major) version.
///
public interface IInputActionCollection2 : IInputActionCollection
{
///
/// Iterate over all bindings in the collection of actions.
///
///
///
///
IEnumerable bindings { get; }
///
/// Find an in the collection by its or
/// by its (in string form).
///
/// Name of the action as either a "map/action" combination (e.g. "gameplay/fire") or
/// a simple name. In the former case, the name is split at the '/' slash and the first part is used to find
/// a map with that name and the second part is used to find an action with that name inside the map. In the
/// latter case, all maps are searched in order and the first action that has the given name in any of the maps
/// is returned. Note that name comparisons are case-insensitive.
///
/// Alternatively, the given string can be a GUID as given by .
/// If true, instead of returning null when the action
/// cannot be found, throw ArgumentException.
/// The action with the corresponding name or null if no matching action could be found.
/// is null.
/// Thrown if is true and the
/// action could not be found. -Or- If contains a slash but is missing
/// either the action or the map name.
InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false);
///
/// Find the index of the first binding that matches the given mask.
///
/// A binding. See for details.
/// Receives the action on which the binding was found. If none was found,
/// will be set to null.
/// Index into of of the binding
/// that matches . If no binding matches, will return -1.
///
/// For details about matching bindings by a mask, see .
///
///
///
/// var index = playerInput.actions.FindBinding(
/// new InputBinding { path = "<Gamepad>/buttonSouth" },
/// out var action);
///
/// if (index != -1)
/// Debug.Log($"The A button is bound to {action}");
///
///
///
///
///
int FindBinding(InputBinding mask, out InputAction action);
}
}