Наследование: UnityEditor.TreeViewGUI
Пример #1
0
        public void OnGUI(Rect rect)
        {
            int controlID = GUIUtility.GetControlID(FocusType.Keyboard);

            if (AudioMixersTreeView.s_Styles == null)
            {
                AudioMixersTreeView.s_Styles = new AudioMixersTreeView.Styles();
            }
            this.m_TreeView.OnEvent();
            Rect r;
            Rect rect2;

            AudioMixerDrawUtils.DrawRegionBg(rect, out r, out rect2);
            AudioMixerDrawUtils.HeaderLabel(r, AudioMixersTreeView.s_Styles.header, AudioMixersTreeView.s_Styles.audioMixerIcon);
            if (GUI.Button(new Rect(r.xMax - 15f, r.y + 3f, 15f, 15f), AudioMixersTreeView.s_Styles.addText, EditorStyles.label))
            {
                AudioMixersTreeViewGUI audioMixersTreeViewGUI = this.m_TreeView.gui as AudioMixersTreeViewGUI;
                audioMixersTreeViewGUI.BeginCreateNewMixer();
            }
            this.m_TreeView.OnGUI(rect2, controlID);
            if (this.m_TreeView.data.rowCount == 0)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    GUI.Label(new RectOffset(-20, 0, -2, 0).Add(rect2), "No mixers found");
                }
            }
            AudioMixerDrawUtils.DrawScrollDropShadow(rect2, this.m_TreeView.state.scrollPos.y, this.m_TreeView.gui.GetTotalSize().y);
            this.HandleCommandEvents(controlID);
            this.HandleObjectSelectorResult();
        }
 public AudioMixersTreeView(AudioMixerWindow mixerWindow, TreeViewState treeState, Func<List<AudioMixerController>> getAllControllersCallback)
 {
     this.m_TreeView = new TreeViewController(mixerWindow, treeState);
     this.m_TreeView.deselectOnUnhandledMouseDown = false;
     this.m_TreeView.selectionChangedCallback = (Action<int[]>) Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action<int[]>(this.OnTreeSelectionChanged));
     this.m_TreeView.contextClickItemCallback = (Action<int>) Delegate.Combine(this.m_TreeView.contextClickItemCallback, new Action<int>(this.OnTreeViewContextClick));
     AudioMixersTreeViewGUI gui = new AudioMixersTreeViewGUI(this.m_TreeView);
     AudioMixersDataSource data = new AudioMixersDataSource(this.m_TreeView, getAllControllersCallback);
     AudioMixerTreeViewDragging dragging = new AudioMixerTreeViewDragging(this.m_TreeView, new Action<List<AudioMixerController>, AudioMixerController>(this, (IntPtr) this.OnMixersDroppedOnMixerCallback));
     this.m_TreeView.Init(mixerWindow.position, data, gui, dragging);
     this.m_TreeView.ReloadData();
 }
 public AudioMixersTreeView(AudioMixerWindow mixerWindow, TreeViewState treeState, Func<List<AudioMixerController>> getAllControllersCallback)
 {
   this.m_TreeView = new TreeView((EditorWindow) mixerWindow, treeState);
   this.m_TreeView.deselectOnUnhandledMouseDown = false;
   this.m_TreeView.selectionChangedCallback += new System.Action<int[]>(this.OnTreeSelectionChanged);
   this.m_TreeView.contextClickItemCallback += new System.Action<int>(this.OnTreeViewContextClick);
   AudioMixersTreeViewGUI mixersTreeViewGui = new AudioMixersTreeViewGUI(this.m_TreeView);
   AudioMixersDataSource mixersDataSource = new AudioMixersDataSource(this.m_TreeView, getAllControllersCallback);
   AudioMixerTreeViewDragging treeViewDragging = new AudioMixerTreeViewDragging(this.m_TreeView, new System.Action<List<AudioMixerController>, AudioMixerController>(this.OnMixersDroppedOnMixerCallback));
   this.m_TreeView.Init(mixerWindow.position, (ITreeViewDataSource) mixersDataSource, (ITreeViewGUI) mixersTreeViewGui, (ITreeViewDragging) treeViewDragging);
   this.m_TreeView.ReloadData();
 }
Пример #4
0
        public AudioMixersTreeView(AudioMixerWindow mixerWindow, TreeViewState treeState, Func <List <AudioMixerController> > getAllControllersCallback)
        {
            this.m_TreeView = new TreeViewController(mixerWindow, treeState);
            this.m_TreeView.deselectOnUnhandledMouseDown = false;
            this.m_TreeView.selectionChangedCallback     = (Action <int[]>)Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action <int[]>(this.OnTreeSelectionChanged));
            this.m_TreeView.contextClickItemCallback     = (Action <int>)Delegate.Combine(this.m_TreeView.contextClickItemCallback, new Action <int>(this.OnTreeViewContextClick));
            AudioMixersTreeViewGUI     gui      = new AudioMixersTreeViewGUI(this.m_TreeView);
            AudioMixersDataSource      data     = new AudioMixersDataSource(this.m_TreeView, getAllControllersCallback);
            AudioMixerTreeViewDragging dragging = new AudioMixerTreeViewDragging(this.m_TreeView, new Action <List <AudioMixerController>, AudioMixerController>(this.OnMixersDroppedOnMixerCallback));

            this.m_TreeView.Init(mixerWindow.position, data, gui, dragging);
            this.m_TreeView.ReloadData();
        }
Пример #5
0
        public AudioMixersTreeView(AudioMixerWindow mixerWindow, TreeViewState treeState, Func <List <AudioMixerController> > getAllControllersCallback)
        {
            this.m_TreeView = new TreeView((EditorWindow)mixerWindow, treeState);
            this.m_TreeView.deselectOnUnhandledMouseDown = false;
            this.m_TreeView.selectionChangedCallback    += new System.Action <int[]>(this.OnTreeSelectionChanged);
            this.m_TreeView.contextClickItemCallback    += new System.Action <int>(this.OnTreeViewContextClick);
            AudioMixersTreeViewGUI     mixersTreeViewGui = new AudioMixersTreeViewGUI(this.m_TreeView);
            AudioMixersDataSource      mixersDataSource  = new AudioMixersDataSource(this.m_TreeView, getAllControllersCallback);
            AudioMixerTreeViewDragging treeViewDragging  = new AudioMixerTreeViewDragging(this.m_TreeView, new System.Action <List <AudioMixerController>, AudioMixerController>(this.OnMixersDroppedOnMixerCallback));

            this.m_TreeView.Init(mixerWindow.position, (ITreeViewDataSource)mixersDataSource, (ITreeViewGUI)mixersTreeViewGui, (ITreeViewDragging)treeViewDragging);
            this.m_TreeView.ReloadData();
        }
        public AudioMixersTreeView(AudioMixerWindow mixerWindow, TreeViewState treeState, Func <List <AudioMixerController> > getAllControllersCallback)
        {
            m_TreeView = new TreeViewController(mixerWindow, treeState);
            m_TreeView.deselectOnUnhandledMouseDown = false;
            m_TreeView.selectionChangedCallback    += OnTreeSelectionChanged;
            m_TreeView.contextClickItemCallback    += OnTreeViewContextClick;

            var treeViewGUI        = new AudioMixersTreeViewGUI(m_TreeView);
            var treeViewDataSource = new AudioMixersDataSource(m_TreeView, getAllControllersCallback);
            var treeViewDragging   = new AudioMixerTreeViewDragging(m_TreeView, OnMixersDroppedOnMixerCallback);

            m_TreeView.Init(mixerWindow.position, treeViewDataSource, treeViewGUI, treeViewDragging);
            m_TreeView.ReloadData();
        }
        public void OnGUI(Rect rect)
        {
            int treeViewKeyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard);

            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            m_TreeView.OnEvent();

            Rect headerRect, contentRect;

            AudioMixerDrawUtils.DrawRegionBg(rect, out headerRect, out contentRect);
            AudioMixerDrawUtils.HeaderLabel(headerRect, s_Styles.header, s_Styles.audioMixerIcon);

            if (GUI.Button(new Rect(headerRect.xMax - 15f, headerRect.y + 3f, 15f, 15f), s_Styles.addText, EditorStyles.label))
            {
                AudioMixersTreeViewGUI gui = m_TreeView.gui as AudioMixersTreeViewGUI;
                gui.BeginCreateNewMixer();
            }

            m_TreeView.OnGUI(contentRect, treeViewKeyboardControlID);

            if (m_TreeView.data.rowCount == 0)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    GUI.Label(new RectOffset(-20, 0, -2, 0).Add(contentRect), "No mixers found");
                }
            }

            AudioMixerDrawUtils.DrawScrollDropShadow(contentRect, m_TreeView.state.scrollPos.y, m_TreeView.gui.GetTotalSize().y);

            HandleCommandEvents(treeViewKeyboardControlID);
            HandleObjectSelectorResult();
        }