|
|
@@ -652,18 +652,18 @@ namespace ET
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ // 如果有IGetComponent接口,则触发GetComponentSystem
|
|
|
+ if (this is IGetComponent)
|
|
|
+ {
|
|
|
+ EntitySystemSingleton.Instance.GetComponent(this, typeof(K));
|
|
|
+ }
|
|
|
+
|
|
|
Entity component;
|
|
|
if (!this.components.TryGetValue(typeof (K).FullName, out component))
|
|
|
{
|
|
|
return default;
|
|
|
}
|
|
|
|
|
|
- // 如果有IGetComponent接口,则触发GetComponentSystem
|
|
|
- if (this is IGetComponent)
|
|
|
- {
|
|
|
- EntitySystemSingleton.Instance.GetComponent(this, component);
|
|
|
- }
|
|
|
-
|
|
|
return (K) component;
|
|
|
}
|
|
|
|
|
|
@@ -674,18 +674,19 @@ namespace ET
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ // 如果有IGetComponent接口,则触发GetComponentSystem
|
|
|
+ // 这个要在tryget之前调用,因为有可能components没有,但是执行GetComponentSystem后又有了
|
|
|
+ if (this is IGetComponent)
|
|
|
+ {
|
|
|
+ EntitySystemSingleton.Instance.GetComponent(this, type);
|
|
|
+ }
|
|
|
+
|
|
|
Entity component;
|
|
|
if (!this.components.TryGetValue(type.FullName, out component))
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- // 如果有IGetComponent接口,则触发GetComponentSystem
|
|
|
- if (this is IGetComponent)
|
|
|
- {
|
|
|
- EntitySystemSingleton.Instance.GetComponent(this, component);
|
|
|
- }
|
|
|
-
|
|
|
return component;
|
|
|
}
|
|
|
|