public void UpdateRenderer()
        {
            /*
             *
             * 1,2 1
             * 1,2,3 1,2
             */

            var allActiveChildren = new List <Transform>();

            for (var i = 0; i < CacheTransform.childCount; i++)
            {
                var childTf = CacheTransform.GetChild(i);
                if (childTf.gameObject.activeSelf)
                {
                    allActiveChildren.Add(childTf);
                }
            }

            var positions = new Vector3[allActiveChildren.Count];

            for (var i = 0; i < positions.Length; i++)
            {
                positions[i] = allActiveChildren[i].position;
            }

            mLineRenderer.positionCount = positions.Length;
            mLineRenderer.SetPositions(positions);
        }
Ejemplo n.º 2
0
    public override void OnDesignUpdate(UIDesignView view)
    {
        base.OnDesignUpdate(view);

        if (view.DesignRunTime == UIDesignView.UIDesignRunTime.None)
        {
            return;
        }

        float scaleX = 1;
        float scaleY = 1;
        float scaleZ = 1;

        if (view.DesignRunTime == UIDesignView.UIDesignRunTime.Height)
        {
            scaleY = CacheTransform.lossyScale.y;
            scaleZ = scaleX = scaleY;
        }
        else if (view.DesignRunTime == UIDesignView.UIDesignRunTime.Width)
        {
            scaleX = CacheTransform.lossyScale.x;
            scaleZ = scaleY = scaleX;
        }

        CacheTransform.localScale = new Vector3(scaleX / CacheTransform.lossyScale.x, scaleY / CacheTransform.lossyScale.y, scaleZ / CacheTransform.lossyScale.z);
        Panel.baseClipRegion      = new Vector4(Panel.baseClipRegion.x / CacheTransform.localScale.x, Panel.baseClipRegion.y / CacheTransform.localScale.y
                                                , Panel.baseClipRegion.z / CacheTransform.localScale.x, Panel.baseClipRegion.w / CacheTransform.localScale.y);
        Panel.clipOffset = new Vector2(Panel.clipOffset.x / CacheTransform.localScale.x, Panel.clipOffset.y / CacheTransform.localScale.y);
        for (int i = 0; i < CacheTransform.childCount; i++)
        {
            CacheTransform.GetChild(i).localScale = new Vector3(1 / CacheTransform.localScale.x, 1 / CacheTransform.localScale.y, 1 / CacheTransform.localScale.z);
        }
    }
Ejemplo n.º 3
0
    void UpdateDesign(UIDesignView view)
    {
        float scaleX = 1;
        float scaleY = 1;
        float scaleZ = 1;

        if (ScrollView.movement == UIScrollView.Movement.Vertical)
        {
            scaleY = CacheTransform.lossyScale.y;
            scaleZ = scaleX = scaleY;
        }
        else if (ScrollView.movement == UIScrollView.Movement.Horizontal)
        {
            scaleX = CacheTransform.lossyScale.x;
            scaleZ = scaleY = scaleX;
        }
        else
        {
            Debug.LogError("Unsupported UIScrollView Movement");
            return;
        }

        CacheTransform.localScale = new Vector3(scaleX / CacheTransform.lossyScale.x, scaleY / CacheTransform.lossyScale.y, scaleZ / CacheTransform.lossyScale.z);
        Panel.baseClipRegion      = new Vector4(Panel.baseClipRegion.x / CacheTransform.localScale.x, Panel.baseClipRegion.y / CacheTransform.localScale.y
                                                , Panel.baseClipRegion.z / CacheTransform.localScale.x, Panel.baseClipRegion.w / CacheTransform.localScale.y);
        Panel.clipOffset = new Vector2(Panel.clipOffset.x / CacheTransform.localScale.x, Panel.clipOffset.y / CacheTransform.localScale.y);
        for (int i = 0; i < CacheTransform.childCount; i++)
        {
            CacheTransform.GetChild(i).localScale = new Vector3(1 / CacheTransform.localScale.x, 1 / CacheTransform.localScale.y, 1 / CacheTransform.localScale.z);
        }
    }
Ejemplo n.º 4
0
        protected virtual void OnInit()
        {
            if (templateRect == null)
            {
                if (CacheTransform.childCount > 0)
                {
                    templateRect = CacheTransform.GetChild(0) as RectTransform;
                }
            }
            if (templateRect != null)
            {
                UGUITools.SetVisible(templateRect, false);
            }
            if (rowCount < 1)
            {
                rowCount = 1;
            }
            if (columnCount < 1)
            {
                columnCount = 1;
            }
            if (!NoScroll)
            {
                ScrollRect = UGUITools.SecureComponetInParent <ScrollRect>(CacheRectTransform);
            }
            if (ScrollRect != null)
            {
                ScrollRect.horizontal = !IsVertical;
                ScrollRect.vertical   = IsVertical;
            }

            _Pool = new GNewPrivatePool <LayoutItem>(PoolSize);
        }