private void OnComponentRemoving(Component cmp) { // Notify Components ICmpInitializable cmpInit = cmp as ICmpInitializable; if (cmpInit != null) { cmpInit.OnShutdown(Component.ShutdownContext.RemovingFromGameObject); } foreach (Component c in this.compList) { if (!c.Active || c == cmp) { continue; } ICmpComponentListener cTemp = c as ICmpComponentListener; if (cTemp != null) { cTemp.OnComponentRemoving(cmp); } } // Public event if (this.eventComponentRemoving != null) { this.eventComponentRemoving(this, new ComponentEventArgs(cmp)); } }
private static void OnComponentRemoving(ComponentEventArgs args) { if (args.Component.Active) { ICmpInitializable cInit = args.Component as ICmpInitializable; if (cInit != null) { cInit.OnShutdown(Component.ShutdownContext.Deactivate); } } ComponentRemoving?.Invoke(current, args); }
private void OnComponentRemoving(Component cmp) { // Notify Components ICmpInitializable cmpInit = cmp as ICmpInitializable; if (cmpInit != null) { cmpInit.OnShutdown(Component.ShutdownContext.RemovingFromGameObject); } // Public event this.eventComponentRemoving?.Invoke(this, new ComponentEventArgs(cmp)); }
internal void OnDeactivate() { // Notify Components foreach (Component c in this.compList) { if (!c.ActiveSingle) { continue; } ICmpInitializable cInit = c as ICmpInitializable; if (cInit != null) { cInit.OnShutdown(Component.ShutdownContext.Deactivate); } } }
internal void OnSaving(bool deep = false) { // Notify Components foreach (Component c in this.compList) { ICmpInitializable cInit = c as ICmpInitializable; if (cInit != null) { cInit.OnShutdown(Component.ShutdownContext.Saving); } } if (deep && this.children != null) { foreach (GameObject c in this.children) { c.OnSaving(deep); } } }