示例#1
0
        private void OnGUI()
        {
            this.Focus();
            this.wantsMouseMove = true;

            if (InstanceCreator.Type == null)
            {
                this.Close();
                return;
            }
            else
            {
                this.RootNode = this.RootNode ?? this.GetTypeTree(InstanceCreator.Type);

                SirenixEditorGUI.BeginHorizontalToolbar(ToolbarBackgroundChainedTop);
                {
                    this.searchChanged = this.searchTerm != (this.searchTerm = SirenixEditorGUI.ToolbarSearchField(this.searchTerm, true)) || this.searchChanged;
                }
                SirenixEditorGUI.EndHorizontalToolbar();

                SirenixEditorGUI.BeginVerticalMenuList(this);
                {
                    this.RootNode.DrawItem();
                }
                SirenixEditorGUI.EndVerticalMenuList();

                SirenixEditorGUI.DrawBorders(new Rect(0, 0, this.position.width, this.position.height), 1, 1, 1, 1, SirenixGUIStyles.BorderColor);

                if (Event.current.type == EventType.Repaint)
                {
                    this.hasSearchTerm = this.searchTerm != null && (this.searchTerm.Length >= 2 || (this.searchTerm.Length == 1 && !char.IsLetter(this.searchTerm[0])));

                    if (this.searchChanged)
                    {
                        this.RootNode.UpdateSearchTerm();

                        this.searchChanged = false;
                    }
                }

                if (this.chosenType != null)
                {
                    this.SetSelectedType();
                    this.chosenType = null;
                    this.Close();
                    return;
                }

                this.RepaintIfRequested();
            }
        }