protected void OnEnable() { BloxContainerInspector.Instance = this; this.Target = (BloxContainer)base.target; if ((UnityEngine.Object) this.Target.bloxGlobalPrefab != (UnityEngine.Object)BloxEd.BloxGlobalPrefab) { this.Target.bloxGlobalPrefab = BloxEd.BloxGlobalPrefab; this.Save(); } this.CacheBloxList(null, null); plyReorderableList.Button[] extraButtons = new plyReorderableList.Button[3] { new plyReorderableList.Button { label = new GUIContent(Ico._settings, "Open Blox settings"), callback = BloxSettingsWindow.Show_BloxSettingsWindow }, new plyReorderableList.Button { label = new GUIContent(Ico._blox + "Edit", "Edit selected Blox"), callback = this.OnDoubleClick, requireSelected = true }, new plyReorderableList.Button { label = new GUIContent(Ico._rename, "Rename selected Blox"), callback = this.OnRenameBlox, requireSelected = true } }; plyReorderableList.Button[] addOptions = new plyReorderableList.Button[2] { new plyReorderableList.Button { label = new GUIContent("Create new"), callback = this.AddNewBloxDef }, new plyReorderableList.Button { label = new GUIContent("Add Existing"), callback = this.AddExistingBloxDef } }; this.list = new plyReorderableList(this.targetBloxCache, typeof(Blox), true, true, true, true, false, false, false, extraButtons, addOptions); this.list.elementHeight = (float)(EditorGUIUtility.singleLineHeight + 2.0 + 4.0); this.list.drawHeaderCallback = this.DrawListHeader; this.list.drawElementCallback = this.DrawListElement; this.list.onSelectElement = this.OnSelectBlox; this.list.onDoubleClickElement = this.OnDoubleClick; this.list.onRemoveElement = this.OnRemove; this.list.onReorder = this.OnReorder; this.varEditor = new plyVariablesEditor(null, plyVariablesType.Blox, this.Target.gameObject, true, false, true, this.Repaint, this.Save, null); this.varEditor.GC_Head = BloxContainerInspector.GC_VarsHead; if (this.targetBloxCache.Count > 0) { this.list.index = 0; this.OnSelectBlox(); } }
public void OnSelected(EditorWindow editorWindow) { this.editorWindow = editorWindow; if (this.listEd == null) { if (this.extraButtons == null) { this.extraButtons = new plyReorderableList.Button[0]; } ArrayUtility.Add <plyReorderableList.Button>(ref this.extraButtons, new plyReorderableList.Button { label = new GUIContent(Ico._rename, "Rename selected"), callback = this.Item_Rename, requireSelected = true }); this.listEd = new ReorderableGroupedData <GroupT, ItemT>(this.groupedData, true, true, true, true, false, this.extraButtons); this.listEd.elementHeight = (float)(EditorGUIUtility.singleLineHeight + 6.0); this.listEd.drawElementCallback = this.Item_Draw; this.listEd.onAddElement = this.Item_Add; this.listEd.onRemoveElement = this.Item_Remove; this.listEd.onReorder = this.Save; this.listEd.onGroupChanged = this.Save; } if (this.metaEd == null) { this.metaEd = new plyVariablesEditor(null, plyVariablesType.Custom, null, true, true, true, editorWindow.Repaint, this.Save, new plyReorderableList.Button[1] { new plyReorderableList.Button { label = new GUIContent(Ico._copy, "Duplicate these properties"), callback = this.Meta_Duplicate, requireSelected = false } }); this.metaEd.GC_Head = new GUIContent("Meta Properties"); this.metaEd.nameString = "Property"; this.metaEd.canStartDragDrop = false; } this.OnFocus(); }