Add DisposeAll.
This commit is contained in:
@@ -20,12 +20,6 @@ namespace Cryville.Crtr {
|
||||
base.PreInit();
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
if (Disposed) return;
|
||||
base.Dispose();
|
||||
foreach (var s in sounds) s.Dispose();
|
||||
}
|
||||
|
||||
public override void Update(ContainerState s, StampedEvent ev) {
|
||||
base.Update(s, ev);
|
||||
if (s.CloneType == 16) {
|
||||
@@ -50,5 +44,10 @@ namespace Cryville.Crtr {
|
||||
base.EndUpdate(s);
|
||||
// TODO End of chart
|
||||
}
|
||||
|
||||
public override void DisposeAll() {
|
||||
base.DisposeAll();
|
||||
foreach (var s in sounds) s.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -442,7 +442,7 @@ namespace Cryville.Crtr {
|
||||
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
||||
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
||||
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
||||
if (cbus != null) { cbus.Dispose(); cbus = null; }
|
||||
if (cbus != null) { cbus.Dispose(); cbus.DisposeAll(); cbus = null; }
|
||||
Logger.Log("main", 1, "Game", "Stopped");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
@@ -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);
|
||||
|
@@ -168,6 +168,11 @@ namespace Cryville.Crtr.Event {
|
||||
RMVPool.ReturnAll();
|
||||
MCPool.ReturnAll();
|
||||
}
|
||||
public void DisposeAll() {
|
||||
foreach (var s in Children)
|
||||
s.Value.DisposeAll();
|
||||
Handler.DisposeAll();
|
||||
}
|
||||
|
||||
public void AttachHandler(ContainerHandler h) {
|
||||
if (Handler != null)
|
||||
|
@@ -63,6 +63,9 @@ namespace Cryville.Crtr.Event {
|
||||
public void Dispose() {
|
||||
RootState.Dispose();
|
||||
}
|
||||
public void DisposeAll() {
|
||||
RootState.DisposeAll();
|
||||
}
|
||||
|
||||
public void NotifyWorkingChanged(ContainerState state) {
|
||||
if (!invalidatedStates.Contains(state)) invalidatedStates.Add(state);
|
||||
|
Reference in New Issue
Block a user