Add support for Events in Scripting API reflection in Editor
This commit is contained in:
@@ -50,6 +50,9 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public bool IsMethod => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEvent => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasGet => true;
|
||||
|
||||
@@ -174,6 +177,9 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public bool IsMethod => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEvent => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasGet => false;
|
||||
|
||||
|
||||
@@ -138,6 +138,11 @@ namespace FlaxEditor.Scripting
|
||||
/// </summary>
|
||||
public bool IsMethod => _managed is MethodInfo || (_custom?.IsMethod ?? false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this member is an event.
|
||||
/// </summary>
|
||||
public bool IsEvent => _managed is EventInfo || (_custom?.IsEvent ?? false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this member value can be gathered (via getter method or directly from the field).
|
||||
/// </summary>
|
||||
@@ -383,7 +388,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the method parameters metadata.
|
||||
/// Gets the method parameters metadata (or event delegate signature parameters).
|
||||
/// </summary>
|
||||
public Parameter[] GetParameters()
|
||||
{
|
||||
@@ -416,6 +421,11 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (_managed is EventInfo eventInfo)
|
||||
{
|
||||
var invokeMethod = eventInfo.EventHandlerType.GetMethod("Invoke");
|
||||
return new ScriptMemberInfo(invokeMethod).GetParameters();
|
||||
}
|
||||
return _custom.GetParameters();
|
||||
}
|
||||
|
||||
@@ -634,6 +644,11 @@ namespace FlaxEditor.Scripting
|
||||
/// </summary>
|
||||
public static readonly ScriptType Null;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="ScriptType" /> that is System.Void.
|
||||
/// </summary>
|
||||
public static readonly ScriptType Void = new ScriptType(typeof(void));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the script as <see cref="System.Type"/>.
|
||||
/// </summary>
|
||||
@@ -1463,6 +1478,11 @@ namespace FlaxEditor.Scripting
|
||||
/// </summary>
|
||||
bool IsMethod { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this member is an event.
|
||||
/// </summary>
|
||||
bool IsEvent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this member value can be gathered (via getter method or directly from the field).
|
||||
/// </summary>
|
||||
@@ -1504,7 +1524,7 @@ namespace FlaxEditor.Scripting
|
||||
object[] GetAttributes(bool inherit);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the method parameters metadata.
|
||||
/// Gets the method parameters metadata (or event delegate signature parameters).
|
||||
/// </summary>
|
||||
ScriptMemberInfo.Parameter[] GetParameters();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user