diff --git a/Package/build/Polonium.Tasks.props b/Package/build/Polonium.Tasks.props
index 59ad64b..5064ec7 100644
--- a/Package/build/Polonium.Tasks.props
+++ b/Package/build/Polonium.Tasks.props
@@ -1,11 +1,16 @@
+
- $(MSBuildThisFileDirectory)tasks/netstandard2.0/
- $(CustomTasksFolder)$(MSBuildThisFileName).dll
+ $(MSBuildThisFileDirectory)tasks/netstandard2.0/
+ $(TasksFolder)$(MSBuildThisFileName).dll
-
+
\ No newline at end of file
diff --git a/Package/build/Polonium.Tasks.targets b/Package/build/Polonium.Tasks.targets
index 0dfb6a3..6df0c26 100644
--- a/Package/build/Polonium.Tasks.targets
+++ b/Package/build/Polonium.Tasks.targets
@@ -1,3 +1,6 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/Polonium.Tasks.csproj b/Polonium.Tasks.csproj
index b7b9852..35956b3 100644
--- a/Polonium.Tasks.csproj
+++ b/Polonium.Tasks.csproj
@@ -33,37 +33,21 @@
Version="4.12.0"
PrivateAssets="all"
/>
-
-
-
ResXFileCodeGenerator
Resources.Designer.cs
-
-
-
True
True
Resources.resx
-
-
-
-
-
-
-
-
-
+
+
@@ -75,8 +59,8 @@
@@ -102,8 +86,4 @@
-
-
-
-
diff --git a/src/GenerateProxyNodesTask.cs b/src/GenerateProxyNodesTask.cs
index 8cb00ce..8fcb57f 100644
--- a/src/GenerateProxyNodesTask.cs
+++ b/src/GenerateProxyNodesTask.cs
@@ -1,4 +1,3 @@
-
using System;
using System.Collections.Generic;
using System.IO;
@@ -47,7 +46,7 @@ public class GenerateProxyNodesTask : Task
.AppendLine("// meta-default: true")
.AppendLine("using _BINDINGS_NAMESPACE_;")
.AppendLine("using System;")
- .AppendLine("public partial class _CLASS_ : GlobalClasses._CLASS_")
+ .AppendLine($"public partial class _CLASS_ : {GetDisplayName(cls)}")
.AppendLine("{");
IEnumerable methods = cls.Members
.OfType()
@@ -55,6 +54,17 @@ public class GenerateProxyNodesTask : Task
.SelectMany(a => a.Attributes)
.Any(attr => attr.Name.ToString().Contains("ProxyMethod"))
);
+ IEnumerable properties = cls.Members
+ .OfType()
+ .Where(m => m.AttributeLists
+ .SelectMany(a => a.Attributes)
+ .Any(attr => attr.Name.ToString().Contains("ProxyProperty"))
+ );
+ foreach (PropertyDeclarationSyntax prop in properties)
+ {
+ sbx.AppendLine($" public override {prop.Type.ToString()} {prop.Identifier.ToString()} => base.{prop.Identifier.ToString()};");
+ }
+
foreach (MethodDeclarationSyntax proxyMethod in methods)
{
string methodReturnType = proxyMethod.ReturnType.ToString();
diff --git a/src/GenerateTextureSetTask.cs b/src/GenerateTextureSetTask.cs
new file mode 100644
index 0000000..759029a
--- /dev/null
+++ b/src/GenerateTextureSetTask.cs
@@ -0,0 +1,113 @@
+using System;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Polonium.Tasks;
+
+public class GenerateTextureSetTask : Task
+{
+ [Required]
+ public string RootPath { get; set; }
+ [Required]
+ public string OutputPath { get; set; }
+
+
+ public override bool Execute()
+ {
+ try
+ {
+ if (!Directory.Exists(RootPath))
+ {
+ Log.LogError($"Root path does not exist: {RootPath}");
+ return false;
+ }
+
+ string[] textureSetDirs = Directory.GetDirectories(RootPath, "*.TextureSet", SearchOption.AllDirectories);
+ StringBuilder sb = new StringBuilder();
+ sb
+ .AppendLine("using System;")
+ .AppendLine("using Polonium.Attributes;")
+ .AppendLine("[AutoRegister]")
+ .AppendLine("public class TextureSetMapRegister")
+ .AppendLine("{")
+ .AppendLine(" public static void Register()")
+ .AppendLine(" {");
+ StringBuilder sbx = new StringBuilder();
+ sbx
+ .AppendLine("using System;")
+ .AppendLine("using System.Collections.Generic;")
+ .AppendLine("using Polonium.DataStructures;")
+ .AppendLine("public static partial class GlobalRegistry")
+ .AppendLine("{")
+ .AppendLine(" public static Dictionary TextureSetMap = new();")
+ .AppendLine(" public enum TextureSetName")
+ .AppendLine(" {");
+
+ foreach (string dir in textureSetDirs)
+ {
+ StringBuilder sby = new StringBuilder();
+ sby
+ .AppendLine("using System;")
+ .AppendLine("using Polonium.DataStructures;")
+ .AppendLine("public static partial class GlobalRegistry")
+ .AppendLine("{")
+ .AppendLine(" public static partial class TextureSets")
+ .AppendLine(" {");
+ string relativePath = GetRelativePath(RootPath, dir);
+ string godotPath = $"res://Resources/ButtonTextureSet/{relativePath}";
+ string lName = relativePath.Replace("/", "_").Replace(".TextureSet", "").Replace(".", "");
+ string[] parts = relativePath.Split('/');
+ string instanceName = parts[parts.Length - 1].Replace(".TextureSet", "");
+ string instanceFullName = "GlobalRegistry.TextureSets";
+ string indent = " ";
+ StringBuilder sbsy = new StringBuilder();
+ foreach (string part in parts)
+ {
+ if (part == parts[parts.Length - 1])
+ break;
+ sby
+ .AppendLine($"{indent}public static partial class {part}")
+ .AppendLine($"{indent}{{");
+ sbsy.Insert(0, $"{indent}}}");
+ instanceFullName += $".{part}";
+ indent += " ";
+ }
+ instanceFullName += $".{instanceName}";
+ sby
+ .AppendLine($"{indent} public static readonly TextureSet {instanceName} = new TextureSet(\"{godotPath}\");")
+ .Append(sbsy)
+ .AppendLine(" }")
+ .AppendLine("}");
+ File.WriteAllText($"{OutputPath}Patches/{lName}.p.cs", sby.ToString());
+ sbx.AppendLine($" {lName},");
+ sb.AppendLine($" GlobalRegistry.TextureSetMap[GlobalRegistry.TextureSetName.{lName}] = {instanceFullName};");
+ }
+ sbx
+ .AppendLine(" }")
+ .AppendLine("}");
+ sb
+ .AppendLine(" }")
+ .AppendLine("}");
+ File.WriteAllText($"{OutputPath}Patches/TextureSetName.p.cs", sbx.ToString());
+
+ File.WriteAllText($"{OutputPath}Patches/TextureSetMapRegister.p.cs", sb.ToString());
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Log.LogErrorFromException(ex);
+ return false;
+ }
+ }
+
+ private string GetRelativePath(string basePath, string fullPath)
+ {
+ Uri baseUri = new Uri(basePath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basePath : basePath + Path.DirectorySeparatorChar);
+ Uri fullUri = new Uri(fullPath);
+ return Uri.UnescapeDataString(baseUri.MakeRelativeUri(fullUri).ToString().Replace('/', Path.DirectorySeparatorChar));
+ }
+
+}
\ No newline at end of file