Lua向C#逻辑迁移 一期 #13

将整个插件代码上传
This commit is contained in:
2025-10-26 21:48:39 +08:00
parent 56994b3927
commit 648386cd73
785 changed files with 53683 additions and 2 deletions

View File

@ -0,0 +1,34 @@
using Mono.Cecil;
namespace UnrealSharpWeaver.Utilities;
public static class DelegateUtilities
{
public static MethodDefinition GetDelegateInvokeMethod(TypeDefinition typeDefinition)
{
foreach (MethodDefinition method in typeDefinition.Methods)
{
if (method.Name != "Invoke")
{
continue;
}
if (!method.ReturnsVoid())
{
throw new Exception($"{typeDefinition.FullName} is exposed to Unreal Engine, and must have a void return type.");
}
return method;
}
throw new Exception($"Delegate type {typeDefinition.FullName} does not have an Invoke method.");
}
public static string GetUnrealDelegateName(TypeReference typeDefinition)
{
string functionName = typeDefinition.FullName;
functionName = functionName.Replace(".", "_");
functionName += "__DelegateSignature";
return functionName;
}
}