Exemplo n.º 1
0
        void RefreshContainerForShape(BaseDisposable updatedComponent)
        {
            UIShape childComponent = updatedComponent as UIShape;

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

            if (((UIShape.Model)childComponent.GetModel()).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();
        }
Exemplo n.º 2
0
 void RefreshContainerForShape(BaseDisposable updatedComponent)
 {
     RefreshAll();
     referencesContainer.fitter.RefreshRecursively();
     AdjustChildHook();
     referencesContainer.scrollRect.Rebuild(CanvasUpdate.MaxUpdateValue);
 }
Exemplo n.º 3
0
 private void DetachFromMaterial(BaseDisposable baseDisposable)
 {
     if (attachedMaterials.ContainsKey(baseDisposable.id))
     {
         attachedMaterials.Remove(baseDisposable.id);
         baseDisposable.OnAttach -= OnEntityAttachedMaterial;
         baseDisposable.OnDetach -= OnEntityDetachedMaterial;
         isPlayStateDirty         = true;
     }
 }
Exemplo n.º 4
0
        private void AttachToMaterial(BaseDisposable baseDisposable)
        {
            if (!attachedMaterials.ContainsKey(baseDisposable.id))
            {
                attachedMaterials.Add(baseDisposable.id, new MaterialComponent(baseDisposable));
                baseDisposable.OnAttach += OnEntityAttachedMaterial;
                baseDisposable.OnDetach += OnEntityDetachedMaterial;
                isPlayStateDirty         = true;

                if (baseDisposable.attachedEntities.Count > 0)
                {
                    using (var iterator = baseDisposable.attachedEntities.GetEnumerator())
                    {
                        while (iterator.MoveNext())
                        {
                            var entity = iterator.Current;
                            entity.OnShapeUpdated -= OnEntityShapeUpdated;
                            entity.OnShapeUpdated += OnEntityShapeUpdated;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 public MaterialComponent(BaseDisposable component)
 {
     this.component = component;
 }