コード例 #1
0
        /// <summary>
        /// Removes the childAdapter
        /// </summary>
        /// <param name="childAdapter"></param>
        override public void RemoveChild(ComponentAdapter childAdapter)
        {
            ContentChildren.Remove(childAdapter);

            childAdapter.transform.parent = null;

            if (!Instantiated || !DesignerState.IsPlaying) // not instantiated
            {
                return;
            }

            var container = (Group)Component;

            if (null != container)
            {
                container.RemoveContentChild(childAdapter.Component);
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds the content child
        /// </summary>
        /// <param name="child"></param>
        /// <param name="register"></param>
        override public void AddChild(ComponentAdapter child, bool register)
        {
            if (ContentChildren.Contains(child))
            {
                ContentChildren.Remove(child);
            }

            ContentChildren.Add(child);

            if (child.FactoryMode)
            {
                return;
            }

            if (!Instantiated || !DesignerState.IsPlaying) // not instantiated
            {
                return;
            }

            DoInstantiate(child, register);
        }
コード例 #3
0
        /// <summary>
        /// Adds the content child at position
        /// </summary>
        /// <param name="index"></param>
        /// <param name="child"></param>
        /// <param name="register"></param>
        override public void AddChildAt(int index, ComponentAdapter child, bool register)
        {
            ContentChildren.Remove(child);

            if (ContentChildren.Count > 0)
            {
                throw new Exception("Only a single child is supported for Scroller");
            }

            ContentChildren.Add(child);

            if (child.FactoryMode)
            {
                return;
            }

            if (!Instantiated || !DesignerState.IsPlaying) // not instantiated
            {
                return;
            }

            DoInstantiate(child, register);
        }