/* Yarn Spinner is licensed to you under the terms found in the file LICENSE.md. */ using System; using System.Collections; using System.Reflection; using UnityEngine; #nullable enable namespace Yarn.Unity { /// /// Contains methods that allow adding and removing Yarn commands and /// functions. /// public interface IActionRegistration { /// /// Adds a command handler. Dialogue will pause execution after the /// command is called. /// /// /// When this command handler has been added, it can be called /// from your Yarn scripts like so: /// /// /// <<commandName param1 param2>> /// /// /// If is a method that returns a , when the command is run, the will wait for the returned coroutine to stop /// before delivering any more content. /// If is a method that returns an , when the command is run, the will start a coroutine using that method and /// wait for that coroutine to stop before delivering any more content. /// /// /// The name of the command. /// The that will be /// invoked when the command is called. void AddCommandHandler(string commandName, Delegate handler); /// /// The name of the command. /// The method that will be invoked when the /// command is called. void AddCommandHandler(string commandName, MethodInfo methodInfo); /// /// Removes a command handler. /// /// The name of the command to remove. void RemoveCommandHandler(string commandName); /// /// Add a new function that returns a value, so that it can be called /// from Yarn scripts. /// /// /// When this function has been registered, it can be called from /// your Yarn scripts like so: /// /// /// <<if myFunction(1, 2) == true>> /// myFunction returned true! /// <<endif>> /// /// /// The call command can also be used to invoke the function: /// /// /// <<call myFunction(1, 2)>> /// /// /// The name of the function to add. /// The that /// should be invoked when this function is called. /// void AddFunction(string name, Delegate implementation); /// /// Remove a registered function. /// /// /// After a function has been removed, it cannot be called from /// Yarn scripts. /// /// The name of the function to remove. /// void RemoveFunction(string name); /// /// Registers a function as existing, without supplying an implementation. /// /// The name of the function. /// The return type of the function. /// The types of the function's parameters. void RegisterFunctionDeclaration(string name, Type returnType, Type[] parameterTypes); } /// /// Contains extension methods for /// objects. /// public static class ActionRegistrationExtension { // These registrations for System.Action were generated by action-gyb.py /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Action handler) => registration.AddCommandHandler(commandName, (Delegate)handler); // These registrations for System.Threading.Tasks.Task were generated by action-gyb.py /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); // These registrations for YarnTask were generated by action-gyb.py /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); // These registrations for IEnumerator were generated by action-gyb.py /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); // These registrations for Coroutine were generated by action-gyb.py /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// public static void AddCommandHandler(this IActionRegistration registration, string commandName, System.Func handler) => registration.AddCommandHandler(commandName, (Delegate)handler); /// /// The result of the function. public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); /// public static void AddFunction(this IActionRegistration registration, string name, System.Func implementation) => registration.AddFunction(name, (Delegate)implementation); } }