Example #1
0
        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));
            }
        }
Example #2
0
 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);
 }
Example #3
0
        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));
        }
Example #4
0
 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);
         }
     }
 }
Example #5
0
        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);
                }
            }
        }