예제 #1
0
파일: Node.cs 프로젝트: klenin/Citrus
        /// <summary>
        /// Returns a clone of the node hierarchy.
        /// </summary>
        public virtual Node Clone()
        {
            var clone = (Node)MemberwiseClone();

            ++CreatedCount;
            clone.Parent         = null;
            clone.FirstAnimation = null;
            clone.FirstChild     = null;
            clone.NextSibling    = null;
            clone.gestures       = null;
            clone.AsWidget       = clone as Widget;
            clone.Animations     = Animations.Clone(clone);
            clone.Animators      = AnimatorCollection.SharedClone(clone, Animators);
            clone.Nodes          = Nodes.Clone(clone);
            clone.Components     = Components.Clone(clone);
            clone.IsAwake        = false;
            if (RenderChainBuilder != null)
            {
                clone.RenderChainBuilder = RenderChainBuilder.Clone(clone);
            }
            if (Presenter != null)
            {
                clone.Presenter = Presenter.Clone();
            }
            if (PostPresenter != null)
            {
                clone.PostPresenter = PostPresenter.Clone();
            }
            clone.DirtyMask = DirtyFlags.All;
            clone.UserData  = null;
            return(clone);
        }
예제 #2
0
        internal static AnimatorCollection SharedClone(Node owner, AnimatorCollection source)
        {
            var result = new AnimatorCollection(owner);

            foreach (var animator in source)
            {
                result.Add(animator.Clone());
            }
            return(result);
        }
예제 #3
0
파일: Node.cs 프로젝트: klenin/Citrus
 protected Node()
 {
     AnimationSpeed     = 1;
     Components         = new NodeComponentCollection(this);
     Animators          = new AnimatorCollection(this);
     Animations         = new AnimationCollection(this);
     Nodes              = new NodeList(this);
     Presenter          = DefaultPresenter.Instance;
     RenderChainBuilder = this;
     ++CreatedCount;
 }