Example #1
0
        void DrawColumnContents(
            int index, Rect bounds, IMemoryPool pool)
        {
            switch (index)
            {
            case 0:
            {
                GUI.Label(bounds, GetName(pool), _settings.ContentNameTextStyle);
                break;
            }

            case 1:
            {
                GUI.Label(bounds, pool.NumTotal.ToString(), _settings.ContentNumberTextStyle);
                break;
            }

            case 2:
            {
                GUI.Label(bounds, pool.NumActive.ToString(), _settings.ContentNumberTextStyle);
                break;
            }

            case 3:
            {
                GUI.Label(bounds, pool.NumInactive.ToString(), _settings.ContentNumberTextStyle);
                break;
            }

            case 4:
            {
                var buttonBounds = new Rect(
                    bounds.x + _settings.ButtonMargin, bounds.y, bounds.width - _settings.ButtonMargin, bounds.height);

                if (GUI.Button(buttonBounds, "Clear"))
                {
                    pool.Clear();
                }
                break;
            }

            case 5:
            {
                var buttonBounds = new Rect(
                    bounds.x, bounds.y, bounds.width - 15.0f, bounds.height);

                if (GUI.Button(buttonBounds, "Expand"))
                {
                    pool.ExpandBy(5);
                }
                break;
            }

            default:
            {
                throw Assert.CreateException();
            }
            }
        }