Exemple #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);

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

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

                AllEditorGUI.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();
            }
        }