/// <summary> /// Returns the first InputItem that matches the passed Identifier without removing it from the InputSet. /// Not recommended for most uses. /// </summary> /// <param name="match"></param> /// <param name="identifier"></param> /// <returns>If a match was found</returns> public bool View(out InputItem match, IInputIdentifier identifier) { foreach (InputItem input in inputs) { if (identifier.Matches(input)) { match = input; return(true); } } match = null; return(false); }
/// <summary> /// Removes the first input item that matches the Identifier from the list and returns it, thus preventing its use on other screens. /// </summary> /// <param name="identifier"></param> /// <returns>The first InputItem that matches, or null if none does.</returns> public bool Consume(out InputItem match, IInputIdentifier identifier) { for (int i = 0; i < inputs.Count; i++) { if (identifier.Matches(inputs[i])) { InputItem item = inputs[i]; inputs.RemoveAt(i); match = item; return(true); } } match = null; return(false); }