Esempio n. 1
0
 public override void OnChildAttached(UIShape parent, UIShape childComponent)
 {
     base.OnChildAttached(parent, childComponent);
     childComponent.OnAppliedChanges -= RefreshContainerForShape;
     childComponent.OnAppliedChanges += RefreshContainerForShape;
     RefreshContainerForShape(childComponent);
 }
Esempio n. 2
0
        void RefreshContainerForShape(BaseDisposable updatedComponent)
        {
            UIShape childComponent = updatedComponent as UIShape;

            Assert.IsTrue(childComponent != null, "This should never happen!!!!");

            if (childComponent.model.parentComponent != id)
            {
                RefreshAll();
                return;
            }

            GameObject stackContainer = null;

            if (!stackContainers.ContainsKey(childComponent.id))
            {
                stackContainer = Object.Instantiate(Resources.Load("UIContainerStackChild")) as GameObject;
#if UNITY_EDITOR
                stackContainer.name = "UIContainerStackChild - " + childComponent.id;
#endif
                stackContainers.Add(childComponent.id, stackContainer);

                int oldSiblingIndex = childComponent.referencesContainer.transform.GetSiblingIndex();
                childComponent.referencesContainer.transform.SetParent(stackContainer.transform, false);
                stackContainer.transform.SetParent(referencesContainer.childHookRectTransform, false);
                stackContainer.transform.SetSiblingIndex(oldSiblingIndex);
            }
            else
            {
                stackContainer = stackContainers[childComponent.id];
            }

            RefreshAll();
        }
Esempio n. 3
0
            bool IsParentVisible(UIShape shape)
            {
                UIShape parent = shape.parentUIComponent;

                if (parent == null)
                {
                    return(true);
                }
                if (parent.referencesContainer.canvasGroup.alpha == 0)
                {
                    return(false);
                }
                return(IsParentVisible(parent));
            }
Esempio n. 4
0
        public override void OnChildDetached(UIShape parentComponent, UIShape childComponent)
        {
            if (parentComponent != this)
            {
                return;
            }

            if (stackContainers.ContainsKey(childComponent.id))
            {
                Object.Destroy(stackContainers[childComponent.id]);
                stackContainers[childComponent.id].transform.SetParent(null);
                stackContainers[childComponent.id].name += "- Detached";
                stackContainers.Remove(childComponent.id);
            }

            childComponent.OnAppliedChanges -= RefreshContainerForShape;
            RefreshDCLLayout();
        }
 public UIShapeUpdateHandler(IDelayedComponent owner) : base(owner)
 {
     uiShapeOwner = owner as UIShape <ReferencesContainerType, ModelType>;
 }
Esempio n. 6
0
 public UIShapeComponent(UIShape image)
 {
     shape = image;
 }