コード例 #1
0
ファイル: EasyLayout.cs プロジェクト: RockfFestival/Rock
        void GroupUIElements()
        {
            uiElementsGroup.Clear();

            var base_length = Stacking == Stackings.Horizontal ? rectTransform.rect.width : rectTransform.rect.height;

            base_length -= (Stacking == Stackings.Horizontal) ? (GetMarginLeft() + GetMarginRight()) : (GetMarginTop() + GetMarginBottom());

            var ui_elements = GetUIElements();

            if (LayoutType == LayoutTypes.Compact)
            {
                EasyLayoutCompact.Group(ui_elements, base_length, this, uiElementsGroup);
            }
            else
            {
                EasyLayoutGrid.Group(ui_elements, base_length, this, uiElementsGroup);
            }

            if (!TopToBottom)
            {
                uiElementsGroup.Reverse();
            }

            if (RightToLeft)
            {
                uiElementsGroup.ForEach(ReverseList);
            }

            CalculateSize();

            Resizer.ResizeGroup(uiElementsGroup);

            foreach (var block in uiElementsGroup.ToArray())
            {
                block.ForEach(x => x.ApplyResize());
            }
        }
コード例 #2
0
ファイル: EasyLayout.cs プロジェクト: TechniPoet/WarBeat
        List <List <RectTransform> > GroupUIElements()
        {
            var base_length = GetLength(rectTransform, false);

            base_length -= (Stacking == Stackings.Horizontal) ? (GetMarginLeft() + GetMarginRight()) : (GetMarginTop() + GetMarginBottom());

            var ui_elements = GetUIElements();

            var group = (LayoutType == LayoutTypes.Compact)
                                ? EasyLayoutCompact.Group(ui_elements, base_length, this)
                                : EasyLayoutGrid.Group(ui_elements, base_length, this);

            if (Stacking == Stackings.Vertical)
            {
                group = Transpose(group);
            }

            if (!TopToBottom)
            {
                group.Reverse();
            }

            if (RightToLeft)
            {
                group.ForEach(ReverseList);
            }

            var width  = rectTransform.rect.width - (GetMarginLeft() + GetMarginRight());
            var height = rectTransform.rect.height - (GetMarginTop() + GetMarginBottom());

            if (LayoutType == LayoutTypes.Grid)
            {
                if (ChildrenWidth == ChildrenSize.FitContainer)
                {
                    ResizeColumnWidthToFit(width, group);
                }
                if (ChildrenHeight == ChildrenSize.FitContainer)
                {
                    ResizeRowHeightToFit(height, group);
                }
            }
            else
            {
                if (Stacking == Stackings.Horizontal)
                {
                    if (ChildrenWidth == ChildrenSize.FitContainer)
                    {
                        ResizeWidthToFit(width, group);
                    }
                    if (ChildrenHeight == ChildrenSize.FitContainer)
                    {
                        ResizeRowHeightToFit(height, group);
                    }
                }
                else
                {
                    if (ChildrenHeight == ChildrenSize.FitContainer)
                    {
                        ResizeHeightToFit(height, group);
                    }
                    if (ChildrenWidth == ChildrenSize.FitContainer)
                    {
                        ResizeColumnWidthToFit(width, group);
                    }
                }
            }

            return(group);
        }