Action
(no declaration available)Inherits from System.Object
Implements System.IEquatable{Yarn.Shared.Action}
#Constructors
#Action(string, string, string, ActionType, bool, ReturnType, NamedType, Parameter[])
public Action(string Name, string FullMethodName, string ShortMethodName, ActionType Type, bool HasTarget, ReturnType ReturnType, NamedType Container, Parameter[] Parameters)Parameters
NamestringThe name of the action itself. it's Yarn NameFullMethodNamestringThe fully qualified name of the method that is being used to define this actionShortMethodNamestringA shorter convenience form of the full method name- Is the action a command or function?
HasTargetboolIs the action an instance action or not?ReturnTypeYarn.Shared.ReturnTypeWhat type the action returnsContainerYarn.Shared.NamedTypeThe type that the method lives within. This is necessary for other parts to verify and double check if the method can be called and howParametersYarn.Shared.Parameter[]The parameters of the action. The order of this array must reflect the order of both the yarn and c# side
Returns Void
Actions are a common shared type across numerous different parts of Yarn Spinner and it's not expected that you would be creating one yourself. They are made by the source generator and analysers and used as part of the diagnostic system, the command and function invocation system, ysls generation, and compilation.
This class should be always kept in a form where it cache and comparison friendly as this type is a common output of a lot of other elements of the analysis pipeline which do caching. Types contained within should always be either a basic type or a record basically.
#Fields
#containingNamedType
public NamedType containingNamedType;Type NamedType
#Parameters
public Parameter[] Parameters;#Properties
#containingTypeFullName
public string containingTypeFullName { get; }Type String
#containingTypeShortName
public string containingTypeShortName { get; }Type String
#DeclarationType
public DeclarationType DeclarationType { get; internal set; }Type DeclarationType
#HasDefaultParameters
public bool HasDefaultParameters { get; }Type Boolean
#HasParameterArray
public bool HasParameterArray { get; }Type Boolean
#IsAsync
public bool IsAsync { get; }Type Boolean
#IsInstance
public bool IsInstance { get; internal set; }Type Boolean
#MethodName
public string? MethodName { get; set; }Type Nullable
#Name
public string Name { get; internal set; }Type String
#NumberOfParameters
public (int min, int max) NumberOfParameters { get; }Type ValueTuple
- commands are always one parameter more than functions due to the name of the command being a part of the invocation.
- instance methods have an additional parameter which is the lookup of the target of the action.
- optional parameters and array parameters can change the minimum and maximum number of parameters to a minimum of 0 and maximum of 8196.
- cancellation tokens aren't a parameter as far as yarn is concerned.
#Return
public ReturnType Return { get; internal set; }Type ReturnType
#ShortMethodName
global:: bits.public string? ShortMethodName { get; set; }Type Nullable
#Type
#Usage
public string Usage { get; }Type String
#Methods
#ConverterCallingString(string, IReadOnlyList<YarnConverter>, ILogger?)
public static string? ConverterCallingString(string paramType, IReadOnlyList<YarnConverter> converters, ILogger? logger)Parameters
paramTypestringThe fully qualified type name, it MUST be the fully qualified name!convertersIReadOnlyList<Yarn.Shared.YarnConverter>The list of converters, one of which hopefully know about the typeloggerYarn.Shared.ILoggerThe logger, will likely be null
Returns Nullable: The string representation of a method call for the converter of the requested type, or null if it couldn't find one.
#DetermineParameterTypeFromNamedTypeForUnity(NamedType, IReadOnlyList<YarnConverter>, ILogger?)
public static ParameterTypes DetermineParameterTypeFromNamedTypeForUnity(NamedType namedType, IReadOnlyList<YarnConverter> converters, ILogger? logger = null)Parameters
namedTypeYarn.Shared.NamedTypeThe type to be converted and validatedconvertersIReadOnlyList<Yarn.Shared.YarnConverter>The list of converters available to help determine the typeloggerYarn.Shared.ILoggerA logger, will almost certainly be null
Returns ParameterTypes: The type of the parameter of the named type depending on the whims and needs of Unity.
#TryValidateAction(Action, IReadOnlyList<YarnConverter>, ILogger?, bool)
public static bool TryValidateAction(Action action, IReadOnlyList<YarnConverter> converters, ILogger? logger = null, bool isUnknownParameterInvalid = true)Parameters
actionYarn.Shared.ActionThe action seeking validationconvertersIReadOnlyList<Yarn.Shared.YarnConverter>List of converters needed to validate any unknown parametersloggerYarn.Shared.ILoggerThe logger, most likely will be nullisUnknownParameterInvalidboolIf this is true an unknown parameter that doesn't eventually find a converter in theconverterslist will cause validation to fail. If set to false the opposite is true, an unresolved param doesn't prevent validation. This is needed because of runtime actions in Unity, we won't be able to guarantee they have a converter (because it might live in a different assembly) for them at compile time so have to trust that there will be one a runtime.
Returns Boolean: True if the action passed validation
Generated from Yarn Spinner for Unity 3.3.