예제 #1
0
        public override void Draw(Rect parentPosition, Vector2 mousePosition, int mouseButtonId)
        {
            base.Draw(parentPosition, mousePosition, mouseButtonId);
            Color bufferedColor = GUI.color;

            m_areaLeft.x  = m_transformedArea.x + TabX;
            m_areaRight.x = m_transformedArea.x + m_transformedArea.width - 75 - TabX;

            if (m_toolbarButtonStyle == null)
            {
                m_toolbarButtonStyle            = new GUIStyle(UIUtils.CurrentWindow.CustomStylesInstance.Button);
                m_toolbarButtonStyle.fixedWidth = 100;
            }

            if (m_toggleStyle == null)
            {
                m_toggleStyle = UIUtils.CurrentWindow.CustomStylesInstance.Toggle;
            }

            for (int i = 0; i < m_list.Length; i++)
            {
                GUI.color = m_list[i].IsInside(mousePosition) ? LeftIconsColorOn : LeftIconsColorOff;
                m_list[i].Draw(TabX + m_transformedArea.x + m_list[i].ButtonSpacing, TabY);
            }

            GUI.color = m_focusOnMasterNodeButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_focusOnMasterNodeButton.Draw(m_transformedArea.x + m_transformedArea.width - 70 - TabX, TabY);

            GUI.color = m_focusOnSelectionButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_focusOnSelectionButton.Draw(m_transformedArea.x + m_transformedArea.width - 35 - TabX, TabY);
            GUI.color = bufferedColor;
        }
예제 #2
0
        public override void Draw(Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus)
        {
            base.Draw(parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus);

            Color bufferedColor = GUI.color;

            m_areaLeft.x  = m_transformedArea.x + TabX;
            m_areaRight.x = m_transformedArea.x + m_transformedArea.width - 75 - TabX;

            //if ( m_toolbarButtonStyle == null )
            //{
            //	m_toolbarButtonStyle = new GUIStyle( UIUtils.Button );
            //	m_toolbarButtonStyle.fixedWidth = 100;
            //}

            if (m_toggleStyle == null)
            {
                m_toggleStyle = UIUtils.Toggle;
            }

            //for ( int i = 0; i < m_list.Length; i++ )
            //{
            //	GUI.color = m_list[ i ].IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff;
            //	m_list[ i ].Draw( TabX + m_transformedArea.x + m_list[ i ].ButtonSpacing, TabY );
            //}
            GUI.color = m_updateButton.IsInside(mousePosition) ? LeftIconsColorOn : LeftIconsColorOff;
            m_updateButton.Draw(TabX + m_transformedArea.x + m_updateButton.ButtonSpacing, TabY);

            GUI.color = m_liveButton.IsInside(mousePosition) ? LeftIconsColorOn : LeftIconsColorOff;
            m_liveButton.Draw(TabX + m_transformedArea.x + m_liveButton.ButtonSpacing, TabY);

            GUI.color = m_openSourceCodeButton.IsInside(mousePosition) ? LeftIconsColorOn : LeftIconsColorOff;
            m_openSourceCodeButton.Draw(TabX + m_transformedArea.x + m_openSourceCodeButton.ButtonSpacing, TabY);

            if (m_searchBarVisible)
            {
                m_searchBarSize.x = m_transformedArea.x + m_transformedArea.width - 270 - TabX;
                string currentFocus = GUI.GetNameOfFocusedControl();

                if (Event.current.type == EventType.KeyDown)
                {
                    KeyCode keyCode = Event.current.keyCode;
                    if (Event.current.shift)
                    {
                        if (keyCode == KeyCode.F3 ||
                            ((keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return) &&
                             (currentFocus.Equals(SearchBarId) || string.IsNullOrEmpty(currentFocus))))
                        {
                            SelectPrevious();
                        }
                    }
                    else
                    {
                        if (keyCode == KeyCode.F3 ||
                            ((keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return) &&
                             (currentFocus.Equals(SearchBarId) || string.IsNullOrEmpty(currentFocus))))
                        {
                            SelectNext();
                        }
                    }
                }

                if (currentFocus.Equals(SearchBarId) || (m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains(m_parentWindow.CameraDrawInfo.MousePosition)) || m_selectSearchBarTextfield)
                {
                    EditorGUI.BeginChangeCheck();
                    {
                        GUI.SetNextControlName(SearchBarId);
                        m_searchBarValue = EditorGUI.TextField(m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield);
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_refreshSearchResultList = true;
                    }
                }
                else
                {
                    GUI.Label(m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield);
                }

                m_searchBarSize.x += m_searchBarSize.width;
                if (m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains(m_parentWindow.CameraDrawInfo.MousePosition))
                {
                    if (string.IsNullOrEmpty(m_searchBarValue))
                    {
                        m_searchBarVisible        = false;
                        m_refreshSearchResultList = false;
                    }
                    else
                    {
                        m_searchBarValue = string.Empty;
                        m_searchResultNodes.Clear();
                        m_currentSelected = -1;
                    }
                }

                GUI.Label(m_searchBarSize, string.Empty, UIUtils.ToolbarSearchCancelButton);



                if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape)
                {
                    m_searchBarVisible        = false;
                    m_refreshSearchResultList = false;
                    GUI.FocusControl(null);
                    m_selectSearchBarTextfield = false;
                }

                if (m_refreshSearchResultList && (m_parentWindow.CurrentInactiveTime > InactivityRefreshTime))
                {
                    RefreshList();
                }
            }

            if (m_selectSearchBarTextfield)
            {
                m_selectSearchBarTextfield = false;
                EditorGUI.FocusTextInControl(SearchBarId);
                //GUI.FocusControl( SearchBarId );
            }

            //if ( Event.current.control && Event.current.isKey && Event.current.keyCode == KeyCode.F && Event.current.type == EventType.KeyDown )
            if (m_parentWindow.CurrentCommandName.Equals("Find"))
            {
                if (!m_searchBarVisible)
                {
                    m_searchBarVisible        = true;
                    m_refreshSearchResultList = false;
                }
                m_selectSearchBarTextfield = true;
            }

            GUI.color = m_focusOnSelectionButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_focusOnSelectionButton.Draw(m_transformedArea.x + m_transformedArea.width - 30 - TabX, TabY);

            GUI.color = m_focusOnMasterNodeButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_focusOnMasterNodeButton.Draw(m_transformedArea.x + m_transformedArea.width - 65 - TabX, TabY);

            GUI.color = m_showInfoWindowButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_showInfoWindowButton.Draw(m_transformedArea.x + m_transformedArea.width - 110 - TabX, TabY);

            //GUI.color = m_showTipsWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
            //m_showTipsWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 140 - TabX, TabY );

            GUI.color = m_cleanUnusedNodesButton.IsInside(mousePosition) ? RightIconsColorOn : RightIconsColorOff;
            m_cleanUnusedNodesButton.Draw(m_transformedArea.x + m_transformedArea.width - 140 - TabX, TabY);
            GUI.color = bufferedColor;

            //GUI.color = m_showConsoleWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
            //m_showConsoleWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 170 - TabX, TabY );
            //GUI.color = bufferedColor;
        }