diff --git a/GFramework.Core.Godot/GFramework.Core.Godot.csproj b/GFramework.Core.Godot/GFramework.Core.Godot.csproj
new file mode 100644
index 0000000..7b08386
--- /dev/null
+++ b/GFramework.Core.Godot/GFramework.Core.Godot.csproj
@@ -0,0 +1,18 @@
+
+
+
+ GeWuYou.GFramework.Core.Godot
+ enable
+ enable
+ net9.0;net8.0
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GFramework.Core/godot/NodeExtensions.cs b/GFramework.Core.Godot/godot/extensions/NodeExtensions.cs
similarity index 89%
rename from GFramework.Core/godot/NodeExtensions.cs
rename to GFramework.Core.Godot/godot/extensions/NodeExtensions.cs
index 9e22fe9..3317682 100644
--- a/GFramework.Core/godot/NodeExtensions.cs
+++ b/GFramework.Core.Godot/godot/extensions/NodeExtensions.cs
@@ -1,7 +1,5 @@
-#if GODOT
-using System.Threading.Tasks;
-using Godot;
-namespace GFramework.framework.godot;
+using Godot;
+namespace GFramework.Core.Godot.godot.extensions;
///
/// 节点扩展方法类,提供对Godot节点的扩展功能
@@ -12,7 +10,7 @@ public static class NodeExtensions
/// 安全地将节点加入删除队列,在下一帧开始时释放节点资源
///
/// 要释放的节点实例
- public static void QueueFreeX(this Node node)
+ public static void QueueFreeX(this Node? node)
{
// 检查节点是否为空
if (node is null)
@@ -40,7 +38,7 @@ public static class NodeExtensions
/// 立即释放节点资源,不等待下一帧
///
/// 要立即释放的节点实例
- public static void FreeX(this Node node)
+ public static void FreeX(this Node? node)
{
// 检查节点是否为空
if (node is null)
@@ -82,7 +80,7 @@ public static class NodeExtensions
/// 2. Godot 实例仍然存在(未被释放)
/// 3. 已经加入 SceneTree
///
- public static bool IsValidNode(this Node node)
+ public static bool IsValidNode(this Node? node)
{
return node is not null &&
GodotObject.IsInstanceValid(node) &&
@@ -97,11 +95,10 @@ public static class NodeExtensions
///
/// 返回 true 表示该节点不可用。
///
- public static bool IsInvalidNode(this Node node)
+ public static bool IsInvalidNode(this Node? node)
{
return node is null ||
!GodotObject.IsInstanceValid(node) ||
!node.IsInsideTree();
}
-}
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/GFramework.Core/extensions/UnRegisterExtension.cs b/GFramework.Core.Godot/godot/extensions/UnRegisterExtension.cs
similarity index 89%
rename from GFramework.Core/extensions/UnRegisterExtension.cs
rename to GFramework.Core.Godot/godot/extensions/UnRegisterExtension.cs
index 8624599..0b317dc 100644
--- a/GFramework.Core/extensions/UnRegisterExtension.cs
+++ b/GFramework.Core.Godot/godot/extensions/UnRegisterExtension.cs
@@ -1,8 +1,7 @@
-#if GODOT
+using GFramework.Core.events;
using Godot;
-using GWFramework.framework.events;
-namespace GWFramework.framework.extensions;
+namespace GFramework.Core.Godot.godot.extensions;
///
/// 提供取消注册扩展方法的静态类
@@ -21,6 +20,4 @@ public static class UnRegisterExtension
node.TreeExiting += unRegister.UnRegister;
return unRegister;
}
-}
-
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/GFramework.csproj b/GFramework.csproj
index 3a64a79..d06260d 100644
--- a/GFramework.csproj
+++ b/GFramework.csproj
@@ -38,6 +38,18 @@
+
+
+
+
+ GFramework.Godot\godot\extensions\NodeExtensions.cs
+
+
+ GFramework.Godot\godot\extensions\UnRegisterExtension.cs
+
+
+
+
diff --git a/GFramework.sln b/GFramework.sln
index e5505f5..5fb5554 100644
--- a/GFramework.sln
+++ b/GFramework.sln
@@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Generator.Attrib
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Core", "GFramework.Core\GFramework.Core.csproj", "{A6D5854D-79EA-487A-9ED9-396E6A1F8031}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GFramework.Core.Godot", "GFramework.Core.Godot\GFramework.Core.Godot.csproj", "{FC56D81A-3A3B-4B49-B318-363DFA0D8206}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -30,5 +32,9 @@ Global
{A6D5854D-79EA-487A-9ED9-396E6A1F8031}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6D5854D-79EA-487A-9ED9-396E6A1F8031}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6D5854D-79EA-487A-9ED9-396E6A1F8031}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FC56D81A-3A3B-4B49-B318-363DFA0D8206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FC56D81A-3A3B-4B49-B318-363DFA0D8206}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FC56D81A-3A3B-4B49-B318-363DFA0D8206}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FC56D81A-3A3B-4B49-B318-363DFA0D8206}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal