/// <summary> /// A binding of a handler to the indicated key function, with the indicated dependencies. /// </summary> /// <param name="boundKeyFunction">key function this handler should handle</param> /// <param name="handler">handler to handle the input</param> /// <param name="before">If other types register bindings for this key function, this handler will always fire /// before them if they appear in this list.</param> /// <param name="after">If other types register bindings for this key function, this handler will always fire /// after them if they appear in this list.</param> public CommandBind(BoundKeyFunction boundKeyFunction, InputCmdHandler handler, IEnumerable <Type>?before = null, IEnumerable <Type>?after = null) { _boundKeyFunction = boundKeyFunction; _after = after ?? Enumerable.Empty <Type>(); _before = before ?? Enumerable.Empty <Type>(); _handler = handler; }
/// <summary> /// Bind the indicated handler to the indicated function. If other owner types register bindings for this key /// function, this handler will always fire before them if they appear in the "before" list. /// /// If multiple handlers in this builder are registered to the same key function, /// the handlers will fire in the order in which they were added to this builder. /// </summary> /// <param name="before">If other owner types register bindings for this key /// function, this handler will always fire before them if they appear in this list</param> public BindingsBuilder BindBefore(BoundKeyFunction function, InputCmdHandler command, params Type[] before) { return(Bind(new CommandBind(function, command, before))); }
/// <summary> /// Bind the indicated handler to the indicated function, with no /// particular dependency on bindings from other owner types. If multiple /// handlers in this builder are registered to the same key function, /// the handlers will fire in the order in which they were added to this builder. /// </summary> public BindingsBuilder Bind(BoundKeyFunction function, InputCmdHandler command) { return(Bind(new CommandBind(function, command))); }
/// <summary> /// Bind the indicated handler to the indicated function. If other owner types register bindings for this key /// function, this handler will always fire after them if they appear in the "after" list. /// /// If multiple handlers in this builder are registered to the same key function, /// the handlers will fire in the order in which they were added to this builder. /// </summary> /// <param name="after">If other owner types register bindings for this key /// function, this handler will always fire after them if they appear in this list</param> public BindingsBuilder BindAfter(BoundKeyFunction function, InputCmdHandler command, params Type[] after) { return(Bind(new CommandBind(function, command, after: after))); }