InitNumRowsAndColumns() public method

public InitNumRowsAndColumns ( int itemCount, int maxNumRows ) : void
itemCount int
maxNumRows int
return void
コード例 #1
0
        void SetupGrid(float availableWidth, int itemCount, PresetLibraryEditorState.ItemViewMode presetsViewMode)
        {
            m_Grid.useFixedHorizontalSpacing = useOnePixelOverlappedGrid;
            m_Grid.fixedHorizontalSpacing    = useOnePixelOverlappedGrid ? -1 : 0;

            switch (presetsViewMode)
            {
            case PresetLibraryEditorState.ItemViewMode.Grid:
                m_Grid.fixedWidth           = availableWidth;
                m_Grid.topMargin            = marginsForGrid.top;
                m_Grid.bottomMargin         = marginsForGrid.bottom;
                m_Grid.leftMargin           = marginsForGrid.left;
                m_Grid.rightMargin          = marginsForGrid.right;
                m_Grid.verticalSpacing      = useOnePixelOverlappedGrid ? -1 : lineSpacing;
                m_Grid.minHorizontalSpacing = 8f;
                m_Grid.itemSize             = presetSize; // no text
                m_Grid.InitNumRowsAndColumns(itemCount, int.MaxValue);
                break;

            case PresetLibraryEditorState.ItemViewMode.List:
                m_Grid.fixedWidth           = availableWidth;
                m_Grid.topMargin            = marginsForList.top;
                m_Grid.bottomMargin         = marginsForList.bottom;
                m_Grid.leftMargin           = marginsForList.left;
                m_Grid.rightMargin          = marginsForList.right;
                m_Grid.verticalSpacing      = lineSpacing;
                m_Grid.minHorizontalSpacing = 0f;
                m_Grid.itemSize             = new Vector2(availableWidth - m_Grid.leftMargin, presetSize.y);
                m_Grid.InitNumRowsAndColumns(itemCount, int.MaxValue);
                break;
            }
        }