From 07e2a80de567dc16b1a44443baa57d8e481e3f5f Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Mon, 23 Feb 2026 11:40:43 +0800
Subject: [PATCH] =?UTF-8?q?refactor(ecs):=20=E5=B0=86EcsSystemBase?=
=?UTF-8?q?=E4=B8=AD=E7=9A=84EcsWorld=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 将EcsWorld属性的类型从具体类EcsWorld改为接口IEcsWorld
- 修改OnInit方法中的服务获取逻辑以使用接口类型
- 提高代码的抽象性和可扩展性
---
GFramework.Core/ecs/EcsSystemBase.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/GFramework.Core/ecs/EcsSystemBase.cs b/GFramework.Core/ecs/EcsSystemBase.cs
index b978bfe..07784bb 100644
--- a/GFramework.Core/ecs/EcsSystemBase.cs
+++ b/GFramework.Core/ecs/EcsSystemBase.cs
@@ -13,7 +13,7 @@ public abstract class EcsSystemBase : AbstractSystem, IEcsSystem
///
/// ECS世界实例
///
- protected EcsWorld EcsWorld { get; private set; } = null!;
+ protected IEcsWorld EcsWorld { get; private set; } = null!;
///
/// 快捷访问内部World
@@ -35,7 +35,7 @@ public abstract class EcsSystemBase : AbstractSystem, IEcsSystem
///
protected override void OnInit()
{
- EcsWorld = this.GetService() ?? throw new InvalidOperationException(
+ EcsWorld = this.GetService() ?? throw new InvalidOperationException(
"EcsWorld not found in context. Make sure ECS is properly initialized.");
OnEcsInit();