Add DisposeAll.

This commit is contained in:
2023-01-31 15:39:40 +08:00
parent f9a1ea72fe
commit 9700992c3a
5 changed files with 22 additions and 16 deletions

View File

@@ -95,7 +95,7 @@ namespace Cryville.Crtr.Event {
#endregion
#region Logic
/// Called upon StartUpdate of ps 17.
#region Init methods: Called on prehandle
public virtual void PreInit() {
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
SkinContext = new SkinContext(gogroup);
@@ -113,14 +113,7 @@ namespace Cryville.Crtr.Event {
public virtual void PostInit() {
gogroup.gameObject.SetActive(false);
}
public virtual void Dispose() {
if (Disposed) return;
Disposed = true;
if (gogroup)
GameObject.Destroy(gogroup.gameObject);
// gogroup.gameObject.SetActive(false);
Alive = false;
}
#endregion
protected virtual void PreAwake(ContainerState s) {
if (gogroup) {
gogroup.gameObject.SetActive(true);
@@ -174,6 +167,12 @@ namespace Cryville.Crtr.Event {
}
}
}
public virtual void Dispose() {
if (gogroup)
GameObject.Destroy(gogroup.gameObject);
Alive = false;
}
public virtual void DisposeAll() { }
#region Anchor
public virtual void Anchor() {
skinContainer.MatchDynamic(cs);