|
@@ -478,7 +478,10 @@ namespace ET
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 触发Destroy事件
|
|
// 触发Destroy事件
|
|
|
- EventSystem.Instance.Destroy(this);
|
|
|
|
|
|
|
+ if (this is IDestroy)
|
|
|
|
|
+ {
|
|
|
|
|
+ EventSystem.Instance.Destroy(this);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
this.domain = null;
|
|
this.domain = null;
|
|
|
|
|
|
|
@@ -655,6 +658,12 @@ namespace ET
|
|
|
return default;
|
|
return default;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 如果有IGetComponent接口,则触发GetComponentSystem
|
|
|
|
|
+ if (component is IGetComponent)
|
|
|
|
|
+ {
|
|
|
|
|
+ EventSystem.Instance.GetComponent(component);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (K) component;
|
|
return (K) component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -718,7 +727,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public K AddComponent<K>(bool isFromPool = false) where K : Entity, new()
|
|
|
|
|
|
|
+ public K AddComponent<K>(bool isFromPool = false) where K : Entity, IAwake, new()
|
|
|
{
|
|
{
|
|
|
Type type = typeof (K);
|
|
Type type = typeof (K);
|
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
@@ -733,7 +742,7 @@ namespace ET
|
|
|
return component as K;
|
|
return component as K;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : Entity, new()
|
|
|
|
|
|
|
+ public K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : Entity, IAwake<P1>, new()
|
|
|
{
|
|
{
|
|
|
Type type = typeof (K);
|
|
Type type = typeof (K);
|
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
@@ -748,7 +757,7 @@ namespace ET
|
|
|
return component as K;
|
|
return component as K;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : Entity, new()
|
|
|
|
|
|
|
+ public K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : Entity, IAwake<P1, P2>, new()
|
|
|
{
|
|
{
|
|
|
Type type = typeof (K);
|
|
Type type = typeof (K);
|
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
@@ -763,7 +772,7 @@ namespace ET
|
|
|
return component as K;
|
|
return component as K;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : Entity, new()
|
|
|
|
|
|
|
+ public K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : Entity, IAwake<P1, P2, P3>, new()
|
|
|
{
|
|
{
|
|
|
Type type = typeof (K);
|
|
Type type = typeof (K);
|
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
if (this.components != null && this.components.ContainsKey(type))
|
|
@@ -784,7 +793,7 @@ namespace ET
|
|
|
return entity;
|
|
return entity;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChild<T>(bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChild<T>(bool isFromPool = false) where T : Entity, IAwake
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -795,7 +804,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChild<T, A>(A a, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChild<T, A>(A a, bool isFromPool = false) where T : Entity, IAwake<A>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -806,7 +815,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : Entity, IAwake<A, B>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -817,7 +826,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : Entity, IAwake<A, B, C>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -828,7 +837,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChild<T, A, B, C, D>(A a, B b, C c, D d, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChild<T, A, B, C, D>(A a, B b, C c, D d, bool isFromPool = false) where T : Entity, IAwake<A, B, C, D>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -839,7 +848,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChildWithId<T>(long id, bool isFromPool = false) where T : Entity, new()
|
|
|
|
|
|
|
+ public T AddChildWithId<T>(long id, bool isFromPool = false) where T : Entity, IAwake, new()
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = Entity.Create(type, isFromPool) as T;
|
|
T component = Entity.Create(type, isFromPool) as T;
|
|
@@ -849,7 +858,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChildWithId<T, A>(long id, A a, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChildWithId<T, A>(long id, A a, bool isFromPool = false) where T : Entity, IAwake<A>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -860,7 +869,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChildWithId<T, A, B>(long id, A a, B b, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChildWithId<T, A, B>(long id, A a, B b, bool isFromPool = false) where T : Entity, IAwake<A, B>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
@@ -871,7 +880,7 @@ namespace ET
|
|
|
return component;
|
|
return component;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public T AddChildWithId<T, A, B, C>(long id, A a, B b, C c, bool isFromPool = false) where T : Entity
|
|
|
|
|
|
|
+ public T AddChildWithId<T, A, B, C>(long id, A a, B b, C c, bool isFromPool = false) where T : Entity, IAwake<A, B, C>
|
|
|
{
|
|
{
|
|
|
Type type = typeof (T);
|
|
Type type = typeof (T);
|
|
|
T component = (T) Entity.Create(type, isFromPool);
|
|
T component = (T) Entity.Create(type, isFromPool);
|