示例#1
0
 public void UpdateChildren()
 {
     for (int i = 0; i < Children.Count; i++)
     {
         SElement child = Children[i];
         child.Root   = Root;
         child.Parent = this;
         child.Update();
     }
 }
示例#2
0
        public void Update()
        {
            if (!Visible)
            {
                return;
            }

            Main = this;
            if (!Backend.Initialized)
            {
                return;
            }

            for (int i = 0; i < Children.Count; i++)
            {
                SElement child = Children[i];
                child.Root   = this;
                child.Parent = null;
                if (child.Enabled)
                {
                    child.Update();
                }
            }

            if (AdoptedChildren.Count != 0)
            {
                for (int i = 0; i < AdoptedChildren.Count; i++)
                {
                    SElement child = AdoptedChildren[i];
                    if (child.Parent == null && !Children.Contains(child))
                    {
                        // Child had no memory who its parents were, so let's just adopt it.
                        Children.Add(child);
                    }
                    else if (child.Parent != null && !child.Parent.Children.Contains(child))
                    {
                        // Child remembers about its parents, but parents not about child. Let's force parents to care.
                        child.Parent.Children.Add(child);
                    }
                }
                AdoptedChildren.Clear();
            }

            if (DisposingChildren.Count != 0 && !Backend.RenderOnGUI)
            {
                for (int i = 0; i < DisposingChildren.Count; i++)
                {
                    DisposingChildren[i].Dispose();
                }
                DisposingChildren.Clear();
            }
        }