Esempio n. 1
0
        private void DrawPaginationBar()
        {
            GUILayout.FlexibleSpace();

            int _count = tableSO.Table.GetPageCount(currentPerPageValue);

            int _paginationStart = Mathf.Max(0, currentPage - pagination);
            int _paginationEnd   = Mathf.Min(_count, currentPage + pagination);

            for (int i = _paginationStart; i < _paginationEnd; i++)
            {
                if (i != currentPage)
                {
                    if (GUILayout.Button((i + 1).ToString(), EditorStatics.Width_27))
                    {
                        currentPage = i;
                    }
                }
            }

            EditorStatics.CreateLabelField(string.Empty, EditorStatics.Width_30);

            labelDistance = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 60;

            currentPerPageValue = EditorStatics.CreateIntPopup(
                "Per Page",
                currentPerPageValue,
                optionsPerPageString,
                optionsPerPageInt,
                EditorStatics.Width_140
                );

            if (currentPerPageValuePrevious != currentPerPageValue)
            {
                currentPage = 0;
                currentPerPageValuePrevious = currentPerPageValue;
            }

            EditorGUIUtility.labelWidth = labelDistance;
        }