OnGUI() public method

public OnGUI ( Rect rect ) : void
rect UnityEngine.Rect
return void
示例#1
0
        void DoSections(Rect totalRectOfSections, Rect[] sectionRects, SectionType[] sectionOrder)
        {
            Event evt        = Event.current;
            bool  enabledGUI = m_Controller == null || AudioMixerController.EditingTargetSnapshot();

            for (int i = 0; i < sectionOrder.Length; ++i)
            {
                Rect sectionRect = sectionRects[i];
                if (sectionRect.height <= 0.0f)
                {
                    continue;
                }

                switch (sectionOrder[i])
                {
                case SectionType.MixerTree:
                    m_MixersTree.OnGUI(sectionRect);
                    break;

                case SectionType.SnapshotList:
                    using (new EditorGUI.DisabledScope(!enabledGUI))
                    {
                        m_SnapshotListView.OnGUI(sectionRect);
                    }
                    break;

                case SectionType.GroupTree:
                    m_GroupTree.OnGUI(sectionRect);
                    break;

                case SectionType.ViewList:
                    m_GroupViews.OnGUI(sectionRect);
                    break;

                default:
                    Debug.LogError("Unhandled enum value");
                    break;
                }

                if (evt.type == EventType.ContextClick)
                {
                    Rect sectionHeaderRect = new Rect(sectionRect.x, sectionRect.y, sectionRect.width - 15f, AudioMixerDrawUtils.kSectionHeaderHeight);
                    if (sectionHeaderRect.Contains(evt.mousePosition))
                    {
                        ReorderContextMenu(sectionHeaderRect, i);
                        evt.Use();
                    }
                }
            }
        }