private void DrawSelectedPrefabOptions(PrefabData selectedPrefabData) { EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Height(52f), GUILayout.ExpandWidth(true)); { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); { if (Selection.activeGameObject != selectedPrefabData.GameObject) { EditorGUILayout.Space(); _assetLabelGui.Draw(selectedPrefabData.GameObject); selectedPrefabData.Labels = _assetLabelGui.GetLabels(selectedPrefabData.GameObject); } } EditorGUILayout.EndVertical(); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); { if (!selectedPrefabData.IsSaved) { if (GUILayout.Button(new GUIContent("Save"), GUILayout.Width(64f), GUILayout.Height(35f))) { selectedPrefabData.IsSaved = true; GUI.changed = true; if (_showNotSaved) { ResetSelection(); } } } if (GUILayout.Button(new GUIContent("Remove"), GUILayout.Width(64f), GUILayout.Height(35f))) { if (EditorUtility.DisplayDialog(Title, string.Format("Are you sure you want to remove {0}?", _selectedPrefabData.Name), "Yes", "No")) { _grid.Remove(selectedPrefabData); PrefabsDataStorage.Instance.Remove(selectedPrefabData); GUI.changed = true; ResetSelection(); } } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
private void OnItemDragged(PrefabData prefabData) { DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = new UnityEngine.Object[] { prefabData.GameObject }; DragAndDrop.StartDrag("Dragging prefab"); }
private void OnItemDoubleClicked(PrefabData prefabData) { Selection.activeGameObject = prefabData.GameObject; }
private void OnItemSelected(PrefabData prefabData) { _selectedPrefabData = prefabData; }
private void ResetSelection() { _grid.DeselectItem(); _selectedPrefabData = null; }
public void Remove(PrefabData data) { PrefabsData.Remove(data); }
public void Add(PrefabData data) { PrefabsData.Add(data); PrefabsData.Sort((item1, item2) => string.Compare(item1.Name, item2.Name, StringComparison.Ordinal)); }