add: Agent, ProxyMethod, LoadingScene

This commit is contained in:
h z
2025-02-11 15:07:41 +00:00
parent 2c1967982e
commit 9448715ad0
2 changed files with 24 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
<RootNamespace>Polonium.Tasks</RootNamespace> <RootNamespace>Polonium.Tasks</RootNamespace>
<AssemblyName>Polonium.Tasks</AssemblyName> <AssemblyName>Polonium.Tasks</AssemblyName>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.92-d</Version> <Version>0.1.0</Version>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateDependencyFile>true</GenerateDependencyFile> <GenerateDependencyFile>true</GenerateDependencyFile>
<TargetsForTfmSpecificBuildOutput> <TargetsForTfmSpecificBuildOutput>

View File

@@ -68,7 +68,29 @@ public class GenerateProxyNodesTask : Task
.AppendLine("using _BINDINGS_NAMESPACE_;") .AppendLine("using _BINDINGS_NAMESPACE_;")
.AppendLine("using System;") .AppendLine("using System;")
.AppendLine("public partial class _CLASS_ : GlobalClasses._CLASS_") .AppendLine("public partial class _CLASS_ : GlobalClasses._CLASS_")
.AppendLine("{") .AppendLine("{");
IEnumerable<MethodDeclarationSyntax> methods = cls.Members
.OfType<MethodDeclarationSyntax>()
.Where(m => m.AttributeLists
.SelectMany(a => a.Attributes)
.Any(attr => attr.Name.ToString().Contains("ProxyMethod"))
);
foreach (MethodDeclarationSyntax proxyMethod in methods)
{
string methodReturnType = proxyMethod.ReturnType.ToString();
string methodName = proxyMethod.Identifier.Text;
string methodArgs = string.Join(", ", proxyMethod.ParameterList.Parameters.Select(p => p.ToString()));
string paramNames = string.Join(", ", proxyMethod.ParameterList.Parameters.Select(p => p.Identifier.Text));
sbx
.AppendLine($" public override {methodReturnType} {methodName}({methodArgs})")
.AppendLine(" {");
if(methodReturnType=="void")
sbx.AppendLine($" base.{methodName}({paramNames});");
else
sbx.AppendLine($" return base.{methodName}({paramNames});");
sbx.AppendLine(" }");
}
sbx
.AppendLine("}"); .AppendLine("}");
if(!Directory.Exists($"{TemplateDirectory}/{className}")) if(!Directory.Exists($"{TemplateDirectory}/{className}"))
Directory.CreateDirectory($"{TemplateDirectory}/{className}"); Directory.CreateDirectory($"{TemplateDirectory}/{className}");