/// <summary> /// Update and draw the window's UI. /// </summary> private void OnGUI() { this.ProcessKeyboardShortcuts(); EditorGUILayout.BeginHorizontal("Toolbar", GUILayout.ExpandWidth(true)); if (GUILayout.Button("Create", EditorStyles.toolbarDropDown)) { var menu = new GenericMenu(); menu.AddItem(new GUIContent("DataSet"), false, this.CreateDataSet); if (this.activeDataSet != null) { menu.AddItem(new GUIContent("Entity"), false, () => AddEntityWindow.Create(typeof(Data), false, type => GetInstance().AddEntity(type))); } menu.ShowAsContext(); } if (GUILayout.Button("Clear", EditorStyles.toolbarButton)) { this.activeDataSet = null; this.openDataSetGuids.Clear(); SingletonScriptableObject <DataListWindowState> .Instance.ClearState(); this.treeView.Reload(); } GUILayout.Space(5f); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); this.treeView.OnGUI(new Rect(0, 17, this.position.width, this.position.height - 17)); }
private static void OnAddEntity() { AddEntityWindow.Create(typeof(Data), false, type => DataListWindow.GetInstance().AddEntity(type)); }