diff --git a/GFramework.Core.Abstractions/lifecycle/IDisposable.cs b/GFramework.Core.Abstractions/lifecycle/IDestroyable.cs
similarity index 89%
rename from GFramework.Core.Abstractions/lifecycle/IDisposable.cs
rename to GFramework.Core.Abstractions/lifecycle/IDestroyable.cs
index 7cfc151..e856543 100644
--- a/GFramework.Core.Abstractions/lifecycle/IDisposable.cs
+++ b/GFramework.Core.Abstractions/lifecycle/IDestroyable.cs
@@ -3,7 +3,7 @@
///
/// 可销毁接口,为需要资源清理的组件提供标准销毁能力
///
-public interface IDisposable
+public interface IDestroyable
{
///
/// 销毁组件并释放资源
diff --git a/GFramework.Core.Abstractions/lifecycle/ILifecycle.cs b/GFramework.Core.Abstractions/lifecycle/ILifecycle.cs
index b3bb67f..631a361 100644
--- a/GFramework.Core.Abstractions/lifecycle/ILifecycle.cs
+++ b/GFramework.Core.Abstractions/lifecycle/ILifecycle.cs
@@ -3,4 +3,4 @@
///
/// 完整生命周期接口,组合了初始化和销毁能力
///
-public interface ILifecycle : IInitializable, IDisposable;
\ No newline at end of file
+public interface ILifecycle : IInitializable, IDestroyable;
\ No newline at end of file
diff --git a/GFramework.Core/architecture/Architecture.cs b/GFramework.Core/architecture/Architecture.cs
index e937632..ee09f14 100644
--- a/GFramework.Core/architecture/Architecture.cs
+++ b/GFramework.Core/architecture/Architecture.cs
@@ -11,7 +11,6 @@ using GFramework.Core.environment;
using GFramework.Core.extensions;
using GFramework.Core.logging;
using Microsoft.Extensions.DependencyInjection;
-using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable;
namespace GFramework.Core.architecture;
@@ -117,12 +116,12 @@ public abstract class Architecture(
///
/// 可销毁组件的去重集合
///
- private readonly HashSet _disposableSet = [];
+ private readonly HashSet _disposableSet = [];
///
/// 存储所有需要销毁的组件(统一管理,保持注册逆序销毁)
///
- private readonly List _disposables = [];
+ private readonly List _disposables = [];
///
/// 生命周期感知对象列表
@@ -262,7 +261,7 @@ public abstract class Architecture(
}
// 处理销毁
- if (component is not IDisposable disposable) return;
+ if (component is not IDestroyable disposable) return;
// 原子去重:HashSet.Add 返回 true 表示添加成功(之前不存在)
if (_disposableSet.Add(disposable))
{
@@ -377,7 +376,7 @@ public abstract class Architecture(
_logger.Info("Starting architecture destruction");
EnterPhase(ArchitecturePhase.Destroying);
- // 销毁所有实现了 IDisposable 的组件(按注册逆序销毁)
+ // 销毁所有实现了 IDestroyable 的组件(按注册逆序销毁)
_logger.Info($"Destroying {_disposables.Count} disposable components");
for (var i = _disposables.Count - 1; i >= 0; i--)
diff --git a/GFramework.Core/coroutine/instructions/WaitForEvent.cs b/GFramework.Core/coroutine/instructions/WaitForEvent.cs
index 1c15fab..a547041 100644
--- a/GFramework.Core/coroutine/instructions/WaitForEvent.cs
+++ b/GFramework.Core/coroutine/instructions/WaitForEvent.cs
@@ -15,9 +15,10 @@ using GFramework.Core.Abstractions.coroutine;
using GFramework.Core.Abstractions.events;
namespace GFramework.Core.coroutine.instructions;
+
///
/// WaitForEvent 类用于等待特定事件的发生,并提供事件数据和完成状态。
-/// 实现了 IYieldInstruction 和 IDisposable 接口,支持协程等待和资源释放。
+/// 实现了 IYieldInstruction 和 IDestroyable 接口,支持协程等待和资源释放。
///
/// 事件类型
public sealed class WaitForEvent : IYieldInstruction, IDisposable
@@ -83,4 +84,4 @@ public sealed class WaitForEvent : IYieldInstruction, IDisposable
EventData = eventData;
_done = true;
}
-}
+}
\ No newline at end of file
diff --git a/GFramework.Core/coroutine/instructions/WaitForMultipleEvents.cs b/GFramework.Core/coroutine/instructions/WaitForMultipleEvents.cs
index 3b5a7c7..6e691a5 100644
--- a/GFramework.Core/coroutine/instructions/WaitForMultipleEvents.cs
+++ b/GFramework.Core/coroutine/instructions/WaitForMultipleEvents.cs
@@ -5,7 +5,7 @@ namespace GFramework.Core.coroutine.instructions;
///
/// 等待多个事件中的任意一个触发的指令
-/// 实现了 IDisposable 接口,支持资源释放
+/// 实现了 IDestroyable 接口,支持资源释放
///
/// 第一个事件类型
/// 第二个事件类型
diff --git a/GFramework.Core/state/AsyncContextAwareStateBase.cs b/GFramework.Core/state/AsyncContextAwareStateBase.cs
index ff99f21..b12d250 100644
--- a/GFramework.Core/state/AsyncContextAwareStateBase.cs
+++ b/GFramework.Core/state/AsyncContextAwareStateBase.cs
@@ -12,9 +12,9 @@
// limitations under the License.
using GFramework.Core.Abstractions.architecture;
+using GFramework.Core.Abstractions.lifecycle;
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.state;
-using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable;
namespace GFramework.Core.state;
@@ -23,7 +23,7 @@ namespace GFramework.Core.state;
/// 提供基础的异步状态管理功能和架构上下文访问能力
/// 实现了IAsyncState(继承IState)和IContextAware接口
///
-public class AsyncContextAwareStateBase : IAsyncState, IContextAware, IDisposable
+public class AsyncContextAwareStateBase : IAsyncState, IContextAware, IDestroyable
{
///
/// 架构上下文引用,用于访问架构相关的服务和数据
diff --git a/GFramework.Core/state/ContextAwareStateBase.cs b/GFramework.Core/state/ContextAwareStateBase.cs
index 9bca0d9..0c44a6d 100644
--- a/GFramework.Core/state/ContextAwareStateBase.cs
+++ b/GFramework.Core/state/ContextAwareStateBase.cs
@@ -1,7 +1,7 @@
using GFramework.Core.Abstractions.architecture;
+using GFramework.Core.Abstractions.lifecycle;
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.state;
-using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable;
namespace GFramework.Core.state;
@@ -10,7 +10,7 @@ namespace GFramework.Core.state;
/// 提供基础的状态管理功能和架构上下文访问能力
/// 实现了IState和IContextAware接口
///
-public class ContextAwareStateBase : IState, IContextAware, IDisposable
+public class ContextAwareStateBase : IState, IContextAware, IDestroyable
{
///
/// 架构上下文引用,用于访问架构相关的服务和数据
diff --git a/GFramework.Core/state/StateMachineSystem.cs b/GFramework.Core/state/StateMachineSystem.cs
index adde85e..b94d552 100644
--- a/GFramework.Core/state/StateMachineSystem.cs
+++ b/GFramework.Core/state/StateMachineSystem.cs
@@ -1,9 +1,9 @@
using GFramework.Core.Abstractions.architecture;
using GFramework.Core.Abstractions.enums;
+using GFramework.Core.Abstractions.lifecycle;
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.state;
using GFramework.Core.extensions;
-using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable;
namespace GFramework.Core.state;
@@ -74,7 +74,7 @@ public class StateMachineSystem : StateMachine, IStateMachineSystem
}
// 清理所有状态
- foreach (var state in States.Values.OfType()) state.Destroy();
+ foreach (var state in States.Values.OfType()) state.Destroy();
States.Clear();
}