YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
511 stars 91 forks source link

Expose DialogueRunner.AddCommandHandler(string commandName, Delegate handler) #196

Closed bergerbo closed 2 years ago

bergerbo commented 2 years ago

Hello!

DialogueRunner.AddCommandHandler has a lot of nice friendly overloads, however the Delegate one is not publicly exposed.

This is currently a problem for me because I need to do some more complex operations on my CommandHandlers, and would love to store them in a List<(string,Delegate)> where they can all rest independently of arity. (And then be iterated over and added to the DialogueRunner)

This request also extends to DialogueRunner.AddFunction!

Let me know if this sounds acceptable, and why if not

Thanks a lot for your work ! :)

desplesda commented 2 years ago

This sounds fine to me! They were initially private because I wanted to make sure that delegates of the right type that DialogueRunner uses, but being able to provide a Delegate makes sense to me (as long as you know what you're doing.)