Add DisposeAll.
This commit is contained in:
@@ -20,12 +20,6 @@ namespace Cryville.Crtr {
|
|||||||
base.PreInit();
|
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) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
base.Update(s, ev);
|
||||||
if (s.CloneType == 16) {
|
if (s.CloneType == 16) {
|
||||||
@@ -50,5 +44,10 @@ namespace Cryville.Crtr {
|
|||||||
base.EndUpdate(s);
|
base.EndUpdate(s);
|
||||||
// TODO End of chart
|
// 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 (nbus != null) { nbus.Dispose(); nbus = null; }
|
||||||
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
||||||
if (bbus != null) { bbus.Dispose(); bbus = 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");
|
Logger.Log("main", 1, "Game", "Stopped");
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@@ -95,7 +95,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logic
|
#region Logic
|
||||||
/// Called upon StartUpdate of ps 17.
|
#region Init methods: Called on prehandle
|
||||||
public virtual void PreInit() {
|
public virtual void PreInit() {
|
||||||
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
||||||
SkinContext = new SkinContext(gogroup);
|
SkinContext = new SkinContext(gogroup);
|
||||||
@@ -113,14 +113,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
public virtual void PostInit() {
|
public virtual void PostInit() {
|
||||||
gogroup.gameObject.SetActive(false);
|
gogroup.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
public virtual void Dispose() {
|
#endregion
|
||||||
if (Disposed) return;
|
|
||||||
Disposed = true;
|
|
||||||
if (gogroup)
|
|
||||||
GameObject.Destroy(gogroup.gameObject);
|
|
||||||
// gogroup.gameObject.SetActive(false);
|
|
||||||
Alive = false;
|
|
||||||
}
|
|
||||||
protected virtual void PreAwake(ContainerState s) {
|
protected virtual void PreAwake(ContainerState s) {
|
||||||
if (gogroup) {
|
if (gogroup) {
|
||||||
gogroup.gameObject.SetActive(true);
|
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
|
#region Anchor
|
||||||
public virtual void Anchor() {
|
public virtual void Anchor() {
|
||||||
skinContainer.MatchDynamic(cs);
|
skinContainer.MatchDynamic(cs);
|
||||||
|
@@ -168,6 +168,11 @@ namespace Cryville.Crtr.Event {
|
|||||||
RMVPool.ReturnAll();
|
RMVPool.ReturnAll();
|
||||||
MCPool.ReturnAll();
|
MCPool.ReturnAll();
|
||||||
}
|
}
|
||||||
|
public void DisposeAll() {
|
||||||
|
foreach (var s in Children)
|
||||||
|
s.Value.DisposeAll();
|
||||||
|
Handler.DisposeAll();
|
||||||
|
}
|
||||||
|
|
||||||
public void AttachHandler(ContainerHandler h) {
|
public void AttachHandler(ContainerHandler h) {
|
||||||
if (Handler != null)
|
if (Handler != null)
|
||||||
|
@@ -63,6 +63,9 @@ namespace Cryville.Crtr.Event {
|
|||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
RootState.Dispose();
|
RootState.Dispose();
|
||||||
}
|
}
|
||||||
|
public void DisposeAll() {
|
||||||
|
RootState.DisposeAll();
|
||||||
|
}
|
||||||
|
|
||||||
public void NotifyWorkingChanged(ContainerState state) {
|
public void NotifyWorkingChanged(ContainerState state) {
|
||||||
if (!invalidatedStates.Contains(state)) invalidatedStates.Add(state);
|
if (!invalidatedStates.Contains(state)) invalidatedStates.Add(state);
|
||||||
|
Reference in New Issue
Block a user